F
F
Fedooot012020-11-04 17:53:38
OpenSSL
Fedooot01, 2020-11-04 17:53:38

What should I change to pass the request over https through a proxy with the header in the Connection: close request?

Hello, there is a private http proxy server. And a computer on Windows 10 x64.

If you make HTTPS requests from the computer through this proxy, adding to the request header Connection: close, for example, through a Node.js script, a PHP script, setting this proxy to an external proxy in sniffers like Charles, Burp Suite,
or via cURL, then the request passes in the best case 1 time out of 10, or maybe not at all.

Example for cURL:

curl -x http://user:[email protected]:port https://httpbin.org/get -H "Connection: Close"


Answer:
curl: (56) Failure when receiving data from the peer

The result of working with the parameter when running -v
* TCP_NODELAY set
* Connected to ProxyIP (ProxyIP) port ProxyPORT (#0)
* allocate connect buffer!
* Establish HTTP proxy tunnel to httpbin.org:443
* Proxy auth using Basic with user 'user'
> CONNECT httpbin.org:443 HTTP/1.1
> Host: httpbin.org:443
> Proxy-Authorization: Basic Tm90aGluZ0ludHJlc3RpbmdIZXJl
> User-Agent: curl/7.55.1
> Proxy-Connection: Keep-Alive
>
< HTTP/1.0 200 Connection established
<
* Proxy replied OK to CONNECT request
* CONNECT phase completed!
* schannel: SSL/TLS connection with httpbin.org port 443 (step 1/3)
* schannel: checking server certificate revocation
* schannel: sending initial handshake data: sending 182 bytes...
* schannel: sent initial handshake data: sent 182 bytes
* schannel: SSL/TLS connection with httpbin.org port 443 (step 2/3)
* schannel: failed to receive handshake, need more data
* CONNECT phase completed!
* CONNECT phase completed!
* schannel: SSL/TLS connection with httpbin.org port 443 (step 2/3)
* schannel: encrypted data got 4096
* schannel: encrypted data buffer: offset 4096 length 4096
* schannel: encrypted data length: 4030
* schannel: encrypted data buffer: offset 4030 length 4096
* schannel: received incomplete message, need more data
* schannel: SSL/TLS connection with httpbin.org port 443 (step 2/3)
* schannel: encrypted data got 184
* schannel: encrypted data buffer: offset 4214 length 5054
* schannel: received incomplete message, need more data
* schannel: SSL/TLS connection with httpbin.org port 443 (step 2/3)
* schannel: encrypted data got 971
* schannel: encrypted data buffer: offset 5185 length 5238
* schannel: sending next handshake data: sending 126 bytes...
* schannel: SSL/TLS connection with httpbin.org port 443 (step 2/3)
* schannel: encrypted data got 258
* schannel: encrypted data buffer: offset 258 length 5238
* schannel: SSL/TLS handshake complete
* schannel: SSL/TLS connection with httpbin.org port 443 (step 3/3)
* schannel: stored credential handle in session cache
> GET /get HTTP/1.1
> Host: httpbin.org
> User-Agent: curl/7.55.1
> Accept: */*
> Connection: close
>
* schannel: client wants to read 102400 bytes
* schannel: encdata_buffer resized 103424
* schannel: encrypted data buffer: offset 0 length 103424
* schannel: server closed the connection
* schannel: encrypted data buffer: offset 0 length 103424
* schannel: encrypted data buffer: offset 0 length 103424
* schannel: decrypted data buffer: offset 0 length 4096
* schannel: schannel_recv cleanup
* schannel: server closed abruptly (missing close_notify)
* Closing connection 0
* schannel: shutting down SSL/TLS connection with httpbin.org port 443
* schannel: clear security context handle
curl: (56) Failure when receiving data from the peer


If you make a request without Connection: closeor just via HTTP, then there are no problems and the server always responds to both node.js and PHP and cURL and everything else.

If you make requests from another PC / laptop, there are no such problems at all .

Incidentally, cURL.exe ( curl 7.55.1 (Windows) libcurl/7.55.1 WinSSL) is in system32, file size 412 kb, apparently using the surrounding dll's to query.

But if you download fresh cURL separately (
curl 7.73.0 (x86_64-pc-win32) libcurl/7.73.0 OpenSSL/1.1.1h (Schannel) zlib/1.2.11 brotli/1.0.9 zstd/1.4.5 WinIDN libssh2/1.9.0 nghttp2/1.41.0
) the size of the exe is about 3mb, then HTTPS requests Connection: close pass through it successfully .

I get the impression that there are some problems in the Windows system files that all programs use to make requests. Since the latest version of cURL makes requests without problems, apparently using its own libraries, and not from Windows, for the request.

Tell me, please, where to dig to solve the problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question