@Fedooot01

Что изменить для прохождения запроса по https через proxy с заголовком в запросе Connection: close?

Здравствуйте, есть приватный http прокси сервер. И компьютер на Windows 10 x64.

Если делать с компьютера HTTPS запросы через этот прокси, добавляя в заголовок запроса Connection: close, например, через скрипт на Node.js, скрипт на PHP, выставлением этого прокси внешним прокси в сниферах типа Charles, Burp Suite,
либо через cURL, то запрос проходит в лучшем случае 1 раз из 10, а может и вовсе не пройти.

Пример для cURL:
curl -x http://user:password@ip:port https://httpbin.org/get -H "Connection: Close"


Ответ:
curl: (56) Failure when receiving data from the peer

Результат работы с параметром при запуске -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


Если делать запрос без Connection: close либо просто по HTTP, то проблем нет и сервер отвечает всегда и node.js и PHP и cURL'у и всему другому.

Если делать запросы с другого ПК/ноутбука, таких проблем нет вообще.

Кстати, cURL.exe (curl 7.55.1 (Windows) libcurl/7.55.1 WinSSL) находится в system32, размер файла 412 кб, видимо, используя окружающие dll, для запроса.

А вот если скачать свежий cURL отдельно (
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
) размер exe около 3мб, то запросы по HTTPS с Connection: close через него успешно проходят.

У меня создается впечатление, что есть какие-то проблемы в системных файлах Windows, с помощью которых все программы делают запросы. Раз cURL последней версии делает запросы без проблем, видимо, используя свои библиотеки, а не от Windows, для запроса.

Подскажите, пожалуйста, куда копать, чтобы решить проблему?
  • Вопрос задан
  • 413 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы