Simple HTTP server gone bad


XML & Web services: Simple HTTP server gone bad

  1. Simple HTTP server gone bad (1 messages)

    I just wrote a simple java server to process some specific XML. The communication to this server is done via HTTP/1.0. The XML data is uploaded via a POST, and the server returns the correct HTTP/1.0 response. Everything works fine ... except with MSIE. Let me explain....

    I have a test that is a simple HTML file containing a submit button. Clicking on the submit button sends the XML data block to my server. If the XML data block is small, the test (in MSIE) works everytime. As the XML block grows in size; however, MSIE refuses to display the HTML my server returns. Instead, I get the "Page cannot be displayed" Message. Note that debug output on the server side shows back-end processing completes with-out errors, and the server thread servicing the request runs to completion.

    What in the heck could be causing this? I've gone so far as to comment out all the XML data processing code (basically, all the server does now is suck data in, then return a response) ... and I get the same thing. The HTTP/1.0 return block I send back to the client is listed below:

    HTTP/1.0 200 OK
    Content-type: text/html
    Server: Test Server 1.0
    Date: Tue Oct 09 14:07:38 EST 2001
    Content-Length: 32


    More strangeness:

    1) This works all the time in Netscape 6.1
    2) If I omit the status code and headers, MSIE will display the return message.
    3) If I omit the headers and return message, it appears to work. I Get a blank page (No "Page cannot be displayed message")
  2. Simple HTTP server gone bad[ Go to top ]

    One thing you can try is making sure that you append some returns / newlines to the end of the stream (including them as part of the Content-Length, of course). Explorer's cache seems to throw up if it doesn't get newlines at the stream end. I would also send a \0 after the newlines, if newlines alone don't cut it.

    (Of course, on an architecture level I would suggest building a servlet, or even using an existing XML processing servlet like Cocoon, instead of building your own server. Building your own Java server is fun -- hell, we all do it at least once -- but not very practical when you discover how much suffering goes into supporting even the basic HTTP stuff for all the needs we forget about at first).