Mozilla/WEBrick strangeness

Here's the situation: I have a simple webapp hosted under WEBrick. The
Ruby script that starts it also spawn a browser and sends it to the
index page.

In IE 6, this works flawlessly. In recent versions of Firefox and
Mozilla, I randomly get "Bad Request-Line `'. " errors and broken
content on static files being requested. (I especially like the three
characters `'. in the message -- it helps my debugging immensely.)

Now, there are a few wrinkles: elsewhere in the app, I'm using
XMLHTTPRequest objects to do asynchronous XML-RPC calls to the WEBrick
server. (Note: those are completing just fine.) Also, as I said, the
problem is apparently random: the same page may or may not work in two
different invocations of the tool, without any changes to the runtime
environment.

I've been hitting my head up against this problem for about two weeks
now, and I really just want it to go away.

Any ideas, folks?

···

--
Lennon
rcoder.net

Lennon Day-Reynolds wrote:

Here's the situation: I have a simple webapp hosted under WEBrick. The
Ruby script that starts it also spawn a browser and sends it to the
index page.

In IE 6, this works flawlessly. In recent versions of Firefox and
Mozilla, I randomly get "Bad Request-Line `'. " errors and broken
content on static files being requested. (I especially like the three
characters `'. in the message -- it helps my debugging immensely.)

Do you have a pause in your code or some check to ensure that the server is completely up before trying to hit it with a browser?

I have some code that does basically the same thing: kick off drb+Madeleine, kick off an instance of WEBrick, the launch a browser.

Each item runs in a thread, but the thread starts are spaced out using sleep to help ensure that things are running.

I'm less than thrilled with this, as the amount of time needed for either the Madeleine server or WEBrick varies, so I'll see about replacing it with something more robust. But it got me past initial issues where server processes hadn't fully kicked off.

I think that IE is more robust in handling slow servers than Mozilla, too.

James

James,

I definitely hit some timing problems early on, but this doesn't seem
to be timing-dependent, since it's not the initial page that's causing
the error.

Basically, the HTML interface is modeled on a normal "wizard" tool,
with both top-level navigation and status elements in an outside
frame, and individual forms (a.k.a. steps in the wizard) being loaded
into an iframe.

Also, the error messages are HTTP status messages coming from WEBrick,
not the browser -- I get a formatted error page, saying "bad
Request-line: `'."

Since it's only the iframe elements being affected, I may need to just
change the app to use some templating on the server side; I'd just
rather not re-code all the Javascript used for the frontend DHTML.

···

--
Lennon
rcoder.net