Menu

#1354 HTTP proxy gets confused by extra headers like a user-defined "Content-Type"

closed-duplicate
None
5
2014-08-15
2014-04-03
No

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.

Discussion

  • Daniel Stenberg

    Daniel Stenberg - 2014-04-03
    • status: open --> closed-duplicate
    • assigned_to: Daniel Stenberg
     
  • Daniel Stenberg

    Daniel Stenberg - 2014-04-03

    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

Auth0 Logo