You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "William R. Speirs (JIRA)" <ji...@apache.org> on 2011/07/12 17:31:59 UTC

[jira] [Created] (HTTPCORE-264) Allow Overwriting of Content-Length & Transfer-Encoding Headers

Allow Overwriting of Content-Length & Transfer-Encoding Headers
---------------------------------------------------------------

                 Key: HTTPCORE-264
                 URL: https://issues.apache.org/jira/browse/HTTPCORE-264
             Project: HttpComponents HttpCore
          Issue Type: Improvement
          Components: HttpCore
    Affects Versions: 4.1.2, 4.2-alpha1, 4.2, Future
         Environment: n/a
            Reporter: William R. Speirs
            Priority: Trivial
             Fix For: 4.1.2, 4.2, Future
         Attachments: ResponseContent.diff

Currently the ResponseContent interceptor will throw an exception if the Content-Length or Transfer-Encoding headers are found in the response. I am proposing a patch which adds 2 new constructors to ResponseContent. These new constructors allow ResponseContent to overwrite the Content-Length and/or Transfer-Encoding headers if they're already found instead of throwing an exception.

The biggest use I see for this is in a reverse proxy. The response from the proxied server will already have proper Content-Length and Transfer-Encoding headers. However, this interceptor throws an exception in this case. The simple answer is to remove this interceptor; however, I would like to clean-up any response where these headers might be missing.

The default constructor is to thrown an exception if these headers are found.

--
This message is automatically generated by JIRA.
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


[jira] [Updated] (HTTPCORE-264) Allow Overwriting of Content-Length & Transfer-Encoding Headers

Posted by "William R. Speirs (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-264?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

William R. Speirs updated HTTPCORE-264:
---------------------------------------

    Attachment: TestStandardInterceptors.diff

> Allow Overwriting of Content-Length & Transfer-Encoding Headers
> ---------------------------------------------------------------
>
>                 Key: HTTPCORE-264
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-264
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 4.1.2, 4.2-alpha1, 4.2, Future
>         Environment: n/a
>            Reporter: William R. Speirs
>            Priority: Trivial
>              Labels: patch
>             Fix For: 4.1.2, 4.2, Future
>
>         Attachments: ResponseContent.diff, TestStandardInterceptors.diff
>
>
> Currently the ResponseContent interceptor will throw an exception if the Content-Length or Transfer-Encoding headers are found in the response. I am proposing a patch which adds 2 new constructors to ResponseContent. These new constructors allow ResponseContent to overwrite the Content-Length and/or Transfer-Encoding headers if they're already found instead of throwing an exception.
> The biggest use I see for this is in a reverse proxy. The response from the proxied server will already have proper Content-Length and Transfer-Encoding headers. However, this interceptor throws an exception in this case. The simple answer is to remove this interceptor; however, I would like to clean-up any response where these headers might be missing.
> The default constructor is to thrown an exception if these headers are found.

--
This message is automatically generated by JIRA.
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


[jira] [Commented] (HTTPCORE-264) Allow Overwriting of Content-Length & Transfer-Encoding Headers

Posted by "William R. Speirs (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13064722#comment-13064722 ] 

William R. Speirs commented on HTTPCORE-264:
--------------------------------------------

This is a good point, and noted.

I have added two additional unit tests and will attach that diff as well.

Thanks!

> Allow Overwriting of Content-Length & Transfer-Encoding Headers
> ---------------------------------------------------------------
>
>                 Key: HTTPCORE-264
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-264
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 4.1.2, 4.2-alpha1, 4.2, Future
>         Environment: n/a
>            Reporter: William R. Speirs
>            Priority: Trivial
>              Labels: patch
>             Fix For: 4.1.2, 4.2, Future
>
>         Attachments: ResponseContent.diff, TestStandardInterceptors.diff
>
>
> Currently the ResponseContent interceptor will throw an exception if the Content-Length or Transfer-Encoding headers are found in the response. I am proposing a patch which adds 2 new constructors to ResponseContent. These new constructors allow ResponseContent to overwrite the Content-Length and/or Transfer-Encoding headers if they're already found instead of throwing an exception.
> The biggest use I see for this is in a reverse proxy. The response from the proxied server will already have proper Content-Length and Transfer-Encoding headers. However, this interceptor throws an exception in this case. The simple answer is to remove this interceptor; however, I would like to clean-up any response where these headers might be missing.
> The default constructor is to thrown an exception if these headers are found.

--
This message is automatically generated by JIRA.
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


[jira] [Commented] (HTTPCORE-264) Allow Overwriting of Content-Length & Transfer-Encoding Headers

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13064599#comment-13064599 ] 

Oleg Kalnichevski commented on HTTPCORE-264:
--------------------------------------------

