webrick 服务器/ie6 在开发模式下截断 javascript 文件

发布于 2024-07-19 13:42:45 字数 1693 浏览 4 评论 0原文

我正在使用 webrick 在开发模式下运行我的 Rails 应用程序。 该页面包含 4-5 个 javascript 文件,这些文件也由同一个 webrick 实例提供服务。

当我在 ie6 上加载页面时,似乎 javascript 文件在前几行之后被截断——任何人都可以解释一下吗? 例如,如果页面包含此脚本标记:

<script type="text/javascript" src="http://myserver:3200/javascripts/jquery.js"></script>

当页面在 ie6 中加​​载时,它会引发 javascript 语法错误,并且 Visual Web Developer (VWD) 允许我打开已加载的 jquery.js 文件,它只显示前 ~30线,然后就停下来。

从运行 ie6 的同一台机器上,我尝试使用 curl 加载相同的 jquery.js 文件:

% curl --verbose "http://myserver:3200/javascripts/jquery.js"
* About to connect() to myserver port 3200 (#0)
*   Trying xx.xx.xx.xx... connected
* Connected to myserver (xx.xx.xx.xx) port 3200 (#0)
> GET /javascripts/jquery.js HTTP/1.1
> User-Agent: curl/7.16.3 (i686-pc-cygwin) libcurl/7.16.3 OpenSSL/0.9.8j zlib/1.2.3 libssh2/0.15-CVS
> Host: myserver:3200
> Accept: */*
> 
< HTTP/1.1 200 OK
< Connection: close
< Date: Thu, 14 May 2009 21:35:09 GMT
< Content-Length: 
< Last-Modified: Wed, 13 May 2009 20:38:23 GMT
< Content-Type: application/javascript
< 
* Closing connection #0

因此,通过curl 访问页面时,我没有从服务器返回任何内容。 与 wget 相同。

但是,如果我加载页面,甚至是 firefox 或 chrome 中的单个 javascript 文件,它会加载完整的内容。 所以 webrick 和 ie6 之间有一些奇怪的交互,与 w/curl/wget 相同。 我尝试的另一项测试:

% telnet myserver 3200
GET /javascripts/jquery.js HTTP/1.1
Accept: */*

HTTP/1.1 200 OK
Connection: close
Date: Thu, 14 May 2009 21:43:01 GMT
Content-Length:
Last-Modified: Wed, 13 May 2009 20:38:23 GMT
Content-Type: application/javascript

/*!
 * jQuery JavaScript Library v1.3.2
....

有效,返回了完整的文件内容。 我无法解释为什么它不能在 ie6/curl/wget 中加载。 有什么建议么?

I'm using webrick to run my rails app in development mode. The page includes 4-5 javascript files, which are also being served by the same webrick instance.

When I load the page on ie6, it appears the javascript files are getting truncated after the first few lines -- can anyone explain that? e.g. if the page contains this script tag:

<script type="text/javascript" src="http://myserver:3200/javascripts/jquery.js"></script>

When the page loads in ie6, it raises a javascript syntax error, and Visual Web Developer (VWD) allows me to open the jquery.js file that was loaded, it only shows the first ~30 lines, then just stops.

From the same machine running ie6, I tried to load the same jquery.js file w/ curl:

% curl --verbose "http://myserver:3200/javascripts/jquery.js"
* About to connect() to myserver port 3200 (#0)
*   Trying xx.xx.xx.xx... connected
* Connected to myserver (xx.xx.xx.xx) port 3200 (#0)
> GET /javascripts/jquery.js HTTP/1.1
> User-Agent: curl/7.16.3 (i686-pc-cygwin) libcurl/7.16.3 OpenSSL/0.9.8j zlib/1.2.3 libssh2/0.15-CVS
> Host: myserver:3200
> Accept: */*
> 
< HTTP/1.1 200 OK
< Connection: close
< Date: Thu, 14 May 2009 21:35:09 GMT
< Content-Length: 
< Last-Modified: Wed, 13 May 2009 20:38:23 GMT
< Content-Type: application/javascript
< 
* Closing connection #0

So I don't get any content back from the server when accessing the page via curl. Same w/ wget.

However, if I load the page, or even the individual javascript files in firefox or chrome, it loads the full thing just fine. So there is some strange interaction between webrick and ie6, same w/ curl/wget. One other test I tried:

% telnet myserver 3200
GET /javascripts/jquery.js HTTP/1.1
Accept: */*

HTTP/1.1 200 OK
Connection: close
Date: Thu, 14 May 2009 21:43:01 GMT
Content-Length:
Last-Modified: Wed, 13 May 2009 20:38:23 GMT
Content-Type: application/javascript

/*!
 * jQuery JavaScript Library v1.3.2
....

That worked, returned the full file content. I'm at a loss to explain why it doesn't load in ie6 / curl / wget. Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

╰◇生如夏花灿烂 2024-07-26 13:42:45

嗯...“gem install mongrel”,然后重新启动脚本/服务器,突然它就可以工作了。 显然这是一个 webrick 问题,通过使用 mongrel 来解决。

hmm... "gem install mongrel", and restart script/server, and suddenly it works. Evidently it was a webrick issue, fixed by using mongrel instead.

む无字情书 2024-07-26 13:42:45

空的 Content-Length 标头可能是罪魁祸首。 我将集中精力找出 Webrick 没有返回内容长度的原因。

The empty Content-Length header may be the culprit. I would focus my efforts on finding out why no content length is being returned by Webrick.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文