-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Milestone
Description
The following program fails with the panic:
package main
import (
"bufio"
"bytes"
"net/http"
)
func main() {
data := []byte("GET http:@ HTTP/1.1\n\n")
r, err := http.ReadRequest(bufio.NewReader(bytes.NewReader(data)))
if err != nil {
return
}
buf := new(bytes.Buffer)
if err := r.Write(buf); err != nil {
return
}
_, err = http.ReadRequest(bufio.NewReader(buf))
if err != nil {
panic(err)
}
}panic: parse @: invalid URI for request
Scheme gets parsed into URL.Scheme, but then it is not written during serialization of URL with opaque path.
The same happens in the net/url Opaque Example: https scheme gets lost.
go version devel +a1fe3b5 Sat Jun 13 04:33:26 2015 +0000 linux/amd64