From 98a084fa18af05be0602e0134e05340af7d9ad1e Mon Sep 17 00:00:00 2001 From: fangdingjun Date: Wed, 18 Jul 2018 09:29:42 +0800 Subject: [PATCH] add header on request --- conn.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/conn.go b/conn.go index 9af5a7a..9793eff 100644 --- a/conn.go +++ b/conn.go @@ -13,6 +13,7 @@ import ( "net" "net/http" "net/url" + "strings" "sync" "time" "unsafe" @@ -110,7 +111,13 @@ func (c *Conn) RoundTrip(req *http.Request) (*http.Response, error) { p = fmt.Sprintf("%s?%s", p, q) } nv = append(nv, newNV(":path", p)) - + for k, v := range req.Header { + _k := strings.ToLower(k) + if _k == "connection" || _k == "proxy-connection" || _k == "transfer-encoding" { + continue + } + nv = append(nv, newNV(k, v[0])) + } cdp := C.nghttp2_data_provider{} dp := newDataProvider(unsafe.Pointer(&cdp), c.lock, 1) dp.session = c.session