[ 
https://issues.apache.org/jira/browse/HTTPCORE-646?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17177688#comment-17177688
 ] 

ASF subversion and git services commented on HTTPCORE-646:
----------------------------------------------------------

Commit 89e0dfeb2a0f4efefc104d59463eb7438b66ca01 in httpcomponents-core's branch 
refs/heads/5.1.x from Carter Kozak
[ https://gitbox.apache.org/repos/asf?p=httpcomponents-core.git;h=89e0dfe ]

HTTPCORE-646: ChunkedInputStream avoids creating unnecessary buffers


> ChunkedInputStream often creates a garbage buffer on close to read zero bytes
> -----------------------------------------------------------------------------
>
>                 Key: HTTPCORE-646
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-646
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 5.0.1
>            Reporter: Carter Kozak
>            Priority: Minor
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> I profiled a service using hc5 to read chunked responses which are parsed 
> using jackson directly from the entity stream. I've found that a new 4 KiB 
> buffer is created to drain remaining bytes every time close is called, 
> despite the read never producing any data because the next read discovers the 
> terminating chunk.
> This scenario is likely any time that self-terminating data is parsed, the 
> consumer is able to stop reading prior to receiving an end-of-stream.
> It's likely that sufficient data already exists in the SessionInputBuffer to 
> avoid unnecessary buffers. To solve this issue it may be enough to attempt a 
> single-byte read prior to using the buffer, or an efficient 
> {{InputStream.skip(long)}} could be implemented.
> A globally shared buffer would solve this, however there may be security 
> concerns using a static buffer to dump trailing contents which may include 
> sensitive data, accessible elsewhere in the jvm.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to