Skip to content

net/http: allows empty header names #11205

Closed
@dvyukov

Description

@dvyukov

The following program:

package main

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

func main() {
    data := []byte("GET / HTTP/0.0\n:v\n\n")
    r, err := http.ReadRequest(bufio.NewReader(bytes.NewReader(data)))
    if err != nil {
        return
    }
    fmt.Printf("%q\n", r.Header.Get(""))
}

prints:

"v"

As per RFC 7230 field-name is a token, tokens consist of one or more chars.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions