When using curl via an http proxy like cntlm or polipo and specifying the extra HTTP header "Content-Type", for instance
curl --proxy http://myproxy:8080" http://server.com/ --data-binary @req.p10 -H "Content-Type: application/pkcs10"
the CONNECT command to the proxy blocks.
As revealed using "--trace -", the problem is that the extra "Content-Type" header in
CONNECT server.com HTTP/1.1
Host: server.com
User-Agent: curl/7.36.0
Proxy-Connection: Keep-Alive
Content-Type: application/pkcs10
is not only useless, but disturbs the proxy.
BTW, some proxies seem fine if there is additionally a "Content-Length" header, but this appears useless in the CONNECT message, too.
Moreover, I'm not sure if the "Proxy-Connection: Keep-Alive" header is useful in this context, and for some reason it is inserted even when the --no-keepalive option is used.
After commenting out the following two code lines in lib/http_proxy.c
if(CURLE_OK == result)
result = Curl_add_custom_headers(conn, req_buffer);
such that no user-defined headers are inserted in the CONNECT message (which, admittedly may be too drastic), the proxy connection gets through fine.
Thanks, this is a duplicate of [bugs:#1326]
We will hopefully soon merge the functionality of separated headers to the master branch.
Related
Bugs:
#1326