Here's a simple patch I needed to fix my problems connecting to a bad webcam
webserver (which would occasionally set the Content-Length header to 138 mbs
or something ridiculously stupid and bogus like that). To the GetMethod I
added getter and setter methods for "responseSizeLimit", and then if it's
set, it will cap the expected length.
Serge Knystautas
Loki Technologies - Unstoppable Websites
http://www.lokitech.com/
Index: java/org/apache/commons/httpclient/methods/GetMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/GetMethod.java,v
retrieving revision 1.7
diff -r1.7 GetMethod.java
187a188,192
> /**
> * Response limit in bytes
> */
> protected int responseSizeLimit = -1;
>
265a271,284
> /**
> * Response size limit getter.
> */
> public int getResponseSizeLimit() {
> return responseSizeLimit;
> }
>
> /**
> * Response size limit setter.
> */
> public void setResponseSizeLimit(int value) {
> responseSizeLimit = value;
> }
>
383a403
> //This is set to the response size limit... defaults to -1 which means
>unlimited
394a415,417
> }
> if (responseSizeLimit > -1 && (expectedLength > responseSizeLimit ||
>expectedLength == -1)) {
> expectedLength = responseSizeLimit;
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>