hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nick Jarvis" <jarvisnicho...@hotmail.com>
Subject Re: HTTP Version Not Supported Error
Date Tue, 19 Oct 2004 22:04:12 GMT
I have taken your advise and set the content length manually sending in the 
length of a file even if it is larger than 2 gigs.  I am getting a bug 
however when uploading over 2 gigs still.  It seems that the server is 
blocking the read function for the ServletInputStream.  I get a socket read 
time out exception thrown.  When I look at the bytes that were written and 
the length of the file, the bytes that were written seem to be more than the 
length of the file.  This only occurs for files over 2 gigs.  I tested 
multiple files, (512 MB, 1.8 GB, 2.0 GB).  On the client side I have checked 
my code for the file input stream and writing of the bytes to the request 
output stream.  The bytes I am writing are consistent with the length of the 
file, yet I am having this trouble on the server side.  I am using 
HttpServlet on the server side of my application.  I am getting the input 
stream from the request input stream, I am creating a file output stream, 
and I am writing to the file.  I believe that the HttpServlet should be 
compatible with HTTP 1.1.  Still, from my previous threading problem I had 
to set the setHttp11 function to false so that I do not get the upload error 
I stated before.  Sorry for the questions, but I have tried fixing this and 
understanding it to no avail.  I appreciate any help that you could give me. 
  Thanks for your time,

N. Jarvis

>From: Michael Becke <becke@u.washington.edu>
>Reply-To: "Commons HttpClient Project" 
>To: Commons HttpClient Project <commons-httpclient-dev@jakarta.apache.org>
>Subject: Re: HTTP Version Not Supported Error
>Date: Mon, 18 Oct 2004 11:10:48 -0400
>Hi Nick,
>I have one addition to Roland's comments.
>>b) Don't call setContentLength, or set it to -1 in a
>>FilePart object. This should work fine with HTTP/1.1
>>and chunked encoding, but also with HTTP/1.0 and
>>no chunked encoding. Since the server does not know
>>the content length in advance, it has to read until the
>>end of the stream in no-chunks mode. Connection
>>re-use is impossible, but after transferring more than
>>2 gigs I doubt you'll notice the performance impact
>>of opening a new connection :-)
>>It might be a violation of HTTP to POST data without
>>a valid content length, but since you're controlling
>>the server as well, that shouldn't bother you much.
>The HttpClient 2.0 API does not directly support setting content length > 
>2GB because of the use of an int.  This has been fixed in the 3.0 API but 
>it can be done in 2.0 by setting the content-length header manually:
>method.setRequestHeader("Content-Length", "Some number bigger than 2GB");
>To unsubscribe, e-mail: 
>For additional commands, e-mail: 

FREE pop-up blocking with the new MSN Toolbar  get it now! 

To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org

View raw message