[
https://issues.apache.org/jira/browse/HTTPCLIENT-1576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14198353#comment-14198353
]
Oleg Kalnichevski commented on HTTPCLIENT-1576:
-----------------------------------------------
bq. Here my host is www1.bloomingdales.com, RequestAddCookies should use
www1.bloomingdales.com not 23.215.63.18.
No, it should not. If one manually overrides protocol headers such as Host,
Cookie or WWW-Authenticate, HttpClient will not complain, but it will not make
any attempts to figure out what those user defined headers contain.
So, if you want to do it correctly just use functionality provided by
HttpClient to achieve the same net result:
{code:java}
URL requestUrl = new
URL("http://www1.bloomingdales.com/shop/product/polder-digital-kitchen-timer?ID=478960");
HttpHost targethost = new HttpHost("23.215.63.18");
HttpUriRequest request = new HttpGet(requestUrl.toURI());
CloseableHttpClient client = HttpClients.createSystem();
CloseableHttpResponse response = client.execute(targethost, request);
{code}
Oleg
> httpclient incorrectly return Cookie rejected
> ----------------------------------------------
>
> Key: HTTPCLIENT-1576
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1576
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient, HttpCookie
> Affects Versions: 4.3.3
> Environment: OS X 10.10
> Reporter: Jiandong Zhang
> Labels: httpclient
>
> I use httpclient as a web crawler. The request url is
> http://www1.bloomingdales.com/shop/product/polder-digital-kitchen-timer?ID=478960
> and the destination ip is 23.215.63.18. So I create a request as follow:
> URL requestUrl = new
> URL("http://23.215.63.18/shop/product/polder-digital-kitchen-timer?ID=478960");
>
> HttpUriRequest request = new HttpGet(requestUrl.toURI());
> request.addHeader("Host", "www1.bloomingdales.com");
> It return that "Cookie rejected Illegal domain attribute "bloomingdales.com".
> Domain of origin: "23.215.63.18"
> I debug it, and find out RequestAddCookies use 23.215.63.18 as host and
> check cookie valid with the response cookie info which domain is
> ".bloomingdales.com", So it failed.
> Here my host is www1.bloomingdales.com, RequestAddCookies should use
> www1.bloomingdales.com not 23.215.63.18.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]