Skip to content

HTTP CONNECT does not continue after 204 response from proxy #1859

@ljwagerfield

Description

@ljwagerfield

As per RFC-7231 (4.3.6) curl should treat all 2xx responses as "tunnel established".

Any 2xx (Successful) response indicates that the sender (and all inbound proxies) will switch to tunnel mode immediately after the blank line that concludes the successful response's header section

In this instance curl isn't handling 204 correctly: it responds by ending the connection.

I did this

curl -v --proxytunnel -x http://localhost:8080 http://localhost:8081/

I expected the following

* Connected to localhost (::1) port 8080 (#0)
* allocate connect buffer!
* Establish HTTP proxy tunnel to localhost:8081
> CONNECT localhost:8081 HTTP/1.1
> Host: localhost:8081
> User-Agent: curl/7.55.1
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 204 No Content
<
* Proxy replied No Content to CONNECT request
* CONNECT phase completed!
> GET / HTTP/1.1
> Host: localhost:8081
> User-Agent: curl/7.55.1
> Accept: */*

What actually happened

* Connected to localhost (::1) port 8080 (#0)
* allocate connect buffer!
* Establish HTTP proxy tunnel to localhost:8081
> CONNECT localhost:8081 HTTP/1.1
> Host: localhost:8081
> User-Agent: curl/7.55.1
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 204 No Content
<
* Received HTTP code 204 from proxy after CONNECT
* CONNECT phase completed!
* Closing connection 0
curl: (56) Received HTTP code 204 from proxy after CONNECT

curl/libcurl version

curl 7.55.1 (x86_64-apple-darwin16.7.0) libcurl/7.55.1 OpenSSL/1.0.2l zlib/1.2.8 nghttp2/1.25.0
Release-Date: 2017-08-14
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy

operating system

macOS 10.12.6

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions