Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http/httputil: DumpRequest doesn't dump full url when serve as forward proxy. #10912

Closed
SunRunAway opened this issue May 19, 2015 · 2 comments
Milestone

Comments

@SunRunAway
Copy link

  1. What version of Go are you using (go version)?
    go version go1.4.2 darwin/amd64
  2. What operating system and processor architecture are you using?
    darwin/amd64
  3. What did you do?

run this program on local.

package main

import (
    "fmt"
    "net/http"
    "net/http/httputil"
)

func do(w http.ResponseWriter, req *http.Request) {
    b, _ := httputil.DumpRequest(req, false)
    fmt.Println(string(b))
}

func main() {
    http.HandleFunc("/", do)
    http.ListenAndServe(":12306", nil)
}

on another terminal, run:

curl -v 'http://www.qiniu.com/' -x 'http://localhost:12306'
* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 12306 (#0)
> GET http://www.qiniu.com/ HTTP/1.1
> User-Agent: curl/7.37.1
> Host: www.qiniu.com
> Accept: */*
> Proxy-Connection: Keep-Alive
> 
< HTTP/1.1 200 OK
< Date: Tue, 19 May 2015 08:55:41 GMT
< Content-Length: 0
< Content-Type: text/plain; charset=utf-8
< 
* Connection #0 to host localhost left intact
  1. What did you expect to see?

I ran sudo tcpdump -i any -A port 12306 and it prints

GET http://www.qiniu.com/ HTTP/1.1
User-Agent: curl/7.37.1
Host: www.qiniu.com
Accept: */*
Proxy-Connection: Keep-Alive



  1. What did you see instead?
GET / HTTP/1.1
Host: www.qiniu.com
Accept: */*
Proxy-Connection: Keep-Alive
User-Agent: curl/7.37.1



@ianlancetaylor
Copy link
Contributor

CC @bradfitz

@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Jun 3, 2015
@bradfitz
Copy link
Contributor

bradfitz commented Dec 9, 2015

CL https://golang.org/cl/17592 mentions this issue.

@golang golang locked and limited conversation to collaborators Dec 14, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants