You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Clemens Eisserer <li...@gmail.com> on 2007/08/10 00:48:33 UTC

Size-Limitations with PUT through Proxy

Hello,

I am experiencing strange problems with an http-proxy used at a large company.
I would like to upload data with about max. 20kB, but I realieable
only get 283byte up.

I upload the data doing:
PutMethod putMethod = new PutMethod(upLoadURL);
putMethod.setDoAuthentication(true);
putMethod.setRequestBody(new
FastByteArrayInputStream(payLoad));		server.getHttpClient().executeMethod(putMethod);

And on the servlet I read the whole data into a array using:
FastByteArrayOutputStream bos = new FastByteArrayOutputStream(is.available());
int read = 0;
while ((read = is.read()) != -1)
{
   bos.write(read);
}
return bos.toByteArray;

I need the data as byte[] anyway because its low-traffic and only
small packages are sent, I don't care for performance for now
(allocations in FastBufferedOutputStream and copying in toByteArray).


Any idea what could be wrong?
I already tried to send dummy-bytes back to the server while reading
the put-data into the array to avoid response-timeouts but that didn't
help :-/

Any ideas what could be wrong? The code works quite well without a
proxy in between.

Thank you in advance, lg Clemens

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


Re: Size-Limitations with PUT through Proxy

Posted by Clemens Eisserer <li...@gmail.com>.
Hi Roland,

Thanks a lot for your ongoing support and patience.
It seems this proxy is really crappy and weird :-/

> I've never heard of FastByteArrayInputStream.
Its a self-written class (ported from GNU-Classpath) that avoids
synchronization. I've it in my utility classes and use it from time to
time.


> Maybe the proxy doesn't support PUT request correctly?
> Have you tried POST instead?
Well this time it wasn't really the proxy but simply a problem with my
code ... which didn't work in the enviroment behind the proxy. So now
everything works fine.

Thanks a lot, lg Clemens

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


Re: Size-Limitations with PUT through Proxy

Posted by Roland Weber <os...@dubioso.net>.
Clemens Eisserer wrote:

> PutMethod putMethod = new PutMethod(upLoadURL);
> putMethod.setDoAuthentication(true);
> putMethod.setRequestBody(new
> FastByteArrayInputStream(payLoad));		server.getHttpClient().executeMethod(putMethod);

I've never heard of FastByteArrayInputStream. Is this some
Java 6 stuff? setRequestBody is deprecated. Since you've
got the data already, use the ByteArrayRequestEntity.

> The code works quite well without a
> proxy in between.

Maybe the proxy doesn't support PUT request correctly?
Have you tried POST instead?

Consider sending us a wire log:
http://jakarta.apache.org/commons/httpclient/logging.html


cheers,
  Roland

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