[jira] [Commented] (HTTPCORE-508) Handle "HTTP/1.1 000 status code 000" responses

2018-02-02 Thread Oleg Kalnichevski (JIRA)

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

Oleg Kalnichevski commented on HTTPCORE-508:


In 4.x one can plug-in a custom {{HttpMessageParser}} and rewrite the response 
message returned by the parser. It is not particularly elegant and will get the 
job done. For 5.x I am open to more elegant solutions (as long as they work 
with classic HTTP/1.1, async HTTP/1.1 and async HTTP/2.

Oleg  

 

> Handle "HTTP/1.1 000 status code 000" responses
> ---
>
> Key: HTTPCORE-508
> URL: https://issues.apache.org/jira/browse/HTTPCORE-508
> Project: HttpComponents HttpCore
>  Issue Type: Bug
>  Components: HttpCore, HttpCore NIO
>Affects Versions: 4.4.9, 5.0-beta2
>Reporter: Petar Petrov
>Assignee: Oleg Kalnichevski
>Priority: Major
> Fix For: 4.4.10, 5.0-beta3
>
> Attachments: canResponseHaveABody.png, doReceiveResponse.png
>
>
> Hi!
> I have a very _funny_ behaviour where the HttpClient seems to wrongly 
> interpret the body of an HTTP response as headers, the parsing of which 
> eventually leads to a java.net.SocketTimeoutException. 
> The underlying cause of this seems to be a a faulty server response, i.e.,
> {noformat}
> HTTP/1.1 000 status code 000{noformat}
> Thank you Apple! /s
>  
> I have managed to trace the origin of the problem to the *method 
> HttpRequestExecutor#canResponseHaveBody* where, as expected, 000 is not 
> considered as a valid status code.
> !canResponseHaveABody.png!
> !doReceiveResponse.png!
> So what happens seems to be that the status line and headers get parsed. The 
> 000 is not considered valid and that ends the processing of the response. 
> Then the rest of the response (the body) seems to go through the parsing 
> procedure again in *DefaultHttpResponseParser#parseHead*. The body is of 
> content type application/json. Eventually the following exceptions gets 
> thrown after a while:
> {code:java}
> java.net.SocketTimeoutException: Read timed out
> at java.net.SocketInputStream.socketRead0(Native Method)
> at java.net.SocketInputStream.socketRead(SocketInputStream.java:127)
> at java.net.SocketInputStream.read(SocketInputStream.java:182)
> at java.net.SocketInputStream.read(SocketInputStream.java:152)
> at 
> org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137)
> at 
> org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153)
> at 
> org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:282)
> at 
> org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138)
> at 
> org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
> at 
> org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
> at 
> org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
> at 
> org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:165)
> at 
> org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
> at 
> org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
> at 
> org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
> at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
> at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
> at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
> at 
> org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
> at 
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
> at 
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
> {code}
>  
> I'm not really familiar if 000 is even a valid return code. When querying the 
> server with some other HTTP tools like Postman, I do get the json response 
> with a status code 000.
> Do you guys think this is something that can be fixed in HttpClient or at 
> least handled by some sort of an error?
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (HTTPCORE-508) Handle "HTTP/1.1 000 status code 000" responses

2018-02-02 Thread ASF subversion and git services (JIRA)

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

ASF subversion and git services commented on HTTPCORE-508:
--

