Skip to content

http: false User-Agent in DumpRequest #2272

@masiulaniec

Description

@masiulaniec
In documentation the function http.DumpRequest is defined to dump the request's wire
representation.  In reality it makes up some fields.  In below example notice how my
telnet is reported to be a "Go http package".


package main

import  "http"

func dump(w http.ResponseWriter, req *http.Request) {
        dump, _ := http.DumpRequest(req, false)
        w.Write(dump)
}

func main() {
        http.ListenAndServe(":6060", http.HandlerFunc(dump))
}


Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.0

HTTP/1.0 200 OK
Date: Sun, 18 Sep 2011 18:39:54 GMT
Content-Type: text/plain; charset=utf-8

GET / HTTP/1.1
Host: 
User-Agent: Go http package

Connection closed by foreign host.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions