Skip to content

net/http: can't send star request #11202

Description

@dvyukov

The following program fails with the panic:

package main

import (
    "bufio"
    "bytes"
    "net/http"
)

func main() {
    data := []byte("M-SEARCH * 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 %2A: invalid URI for request

Star is a common path for some request types. It is handled by a special path in URL.Parse, but URL.String generated %2A for it, which is an invalid path.

go version devel +a1fe3b5 Sat Jun 13 04:33:26 2015 +0000 linux/amd64

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions