|
@@ -7,6 +7,7 @@ import (
|
|
"io/ioutil"
|
|
"io/ioutil"
|
|
"net/http"
|
|
"net/http"
|
|
"net/http/httputil"
|
|
"net/http/httputil"
|
|
|
|
+ "net/url"
|
|
"ngrok/conn"
|
|
"ngrok/conn"
|
|
"ngrok/util"
|
|
"ngrok/util"
|
|
"time"
|
|
"time"
|
|
@@ -78,6 +79,12 @@ func (h *Http) readRequests(tee *conn.Tee, lastTxn chan *HttpTxn) {
|
|
tee.Warn("Failed to extract request body: %v", err)
|
|
tee.Warn("Failed to extract request body: %v", err)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // net/http's ReadRequest doesn't properly create the req.URL
|
|
|
|
+ // structure, which is needed to properly DumpRequest() later
|
|
|
|
+ req.URL, err = url.Parse(req.RequestURI)
|
|
|
|
+ req.URL.Host = req.Host
|
|
|
|
+ req.URL.Scheme = "http"
|
|
|
|
+
|
|
txn := &HttpTxn{Start: time.Now()}
|
|
txn := &HttpTxn{Start: time.Now()}
|
|
txn.Req = &HttpRequest{Request: req}
|
|
txn.Req = &HttpRequest{Request: req}
|
|
txn.Req.BodyBytes, txn.Req.Body, err = extractBody(req.Body)
|
|
txn.Req.BodyBytes, txn.Req.Body, err = extractBody(req.Body)
|