URLConnections under MS JVM can't handle HTTP 206?

D

Danny Woods

Hi all,

I'm working on a video player applet that retrieves its content from the
hosting Web server. In the interests of compatability, I'm deliberately
hobbling myself to make it JRE 1.1 compliant, keeping the Microsoft JVM
happy.

As part of the download sequence, I create a URLConnection object that
retrieves a part of the remote file using the HTTP Range request header.
The Microsoft VM doesn't appear to expect this, and throws a
FileNotFoundException for the resource; the Sun VM handles it fine.

Until recently I'd been managing the interaction with the HTTP server
with Sockets, handling requests and responds manually. Unfortunately,
this has issues with opaque proxies that require the native magic that a
URLConnection object presumably has buried inside it.

Unfortunately, switching to URLConnection objects breaks under the MS JVM.

--- sample code fragment

URL url = new URL("http://localhost/alphabet.html");
URLConnection connection = url.openConnection();
connection.setRequestProperty("Range", "bytes=0-9");
connection.connect();
InputStream stream = connection.getInputStream();

---

The MSJVM throws the FileNotFoundException at connection.getInputStream
with the Range header set. Change that to User-Agent or something else,
and it's ok, except that you get a 200 OK and the whole remote file...

I've verified that the HTTP server is indeed returning the requested
range and the 206 by using Ethereal to sniff the traffic, but it appears
to be being incorrectly interpreted at the client side.

Has anyone seen this before? Did you ever come up with a solution? Or is
this just another area in which the MS JVM is fundamentally broken?

If it helps at all, the JVM build is 5.0.0.3810.

Regards,

Danny.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top