hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tenji Shen (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HTTPCLIENT-1740) Is there a way to change the Max Response Size via configuration property?
Date Tue, 03 May 2016 12:36:12 GMT
Tenji Shen created HTTPCLIENT-1740:
--------------------------------------

             Summary: Is there a way to change the Max Response Size via configuration property?
                 Key: HTTPCLIENT-1740
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1740
             Project: HttpComponents HttpClient
          Issue Type: Wish
          Components: HttpClient
            Reporter: Tenji Shen


I know that there is one way to achieve, get the data as InputStream and decide how many bytes
I want to read myself. Just like:

in = method.getResponseBodyAsStream();

out = new ByteArrayOutputStream(READ_BUFFER_SIZE);

while ((len = in.read(buff)) != -1 && byteCount <= RESPONSE_SIZE_LIMIT) {
    byteCount += len;
    out.write(buff, 0, len);
}

if (byteCount >= RESPONSE_SIZE_LIMIT) {
    throw new IOException(
            "Size limited exceeded reading from HTTP input stream");
}

But I was wondering if there is a possible way to limit response size via configuration property,
thanks for answering.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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


Mime
View raw message