[
https://issues.apache.org/jira/browse/HTTPCLIENT-1068?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Oleg Kalnichevski resolved HTTPCLIENT-1068.
-------------------------------------------
Resolution: Not A Problem
Ted,
Please note that the HTTP spec does not require any particular ordering of HTTP
message headers.
HttpCore maintains HTTP headers in their natural order. So, if you want HTTP
headers arranged in any particular order you should make sure they are added to
the message in that very order. Please note that some headers such as
User-Agent can also be added to the outgoing message automatically by a
protocol interceptor. Auto-generated headers usually appear after those added
manually. You can impose a particular order for auto-generated headers by
moving your protocol logic to a custom protocol interceptor. Protocol
interceptors can be introduced to the protocol processing chain in a specific
order, when desired
Hope this helps
Oleg
> Ordering HttpClient Headers does not seem possible
> --------------------------------------------------
>
> Key: HTTPCLIENT-1068
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1068
> Project: HttpComponents HttpClient
> Issue Type: Wish
> Components: HttpClient
> Affects Versions: 4.1 Final
> Environment: Windows 7, Java 1.6.0_21
> Reporter: Ted Troccola
> Priority: Minor
> Labels: httpclient
>
> It seems impossible to have the HttpClient headers sent "before" the
> HttpRequest headers.
>
> When inspecting the headers of the actual connection, these headers will
> appear BEFORE the HttpClient
> headers.
>
> For example, note the order the header values are set in the following code:
>
> // Set the User-Agent value for the HttpClient
> myHttpParams.setParameter(CoreProtocolPNames.USER_AGENT, "Mozilla/4.0
> (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322");
>
> // Set the Accept-Language value for the request
> request.addHeader(HttpHeaders.ACCEPT_LANGUAGE, "en-us,en;q=0.5");
>
> // Upon execution, the request will send the headers in the following order
>
> Accept-Language: en-us,en;q=0.5
> User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR
> 1.1.4322)
--
This message is automatically generated by JIRA.
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]