[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-834?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12682460#action_12682460
 ] 

Oleg Kalnichevski commented on HTTPCLIENT-834:
----------------------------------------------

(1) Because ThreadLocals, when misused/abused, can lead to memory leaks or, 
worse, very subtle bugs, especially in managed environments such as servlet or 
EJB containers, where threads are frequently pooled / re-used. The most 
catastrophic bug I have seen involved a ThreadLocal holding a UserPrincipal in 
a web application, which was not correctly unset with a try-catch-finally. You 
can pretty much guess the consequence of that bug. 

The only two legitimate uses of ThreadLocal I know of is (1) in single-user 
standalone applications or (2) in web applications when ThreadLocals set and 
unset using a HttpServletFilter in try-catch-finally. ThreadLocal simply cannot 
be reliably unset from inside a library. ThreadLocals in general purpose 
libraries == major trouble.

(2) There should be a way to instruct the interceptor to generate different 
Accept-Encoding values, for example 'gzip,deflate', "deflate,gzip", "identity", 
etc, based a configuration parameter.

Oleg

> Transparent Content Coding support
> ----------------------------------
>
>                 Key: HTTPCLIENT-834
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-834
>             Project: HttpComponents HttpClient
>          Issue Type: New Feature
>          Components: HttpClient
>    Affects Versions: 4.0 Beta 3
>         Environment: Any
>            Reporter: James Abley
>         Attachments: 834.patch
>
>
> I would like to see HttpClient features brought up to parity with other 
> libraries, both in Java and other languages. c.f. Python's httplib2 (not yet 
> in the standard library, but many would like to see it in there). That 
> library transparently handles gzip and compress content codings.
> This issue is to capture possible solutions to providing this sort of innate 
> functionality in HttpClient, so that users aren't required to know RFC2616 
> intimately. The HttpClient library should do the right thing and use the 
> network in the most efficient manner possible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to