Commit 5739fb646dd5634eb36b736683c9118c40a49b0f in httpcomponents-core's branch 
refs/heads/master from [~olegk]
[ https://git-wip-us.apache.org/repos/asf?p=httpcomponents-core.git;h=5739fb6 ]

HTTPCORE-508: Reject response messages with status code lesser than 100 as 
invalid


> Handle "HTTP/1.1 000 status code 000" responses
> ---
>
> Key: HTTPCORE-508
> URL: https://issues.apache.org/jira/browse/HTTPCORE-508
> Project: HttpComponents HttpCore
>  Issue Type: Bug
>  Components: HttpCore, HttpCore NIO
>Affects Versions: 4.4.9, 5.0-beta2
>Reporter: Petar Petrov
>Assignee: Oleg Kalnichevski
>Priority: Major
> Fix For: 4.4.10, 5.0-beta3
>
> Attachments: canResponseHaveABody.png, doReceiveResponse.png
>
>
> Hi!
> I have a very _funny_ behaviour where the HttpClient seems to wrongly 
> interpret the body of an HTTP response as headers, the parsing of which 
> eventually leads to a java.net.SocketTimeoutException. 
> The underlying cause of this seems to be a a faulty server response, i.e.,
> {noformat}
> HTTP/1.1 000 status code 000{noformat}
> Thank you Apple! /s
>  
> I have managed to trace the origin of the problem to the *method 
> HttpRequestExecutor#canResponseHaveBody* where, as expected, 000 is not 
> considered as a valid status code.
> !canResponseHaveABody.png!
> !doReceiveResponse.png!
> So what happens seems to be that the status line and headers get parsed. The 
> 000 is not considered valid and that ends the processing of the response. 
> Then the rest of the response (the body) seems to go through the parsing 
> procedure again in *DefaultHttpResponseParser#parseHead*. The body is of 
> content type application/json. Eventually the following exceptions gets 
> thrown after a while:
> {code:java}
> java.net.SocketTimeoutException: Read timed out
> at java.net.SocketInputStream.socketRead0(Native Method)
> at java.net.SocketInputStream.socketRead(SocketInputStream.java:127)
> at java.net.SocketInputStream.read(SocketInputStream.java:182)
> at java.net.SocketInputStream.read(SocketInputStream.java:152)
> at 
> org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137)
> at 
> org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153)
> at 
> org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:282)
> at 
> org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138)
> at 
> org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
> at 
> org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
> at 
> org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
> at 
> org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:165)
> at 
> org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
> at 
> org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
> at 
> org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
> at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
> at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
> at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
> at 
> org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
> at 
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
> at 
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
> {code}
>  
> I'm not really familiar if 000 is even a valid return code. When querying the 
> server with some other HTTP tools like Postman, I do get the json response 
> with a status code 000.
> Do you guys think this is something that can be fixed in HttpClient or at 
> least handled by some sort of an error?
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (HTTPCORE-508) Handle "HTTP/1.1 000 status code 000" responses

2018-02-02 Thread ASF subversion and git services (JIRA)

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

ASF subversion and git services commented on HTTPCORE-508:
--

Commit 7d47ad0d77439259a236e8d570b04b75eec00e00 in httpcomponents-core's branch 
refs/heads/4.4.x from [~olegk]
[ https://git-wip-us.apache.org/repos/asf?p=httpcomponents-core.git;h=7d47ad0 ]

HTTPCORE-508: Reject response messages with status code lesser than 100 as 
invalid


> Handle "HTTP/1.1 000 status code 000" responses
> ---
>
> Key: HTTPCORE-508
> URL: https://issues.apache.org/jira/browse/HTTPCORE-508
> Project: HttpComponents HttpCore
>  Issue Type: Bug
>  Components: HttpCore, HttpCore NIO
>Affects Versions: 4.4.9, 5.0-beta2
>Reporter: Petar Petrov
>Assignee: Oleg Kalnichevski
>Priority: Major
> Fix For: 4.4.10, 5.0-beta3
>
> Attachments: canResponseHaveABody.png, doReceiveResponse.png
>
>
> Hi!
> I have a very _funny_ behaviour where the HttpClient seems to wrongly 
> interpret the body of an HTTP response as headers, the parsing of which 
> eventually leads to a java.net.SocketTimeoutException. 
> The underlying cause of this seems to be a a faulty server response, i.e.,
> {noformat}
> HTTP/1.1 000 status code 000{noformat}
> Thank you Apple! /s
>  
> I have managed to trace the origin of the problem to the *method 
> HttpRequestExecutor#canResponseHaveBody* where, as expected, 000 is not 
> considered as a valid status code.
> !canResponseHaveABody.png!
> !doReceiveResponse.png!
> So what happens seems to be that the status line and headers get parsed. The 
> 000 is not considered valid and that ends the processing of the response. 
> Then the rest of the response (the body) seems to go through the parsing 
> procedure again in *DefaultHttpResponseParser#parseHead*. The body is of 
> content type application/json. Eventually the following exceptions gets 
> thrown after a while:
> {code:java}
> java.net.SocketTimeoutException: Read timed out
> at java.net.SocketInputStream.socketRead0(Native Method)
> at java.net.SocketInputStream.socketRead(SocketInputStream.java:127)
> at java.net.SocketInputStream.read(SocketInputStream.java:182)
> at java.net.SocketInputStream.read(SocketInputStream.java:152)
> at 
> org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137)
> at 
> org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153)
> at 
> org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:282)
> at 
> org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138)
> at 
> org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
> at 
> org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
> at 
> org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
> at 
> org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:165)
> at 
> org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
> at 
> org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
> at 
> org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
> at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
> at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
> at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
> at 
> org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
> at 
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
> at 
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
> {code}
>  
> I'm not really familiar if 000 is even a valid return code. When querying the 
> server with some other HTTP tools like Postman, I do get the json response 
> with a status code 000.
> Do you guys think this is something that can be fixed in HttpClient or at 
> least handled by some sort of an error?
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (HTTPCORE-508) Handle "HTTP/1.1 000 status code 000" responses

