Skip to content

net/http: handle CONNECT in ReadRequest/WriteRequest #2755

Closed
@andybalholm

Description

@andybalholm
What steps will reproduce the problem?
    _, err := http.ReadRequest(bufio.NewReader(strings.NewReader("CONNECT 98.189.193.163:443 HTTP/1.1\r\n\r\n")))
    fmt.Println(err)

What is the expected output?
<nil>

What do you see instead?
parse 98.189.193.163:443: invalid URI for request

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Mac OS Snow Leopard

Which revision are you using?  (hg identify)
b372a927701e tip

Please provide any additional information below.
I'm not sure if these really qualify as URLs, since they don't have a scheme, but they
are used in valid HTTP requests, so we should have some way to deal with them.

If the host is a hostname rather than an IP address, the URL is parsed successfully, but
incorrectly. "www.google.com:443" is parsed as a scheme of
"www.google.com" and an opaque content of "443". But if the host is
just a numeric address, it isn't valid to parse it as a scheme, so it just gives an
error.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions