hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcin Bazydlo (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HTTPCORE-293) Make RequestContent processor have option to overwrite header without exception (like ResponseContent can)
Date Wed, 22 Feb 2012 13:49:49 GMT

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

Marcin Bazydlo commented on HTTPCORE-293:
-----------------------------------------

A diff which solves this problem:

54a57,63
>     private final boolean overwrite;
> 
>     /**
>      * Default constructor. The <code>Content-Length</code> or <code>Transfer-Encoding</code>
>      * will cause the interceptor to throw {@link ProtocolException} if already present
in the
>      * response message.
>      */
56c65
<         super();
---
>         this(false);
58a68,81
>     /**
>      * Constructor that can be used to fine-tune behavior of this interceptor.
>      *
>      * @param overwrite If set to <code>true</code> the <code>Content-Length</code>
and
>      * <code>Transfer-Encoding</code> headers will be created or updated
if already present.
>      * If set to <code>false</code> the <code>Content-Length</code>
and
>      * <code>Transfer-Encoding</code> headers will cause the interceptor
to throw
>      * {@link ProtocolException} if already present in the response message.
>      */
>      public RequestContent(boolean overwrite) {
>          super();
>          this.overwrite = overwrite;
>     }
>     
64c87
<         if (request instanceof HttpEntityEnclosingRequest) {
---
>         if (request instanceof HttpEntityEnclosingRequest && !this.overwrite)
{
68c91
<             if (request.containsHeader(HTTP.CONTENT_LEN)) {
---
>             if (request.containsHeader(HTTP.CONTENT_LEN) && !this.overwrite)
{
74c97
<                 request.addHeader(HTTP.CONTENT_LEN, "0");
---
>                 request.setHeader(HTTP.CONTENT_LEN, "0");
83c106
<                 request.addHeader(HTTP.TRANSFER_ENCODING, HTTP.CHUNK_CODING);
---
>                 request.setHeader(HTTP.TRANSFER_ENCODING, HTTP.CHUNK_CODING);
85c108
<                 request.addHeader(HTTP.CONTENT_LEN, Long.toString(entity.getContentLength()));
---
>                 request.setHeader(HTTP.CONTENT_LEN, Long.toString(entity.getContentLength()));
                
> Make RequestContent processor have option to overwrite header without exception (like
ResponseContent can)
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-293
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-293
>             Project: HttpComponents HttpCore
>          Issue Type: Wish
>          Components: HttpCore
>    Affects Versions: 4.2-beta1
>         Environment: all
>            Reporter: Marcin Bazydlo
>            Priority: Minor
>              Labels: patch
>             Fix For: 4.2-beta1, 4.2
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> Create a new constructor with boolean parameter overwrite which decide behaviour of this
processor.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


Mime
View raw message