fix: fixed bug which caused http.proxy not to parse response changes correctly.

This commit is contained in:
evilsocket 2018-02-11 02:08:56 +01:00
commit 8a0b29cd30
2 changed files with 11 additions and 7 deletions

View file

@ -24,18 +24,22 @@ type JSResponse struct {
func NewJSResponse(res *http.Response) *JSResponse {
cType := ""
headers := ""
code := 200
for name, values := range res.Header {
for _, value := range values {
if name == "Content-Type" {
cType = value
if res != nil {
code = res.StatusCode
for name, values := range res.Header {
for _, value := range values {
if name == "Content-Type" {
cType = value
}
headers += name + ": " + value + "\r\n"
}
headers += name + ": " + value + "\r\n"
}
}
resp := &JSResponse{
Status: res.StatusCode,
Status: code,
ContentType: cType,
Headers: headers,
resp: res,