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

Noah Levitt commented on HTTPCORE-325:
--------------------------------------

> I have not thoroughly studied Heritrix classes you are referring to but I 
> cant help thinking that you would be much better off decorating Socket input 
> stream the session buffer binds to, rather than session buffer itself.

That was the approach I tried first, if I understand you correctly. Marking the 
end of http headers / beginning of the body turned out to be a problem. 
Heritrix needs to do this so it knows when to start digesting (e.g. sha1), 
among other things. I overrode HttpClientConnection.receiveResponseEntity() to 
do that. But by the time receiveResponseEntity() is called, 
SessionInputBufferImpl.fillBuffer() has already blown right through the start 
of the body.

To prevent this from happening in fillBuffer(), I had to override readLine(), 
and to do that I needed access to those 3 private variables and the one method. 
See 
https://github.com/nlevitt/heritrix3/blob/hc43/modules/src/main/java/org/archive/modules/fetcher/RecordingSessionInputBuffer.java
 (SessionOutputBufferImpl on the other hand didn't need any visibility changes, 
now that I go back and look. My mistake.)

Is there a better way?
                
> support custom implementations of SessionInputBuffer and SessionOutputBuffer
> ----------------------------------------------------------------------------
>
>                 Key: HTTPCORE-325
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-325
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>    Affects Versions: 4.3-alpha2
>            Reporter: Noah Levitt
>         Attachments: httpcore-325-20121231182846.diff
>
>
> In heritrix we have a set of classes that wrap streams and record them 
> verbatim for replay. One of the things it needs to do is make a note of where 
> the http headers end and the message body begins. In order to make this work 
> with httpcomponents I found I needed custom implementations of 
> Session*Buffer. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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

Reply via email to