Skip to content

net/textproto: fails to trim header value #11204

Closed
@dvyukov

Description

@dvyukov

The following program:

package main

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

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

prints:

"0 "

Header values must be trimmed.

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