2018-02-05 Thread Petar Petrov (JIRA)

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

Petar Petrov commented on HTTPCORE-508:
---

Tested the httpcore *4.4.x* branch. Got an exception as expected:
{noformat}
org.apache.http.client.ClientProtocolException
 at 
org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:187)
 at 
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
 at 
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
 at com.mycompany.initJunctions(VPPManager.java:451)
 at com.mycompany.initialize(VPPManager.java:119)
 at com.mycompany.Task.doRun(VPPMonitorTask.java:59)
 at com.ibm.dots.task.AbstractServerTaskExt.run(AbstractServerTaskExt.java:47)
 at 
com.ibm.dots.task.JobTaskService$ServiceTaskJob.doRun(JobTaskService.java:136)
 at com.ibm.dots.task.JobTaskService$ServiceTaskJob.run(JobTaskService.java:99)
 at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.apache.http.ProtocolException: Invalid response: HTTP/1.1 0 
status code 000
 at 
org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:276)
 at 
org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
 at 
org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
 at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
 at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
 at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
 at 
org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
 ... 9 more{noformat}

> Handle "HTTP/1.1 000 status code 000" responses
> ---
>
> Key: HTTPCORE-508
> URL: https://issues.apache.org/jira/browse/HTTPCORE-508
> Project: HttpComponents HttpCore
>  Issue Type: Bug
>  Components: HttpCore, HttpCore NIO
>Affects Versions: 4.4.9, 5.0-beta2
>Reporter: Petar Petrov
>Assignee: Oleg Kalnichevski
>Priority: Major
> Fix For: 4.4.10, 5.0-beta3
>
> Attachments: canResponseHaveABody.png, doReceiveResponse.png
>
>
> Hi!
> I have a very _funny_ behaviour where the HttpClient seems to wrongly 
> interpret the body of an HTTP response as headers, the parsing of which 
> eventually leads to a java.net.SocketTimeoutException. 
> The underlying cause of this seems to be a a faulty server response, i.e.,
> {noformat}
> HTTP/1.1 000 status code 000{noformat}
> Thank you Apple! /s
>  
> I have managed to trace the origin of the problem to the *method 
> HttpRequestExecutor#canResponseHaveBody* where, as expected, 000 is not 
> considered as a valid status code.
> !canResponseHaveABody.png!
> !doReceiveResponse.png!
> So what happens seems to be that the status line and headers get parsed. The 
> 000 is not considered valid and that ends the processing of the response. 
> Then the rest of the response (the body) seems to go through the parsing 
> procedure again in *DefaultHttpResponseParser#parseHead*. The body is of 
> content type application/json. Eventually the following exceptions gets 
> thrown after a while:
> {code:java}
> java.net.SocketTimeoutException: Read timed out
> at java.net.SocketInputStream.socketRead0(Native Method)
> at java.net.SocketInputStream.socketRead(SocketInputStream.java:127)
> at java.net.SocketInputStream.read(SocketInputStream.java:182)
> at java.net.SocketInputStream.read(SocketInputStream.java:152)
> at 
> org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137)
> at 
> org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153)
> at 
> org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:282)
> at 
> org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138)
> at 
> org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
> at 
> org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
> at 
> org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
> at 
> org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:165)
> at 
> org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
> at 
> org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
> at 
> org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
> at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
> at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
> at org.

[jira] [Commented] (HTTPCORE-508) Handle "HTTP/1.1 000 status code 000" responses

2018-02-05 Thread Petar Petrov (JIRA)

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

Petar Petrov commented on HTTPCORE-508:
---

Could you point me to a 4.4.x based *HttpMessageParser* example? I could only 
find 5.x based tests in the master.

> Handle "HTTP/1.1 000 status code 000" responses
> ---
>
> Key: HTTPCORE-508
> URL: https://issues.apache.org/jira/browse/HTTPCORE-508
> Project: HttpComponents HttpCore
>  Issue Type: Bug
>  Components: HttpCore, HttpCore NIO
>Affects Versions: 4.4.9, 5.0-beta2
>Reporter: Petar Petrov
>Assignee: Oleg Kalnichevski
>Priority: Major
> Fix For: 4.4.10, 5.0-beta3
>
> Attachments: canResponseHaveABody.png, doReceiveResponse.png
>
>
> Hi!
> I have a very _funny_ behaviour where the HttpClient seems to wrongly 
> interpret the body of an HTTP response as headers, the parsing of which 
> eventually leads to a java.net.SocketTimeoutException. 
> The underlying cause of this seems to be a a faulty server response, i.e.,
> {noformat}
> HTTP/1.1 000 status code 000{noformat}
> Thank you Apple! /s
>  
> I have managed to trace the origin of the problem to the *method 
> HttpRequestExecutor#canResponseHaveBody* where, as expected, 000 is not 
> considered as a valid status code.
> !canResponseHaveABody.png!
> !doReceiveResponse.png!
> So what happens seems to be that the status line and headers get parsed. The 
> 000 is not considered valid and that ends the processing of the response. 
> Then the rest of the response (the body) seems to go through the parsing 
> procedure again in *DefaultHttpResponseParser#parseHead*. The body is of 
> content type application/json. Eventually the following exceptions gets 
> thrown after a while:
> {code:java}
> java.net.SocketTimeoutException: Read timed out
> at java.net.SocketInputStream.socketRead0(Native Method)
> at java.net.SocketInputStream.socketRead(SocketInputStream.java:127)
> at java.net.SocketInputStream.read(SocketInputStream.java:182)
> at java.net.SocketInputStream.read(SocketInputStream.java:152)
> at 
> org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137)
> at 
> org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153)
> at 
> org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:282)
> at 
> org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138)
> at 
> org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
> at 
> org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
> at 
> org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
> at 
> org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:165)
> at 
> org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
> at 
> org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
> at 
> org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
> at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
> at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
> at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
> at 
> org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
> at 
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
> at 
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
> {code}
>  
> I'm not really familiar if 000 is even a valid return code. When querying the 
> server with some other HTTP tools like Postman, I do get the json response 
> with a status code 000.
> Do you guys think this is something that can be fixed in HttpClient or at 
> least handled by some sort of an error?
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (HTTPCORE-508) Handle "HTTP/1.1 000 status code 000" responses

2018-02-05 Thread Oleg Kalnichevski (JIRA)

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

Oleg Kalnichevski commented on HTTPCORE-508:


@[~ppetrov] Please see [this 
example|http://hc.apache.org/httpcomponents-client-4.5.x/httpclient/examples/org/apache/http/examples/client/ClientConfiguration.java].
 

Oleg

> Handle "HTTP/1.1 000 status code 000" responses
> ---
>
> Key: HTTPCORE-508
> URL: https://issues.apache.org/jira/browse/HTTPCORE-508
> Project: HttpComponents HttpCore
>  Issue Type: Bug
>  Components: HttpCore, HttpCore NIO
>Affects Versions: 4.4.9, 5.0-beta2
>Reporter: Petar Petrov
>Assignee: Oleg Kalnichevski
>Priority: Major
> Fix For: 4.4.10, 5.0-beta3
>
> Attachments: canResponseHaveABody.png, doReceiveResponse.png
>
>
> Hi!
> I have a very _funny_ behaviour where the HttpClient seems to wrongly 
> interpret the body of an HTTP response as headers, the parsing of which 
> eventually leads to a java.net.SocketTimeoutException. 
> The underlying cause of this seems to be a a faulty server response, i.e.,
> {noformat}
> HTTP/1.1 000 status code 000{noformat}
> Thank you Apple! /s
>  
> I have managed to trace the origin of the problem to the *method 
> HttpRequestExecutor#canResponseHaveBody* where, as expected, 000 is not 
> considered as a valid status code.
> !canResponseHaveABody.png!
> !doReceiveResponse.png!
> So what happens seems to be that the status line and headers get parsed. The 
> 000 is not considered valid and that ends the processing of the response. 
> Then the rest of the response (the body) seems to go through the parsing 
> procedure again in *DefaultHttpResponseParser#parseHead*. The body is of 
> content type application/json. Eventually the following exceptions gets 
> thrown after a while:
> {code:java}
> java.net.SocketTimeoutException: Read timed out
> at java.net.SocketInputStream.socketRead0(Native Method)
> at java.net.SocketInputStream.socketRead(SocketInputStream.java:127)
> at java.net.SocketInputStream.read(SocketInputStream.java:182)
> at java.net.SocketInputStream.read(SocketInputStream.java:152)
> at 
> org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137)
> at 
> org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153)
> at 
> org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:282)
> at 
> org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138)
> at 
> org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
> at 
> org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
> at 
> org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
> at 
> org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:165)
> at 
> org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
> at 
> org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
> at 
> org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
> at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
> at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
> at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
> at 
> org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
> at 
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
> at 
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
> {code}
>  
> I'm not really familiar if 000 is even a valid return code. When querying the 
> server with some other HTTP tools like Postman, I do get the json response 
> with a status code 000.
> Do you guys think this is something that can be fixed in HttpClient or at 
> least handled by some sort of an error?
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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