hightman/httpclient

400- Bad Request - Reset by Peer

Closed this issue · 5 comments

HI,
We get the below Response, How can solve it, Is any configuration changes required?

[status] => 400
[statusText] => Bad Request
[error] => Reset by peer

DEBUG] 15:07:04 reuse conn 'ssl://xxx.xx.xxx.xx:443': [DEBUG] 15:07:04 open 'ssl://xxx.xx.xxx.xx:443' success: Resource id #29 [DEBUG] 15:07:04 request body(91) [DEBUG] 15:07:04 request header: POST /index.php?ref=cmVjZWl2ZXNxbGxvZy90d29fd2F5X3JlY2VpdmVkYXRh HTTP/1.1 Accept: / Accept-Language: zh-cn,zh Connection: Keep-Alive User-Agent: Mozilla/5.0 (Compatible; hightman\http\Client/1.0.0-beta) php-apache2handler/7.2.13 Linux/3.10.0-862.14.4.el7.x86_64 Charset: UTF-8 Content-Type: application/x-www-form-urlencoded Host: xxx.xx.xxx.xx Content-Length: 89 Cookie: PHPSESSID=pem9bpprgdkpshhsj4r7c1qnrd [DEBUG] 15:07:04 stream_select(rfds[1], wfds[1]) ... [DEBUG] 15:07:04 select result: 1 [DEBUG] 15:07:04 stream_select(rfds[1], wfds[0]) ... [DEBUG] 15:07:04 select result: 1 [DEBUG] 15:07:04 close conn 'ssl://xxx.xx.xxx.xx:443': Resource id #29 [DEBUG] 15:07:04 finished (Reset by new peer
hightman\http\Response Object
(
[status] => 400
[statusText] => Bad Request
[error] => Reset by new peer
[body] =>
[timeCost] => 0.13332104682922
[url] => https://xxx.xx.xxx.xx/index.php?ref=cmVjZWl2ZXNxbGxvZy90d29fd2F5X3JlY2VpdmVkYXRh
[numRedirected] => 0

我也遇到一样的问题,
使用openssl 后 就出现这样的问题

I have fixed this bug. when the reused connection lost, may cause this problem.

Emmm, this seems bug of non-blocking/IO in PHP. I have tried some SSL sites, such as google, baidu it works well, but site with free SSL-certs will be failed.

When I try to blocking-IO, just comment stream_set_blocking($this->sock, false) in Connection.php, it works well, but this will cause other problem.

this bug has been tempoary fix in v1.11