I have the requirement to send HTTP packets with a protocol specifier other than HTTP/...
I use the http.Response
to create packets
resp := new(http.Response)
resp.Status = "200 OK"
resp.StatusCode = http.StatusOK
resp.ProtoMajor = 1
resp.ProtoMinor = 0
resp.Proto = "EVENT/1.0"
I set the Proto
field, but at the end the written bytes still contains HTTP/1.0 200 OK
because that's hardcoded in response.go
216 if _, err := io.WriteString(w, "HTTP/"+protoMajor+"."+protoMinor+" "+statusCode+text+"
"); err != nil {
217 return err
218 }
Is there a reason why the Proto field is ignored?