Skip to content
This repository was archived by the owner on Aug 30, 2026. It is now read-only.
This repository was archived by the owner on Aug 30, 2026. It is now read-only.

http请求头重复 bug HTTP request header duplicates bugs #82

Description

@wivd
opt  := &grequests.RequestOptions{}
	proxyURL, err := url.Parse("http://127.0.0.1:8080")
	//body := strings.NewReader("username=admin&password=password&Login=Login")

	opt.Headers = map[string]string{
		"test":"test",
	}

	opt.Proxies = map[string]*url.URL{proxyURL.Scheme: proxyURL}

	//opt.RequestBody = body
	opt.UseCookieJar = true
	opt.DisableCompression = false
	opt.Data =  map[string]string{"username":"admin","password":"password","Login":"Login"}

	resp,err := grequests.Post ("http://192.168.95.4/aaa/login.php",opt)
	fmt.Println(err)
	//fmt.Println(resp.String())
	fmt.Println(resp.StatusCode)

After login, the corresponding 302 status code of the web server,When grequests continues to make requests, the “test” header in the HTTP request header repeats
http requests

GET /aaa/index.php HTTP/1.1
Host: 192.168.95.4
User-Agent: GRequests/0.10
Content-Type: application/x-www-form-urlencoded
Content-Type: application/x-www-form-urlencoded
Cookie: security=high; PHPSESSID=90949a1f57fa20a9e948f589e17a6786
Referer: http://192.168.95.4/aaa/login.php
Test: test
Test: test
Accept-Encoding: gzip, deflate
Connection: close

The reason is that the function "addRedirectFunctionality" in the utils. go file uses req. Header. Add (k, v) ,
Modified to req. Header.Set (k, v) resolves the problem of duplication of HTTP request headers

My English is very poor

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions