HTTP 1.1 URLConnection Bug Demonstration

Platforms Affected

Internet Explorer 4.0's Java Virtual Machine cannot handle HTTP 1.1 data streams correctly.

This problem appears to be fixed in Service Patch 1 of Internet Explorer 4.0 and the Microsoft JVM.

Details On The HTTP 1.1 URLConnection Bug

Thus, Internet Explorer will not get proper data when trying to get HTTP 1.1 chunk mode URLs. The data it does get is basically the first ASCII character repeated over and over again for the length of the data that was supposed to be returned.

The code demo at the bottom of this page demonstrates this bug by filling a Choice() dropdown component with 100 labels. UNIX Netscape will not display all of these in the available real estate on the screen, nor will it provide the ability to scroll to get to this data.

Special Note: This demonstration will only work on servers that are fully HTTP 1.1 compliant such as Apache. If this suite of tests is mirrored on another Web Server, this test may not work. The Applet displays the current web server that it is running under in case you want to double check this.

Network bugs like this are generally somewhat harder than other Java bugs to demonstrate.

HTTP 1.1 URLConnection Bug Workaround

You can change the preferences of Internet Explorer to tell it not to say it can handle HTTP 1.1. Web Servers will typically automatically downgrade to using HTTP 1.0 if the browser claims it cannot support anything higher.

This is not a good solution for an extranet type application because you can't easily force everyone to change their browser configuration.

Instead, it is possible on some web servers such as Apache to reconfigure the web server to only serve HTTP 1.0 protocol to IE 4.0 even if it claims it can do HTTP 1.1. See the references section for the details.

Another possibility is to use nph (non parsed header) CGI scripts. NPH scripts bypass the web server for serving CGI data. Most NPH scripts produce their data in one chunk and do not use HTTP 1.1 since it adds extra overhead to figure out how to serve script data in HTTP 1.1 chunking format.

References

Apache and HTTP/1.1

Apache Patch For IE 4.0 Bug

JavaWorld Java Tip 34: POSTing Via Java

Applet Demonstrating HTTP 1.1 URLConnection Bug

View The Source To UrlConnectionBug.java

View The Source To test.cgi

Gunther Birznieks