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

Oleg Kalnichevski commented on HTTPCLIENT-1498:
-----------------------------------------------

What the server sends back as a redirect location is clearly garbage.

{noformat}
[DEBUG] headers - http-outgoing-0 << Location: http://:80/robots.txt
{noformat}

HttpClient is absolutely correct in rejecting the response. What I can do 
though is to make it throw a protocol exception instead of unchecked runtime 
exception. 

{noformat}
[DEBUG] RequestAddCookies - CookieSpec selected: best-match
[DEBUG] RequestAuthCache - Auth cache not set in the context
[DEBUG] PoolingHttpClientConnectionManager - Connection request: [route: 
{}->http://www.thegamersedge.co.uk:80][total kept alive: 0; route allocated: 0 
of 2; total allocated: 0 of 20]
[DEBUG] PoolingHttpClientConnectionManager - Connection leased: [id: 0][route: 
{}->http://www.thegamersedge.co.uk:80][total kept alive: 0; route allocated: 1 
of 2; total allocated: 1 of 20]
[DEBUG] MainClientExec - Opening connection 
{}->http://www.thegamersedge.co.uk:80
[DEBUG] HttpClientConnectionManager - Connecting to 
www.thegamersedge.co.uk/72.1.201.152:80
[DEBUG] MainClientExec - Executing request GET /robots.txt HTTP/1.1
[DEBUG] MainClientExec - Target auth state: UNCHALLENGED
[DEBUG] MainClientExec - Proxy auth state: UNCHALLENGED
[DEBUG] headers - http-outgoing-0 >> GET /robots.txt HTTP/1.1
[DEBUG] headers - http-outgoing-0 >> Host: www.thegamersedge.co.uk
[DEBUG] headers - http-outgoing-0 >> Connection: Keep-Alive
[DEBUG] headers - http-outgoing-0 >> User-Agent: Apache-HttpClient/4.3.2 (java 
1.5)
[DEBUG] headers - http-outgoing-0 >> Accept-Encoding: gzip,deflate
[DEBUG] headers - http-outgoing-0 << HTTP/1.1 302 Object moved
[DEBUG] headers - http-outgoing-0 << Content-Type: text/html
[DEBUG] headers - http-outgoing-0 << Content-Length: 142
[DEBUG] headers - http-outgoing-0 << Cache-Control: private
[DEBUG] headers - http-outgoing-0 << Date: Fri, 25 Apr 2014 08:50:38 GMT
[DEBUG] headers - http-outgoing-0 << Location: http://:80/robots.txt
[DEBUG] headers - http-outgoing-0 << Server: Microsoft-IIS/6.0
[DEBUG] headers - http-outgoing-0 << Set-Cookie: 
ASPSESSIONIDASDTAQTC=DOCHGFABJOMBMKKHMKOMJNFE; path=/; HttpOnly
[DEBUG] headers - http-outgoing-0 << X-Powered-By: ASP.NET
[DEBUG] MainClientExec - Connection can be kept alive indefinitely
[DEBUG] ResponseProcessCookies - Cookie accepted 
[ASPSESSIONIDASDTAQTC="DOCHGFABJOMBMKKHMKOMJNFE", version:0, 
domain:www.thegamersedge.co.uk, path:/, expiry:null]
[DEBUG] DefaultRedirectStrategy - Redirect requested to location 
'http://:80/robots.txt'
[DEBUG] DefaultManagedHttpClientConnection - http-outgoing-0: Shutdown 
connection
[DEBUG] MainClientExec - Connection discarded
[DEBUG] DefaultManagedHttpClientConnection - http-outgoing-0: Close connection
[DEBUG] PoolingHttpClientConnectionManager - Connection released: [id: 
0][route: {}->http://www.thegamersedge.co.uk:80][total kept alive: 0; route 
allocated: 0 of 2; total allocated: 0 of 20]
{noformat}


> "java.lang.IllegalArgumentException: Host name may not be blank" thrown 
> during redirect (regression?)
> -----------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1498
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1498
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 4.3.3
>            Reporter: Sebastiano Vigna
>
> The bug we reported some time ago about null hosts in redirects seems to have 
> regressed, albeit the old problem was with "null" and the new problem is with 
> "blank":
> 2014-04-20 04:20:09,169 19319369 ERROR [FetchingThread-197] 
> i.u.d.l.b.f.FetchingThread - Unexpected exception
> java.lang.IllegalArgumentException: Host name may not be blank
>         at org.apache.http.util.Args.notBlank(Args.java:68) 
> ~[httpcore.jar:4.3.2]
>         at org.apache.http.HttpHost.<init>(HttpHost.java:81) 
> ~[httpcore.jar:4.3.2]
>         at 
> org.apache.http.client.utils.URIUtils.extractHost(URIUtils.java:370) 
> ~[httpclient.jar:4.3.3]
>         at 
> org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:132) 
> ~[httpclient.jar:4.3.3]
>         at 
> org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186)
>  ~[httpclient.jar:4.3.3]
>         at 
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
>  ~[httpclient.jar:4.3.3]
>         at 
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:214)
>  ~[httpclient.jar:4.3.3]
>         at 
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:185)
>  ~[httpclient.jar:4.3.3]
>         at it.unimi.di.law.bubing.util.FetchData.fetch(FetchData.java:322) 
> ~[bubing-0.9.3.jar:na]
> This is caused by this site:
> > wget --max-redirect=0 http://www.thegamersedge.co.uk/robots.txt
> --2014-04-20 20:47:43--  http://www.thegamersedge.co.uk/robots.txt
> Resolving www.thegamersedge.co.uk (www.thegamersedge.co.uk)... 72.1.201.156, 
> 72.1.201.152
> Connecting to www.thegamersedge.co.uk 
> (www.thegamersedge.co.uk)|72.1.201.156|:80... connected.
> HTTP request sent, awaiting response... 302 Moved Temporarily
> Location: http://robots.txt [following]
> 0 redirections exceeded.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to