views:

192

answers:

2

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"&gt;&lt;/script&gt;

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?

A: 

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.

molf
A: 

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

Jeremy Slade