{"action":"closed","issue":{"url":"https://api.github.com/repos/golang/go/issues/13290","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/13290/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/13290/comments","events_url":"https://api.github.com/repos/golang/go/issues/13290/events","html_url":"https://github.com/golang/go/issues/13290","id":117367224,"number":13290,"title":"net/http: send User-Agent in proxy CONNECT","user":{"login":"cdcs","id":1036373,"avatar_url":"https://avatars.githubusercontent.com/u/1036373?v=3","gravatar_id":"","url":"https://api.github.com/users/cdcs","html_url":"https://github.com/cdcs","followers_url":"https://api.github.com/users/cdcs/followers","following_url":"https://api.github.com/users/cdcs/following{/other_user}","gists_url":"https://api.github.com/users/cdcs/gists{/gist_id}","starred_url":"https://api.github.com/users/cdcs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdcs/subscriptions","organizations_url":"https://api.github.com/users/cdcs/orgs","repos_url":"https://api.github.com/users/cdcs/repos","events_url":"https://api.github.com/users/cdcs/events{/privacy}","received_events_url":"https://api.github.com/users/cdcs/received_events","type":"User","site_admin":false},"labels":[{"id":373399998,"url":"https://api.github.com/repos/golang/go/labels/NeedsFix","name":"NeedsFix","color":"ededed","default":false}],"state":"closed","locked":false,"assignee":{"login":"bradfitz","id":2621,"avatar_url":"https://avatars.githubusercontent.com/u/2621?v=3","gravatar_id":"","url":"https://api.github.com/users/bradfitz","html_url":"https://github.com/bradfitz","followers_url":"https://api.github.com/users/bradfitz/followers","following_url":"https://api.github.com/users/bradfitz/following{/other_user}","gists_url":"https://api.github.com/users/bradfitz/gists{/gist_id}","starred_url":"https://api.github.com/users/bradfitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradfitz/subscriptions","organizations_url":"https://api.github.com/users/bradfitz/orgs","repos_url":"https://api.github.com/users/bradfitz/repos","events_url":"https://api.github.com/users/bradfitz/events{/privacy}","received_events_url":"https://api.github.com/users/bradfitz/received_events","type":"User","site_admin":false},"assignees":[{"login":"bradfitz","id":2621,"avatar_url":"https://avatars.githubusercontent.com/u/2621?v=3","gravatar_id":"","url":"https://api.github.com/users/bradfitz","html_url":"https://github.com/bradfitz","followers_url":"https://api.github.com/users/bradfitz/followers","following_url":"https://api.github.com/users/bradfitz/following{/other_user}","gists_url":"https://api.github.com/users/bradfitz/gists{/gist_id}","starred_url":"https://api.github.com/users/bradfitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradfitz/subscriptions","organizations_url":"https://api.github.com/users/bradfitz/orgs","repos_url":"https://api.github.com/users/bradfitz/repos","events_url":"https://api.github.com/users/bradfitz/events{/privacy}","received_events_url":"https://api.github.com/users/bradfitz/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/38","html_url":"https://github.com/golang/go/milestones/Go1.8","labels_url":"https://api.github.com/repos/golang/go/milestones/38/labels","id":1709363,"number":38,"title":"Go1.8","description":"","creator":{"login":"griesemer","id":8528975,"avatar_url":"https://avatars.githubusercontent.com/u/8528975?v=3","gravatar_id":"","url":"https://api.github.com/users/griesemer","html_url":"https://github.com/griesemer","followers_url":"https://api.github.com/users/griesemer/followers","following_url":"https://api.github.com/users/griesemer/following{/other_user}","gists_url":"https://api.github.com/users/griesemer/gists{/gist_id}","starred_url":"https://api.github.com/users/griesemer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/griesemer/subscriptions","organizations_url":"https://api.github.com/users/griesemer/orgs","repos_url":"https://api.github.com/users/griesemer/repos","events_url":"https://api.github.com/users/griesemer/events{/privacy}","received_events_url":"https://api.github.com/users/griesemer/received_events","type":"User","site_admin":false},"open_issues":184,"closed_issues":511,"state":"open","created_at":"2016-04-15T16:30:23Z","updated_at":"2016-11-01T17:46:39Z","due_on":"2017-01-31T00:00:00Z","closed_at":null},"comments":7,"created_at":"2015-11-17T14:37:00Z","updated_at":"2016-11-01T17:46:39Z","closed_at":"2016-11-01T17:46:39Z","body":"I am using a http proxy to connect to an https target. This proxy forbids connections from unknown user-agents.\nI am building a new request to have control over the request headers:\n\n```\nreq, err := http.NewRequest(\"GET\", rdurl.String(), nil)\nreq.Header.Set(\"User-Agent\", \"Wget/1.9.1\")\n```\n\nBut even with this change in the user-agent, I am getting a 403 Forbidden answer from the proxy. When dumping the http connection with wireshark, I see that the go http stack is using the default user-agent instead of the one I specified on the request.  \nI think I could trace the problem back to the dialConn function in transport.go:\n\n```\nfunc (t *Transport) dialConn(cm connectMethod) (*persistConn, error){\n        .....        \n        conn := pconn.conn\n        connectReq := &Request{\n                Method: \"CONNECT\",\n                URL:    &url.URL{Opaque: cm.targetAddr},\n                Host:   cm.targetAddr,\n                Header: make(Header),\n        }\n        ...\n}\n```\n\nIn this function, a new request is being built to the CONNECT to the proxy, with a new empty header being allocated. This header is only filled with the proxy authentication if any. I would expect this Header to be filled, as well, with the elements set in the upper request. Alternatively, the Header should be copied from the other request and the proxy authentication later appended.\n\nGo Version: go1.5.1 linux/amd64\nThanks!\n"}}
{"actor":{"display_login":"gopherbot"}}