William

I see no problem with committing the patch but please do consider this before I go ahead and apply the fix. Well-behaved proxies and gateways must remove all hop-by-hop headers as defined in section 13.5.1 of the RFC 2616 [1]. Transfer-Encoding is defined as hop-by-hop. It must be removed by the proxy along with other hop-by-hop headers prior to relaying the response to the HTTP agent. Content-Length should be treated exactly the same way especially if the proxy rewrites the enclosed entity. Essentially the existing behaviour provides an additional level protection and ensures that HTTP messages are always correctly delimited.

Oleg

[1] http://www.faqs.org/rfcs/rfc2616.html

> Allow Overwriting of Content-Length & Transfer-Encoding Headers
> ---------------------------------------------------------------
>
>                 Key: HTTPCORE-264
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-264
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 4.1.2, 4.2-alpha1, 4.2, Future
>         Environment: n/a
>            Reporter: William R. Speirs
>            Priority: Trivial
>              Labels: patch
>             Fix For: 4.1.2, 4.2, Future
>
>         Attachments: ResponseContent.diff
>
>
> Currently the ResponseContent interceptor will throw an exception if the Content-Length or Transfer-Encoding headers are found in the response. I am proposing a patch which adds 2 new constructors to ResponseContent. These new constructors allow ResponseContent to overwrite the Content-Length and/or Transfer-Encoding headers if they're already found instead of throwing an exception.
> The biggest use I see for this is in a reverse proxy. The response from the proxied server will already have proper Content-Length and Transfer-Encoding headers. However, this interceptor throws an exception in this case. The simple answer is to remove this interceptor; however, I would like to clean-up any response where these headers might be missing.
> The default constructor is to thrown an exception if these headers are found.

--
This message is automatically generated by JIRA.
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


[jira] [Updated] (HTTPCORE-264) Allow Overwriting of Content-Length & Transfer-Encoding Headers

Posted by "William R. Speirs (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-264?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

William R. Speirs updated HTTPCORE-264:
---------------------------------------

    Attachment: ResponseContent.diff

> Allow Overwriting of Content-Length & Transfer-Encoding Headers
> ---------------------------------------------------------------
>
>                 Key: HTTPCORE-264
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-264
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 4.1.2, 4.2-alpha1, 4.2, Future
>         Environment: n/a
>            Reporter: William R. Speirs
>            Priority: Trivial
>              Labels: patch
>             Fix For: 4.1.2, 4.2, Future
>
>         Attachments: ResponseContent.diff
>
>
> Currently the ResponseContent interceptor will throw an exception if the Content-Length or Transfer-Encoding headers are found in the response. I am proposing a patch which adds 2 new constructors to ResponseContent. These new constructors allow ResponseContent to overwrite the Content-Length and/or Transfer-Encoding headers if they're already found instead of throwing an exception.
> The biggest use I see for this is in a reverse proxy. The response from the proxied server will already have proper Content-Length and Transfer-Encoding headers. However, this interceptor throws an exception in this case. The simple answer is to remove this interceptor; however, I would like to clean-up any response where these headers might be missing.
> The default constructor is to thrown an exception if these headers are found.

--
This message is automatically generated by JIRA.
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


[jira] [Resolved] (HTTPCORE-264) Allow Overwriting of Content-Length & Transfer-Encoding Headers

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-264?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCORE-264.
----------------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 4.1.2)
                       (was: 4.2)
                       (was: Future)
                   4.2-alpha1

Patches checked in with some minor tweaks. Many thanks for this contribution.

Oleg

> Allow Overwriting of Content-Length & Transfer-Encoding Headers
> ---------------------------------------------------------------
>
>                 Key: HTTPCORE-264
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-264
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 4.1.2, 4.2-alpha1, 4.2, Future
>         Environment: n/a
>            Reporter: William R. Speirs
>            Priority: Trivial
>              Labels: patch
>             Fix For: 4.2-alpha1
>
>         Attachments: ResponseContent.diff, TestStandardInterceptors.diff
>
>
> Currently the ResponseContent interceptor will throw an exception if the Content-Length or Transfer-Encoding headers are found in the response. I am proposing a patch which adds 2 new constructors to ResponseContent. These new constructors allow ResponseContent to overwrite the Content-Length and/or Transfer-Encoding headers if they're already found instead of throwing an exception.
> The biggest use I see for this is in a reverse proxy. The response from the proxied server will already have proper Content-Length and Transfer-Encoding headers. However, this interceptor throws an exception in this case. The simple answer is to remove this interceptor; however, I would like to clean-up any response where these headers might be missing.
> The default constructor is to thrown an exception if these headers are found.

--
This message is automatically generated by JIRA.
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