[GH-ISSUE #959] frpc通过代理连接frps无法通过代理认证 #763

Closed
opened 2026-05-05 12:29:16 -06:00 by gitea-mirror · 2 comments
Owner

Originally created by @streamone on GitHub (Oct 27, 2018).
Original GitHub issue: https://github.com/fatedier/frp/issues/959

Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly.
(为了节约时间,提高处理问题的效率,不按照格式填写的 issue 将会直接关闭。)

Use the commands below to provide key information from your environment:
You do NOT have to include this information if this is a FEATURE REQUEST

What version of frp are you using (./frpc -v or ./frps -v)?
0.21.0

What operating system and processor architecture are you using (go env)?
win64

Configures you used:
[common]
server_addr = x.x.x.x
server_port = 9090
token = ssssss
use_encryption = true
use_compression = true
pool_count = 5
http_proxy = http://user:pass@proxyhost:8080

[tcp]
type = tcp
local_ip = 127.0.0.1
local_port = 9999
remote_port = 8888

Steps to reproduce the issue:

  1. frpc -c frpc.ini

Describe the results you received:
返回
C:\frp_0.21.0_windows_amd64>frpc -c frpc.ini
2018/10/28 02:14:33 [I] [proxy_manager.go:300] proxy removed: []
2018/10/28 02:14:33 [I] [proxy_manager.go:310] proxy added: [tcp]
2018/10/28 02:14:33 [I] [proxy_manager.go:333] visitor removed: []
2018/10/28 02:14:33 [I] [proxy_manager.go:342] visitor added: []
2018/10/28 02:14:33 [W] [control.go:113] login to server failed: DialTcpByHttpProxy error, StatusCode [407]
DialTcpByHttpProxy error, StatusCode [407]

Describe the results you expected:
407应该是代理认证失败,相同的代理用户密码用curl就可以connect到frps

Additional information you deem important (e.g. issue happens only occasionally):
看了一下golib/net/proxy.go代码,这一段里好像 auth.Enable 始终没有被赋值

func DialTcpByHttpProxy(proxyHost string, dstAddr string, auth *ProxyAuth) (c net.Conn, err error) {
	if c, err = net.Dial("tcp", proxyHost); err != nil {
		return
	}

	req, err := http.NewRequest("CONNECT", "http://"+dstAddr, nil)
	if err != nil {
		return
	}
	if auth.Enable {
		req.Header.Set("Proxy-Authorization", "Basic "+base64.StdEncoding.EncodeToString([]byte(auth.Username+":"+auth.Passwd)))
	}
	req.Header.Set("User-Agent", "Mozilla/5.0")
	req.Write(c)

Can you point out what caused this issue (optional)

Originally created by @streamone on GitHub (Oct 27, 2018). Original GitHub issue: https://github.com/fatedier/frp/issues/959 Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly. (为了节约时间,提高处理问题的效率,不按照格式填写的 issue 将会直接关闭。) Use the commands below to provide key information from your environment: You do NOT have to include this information if this is a FEATURE REQUEST **What version of frp are you using (./frpc -v or ./frps -v)?** 0.21.0 **What operating system and processor architecture are you using (`go env`)?** win64 **Configures you used:** [common] server_addr = x.x.x.x server_port = 9090 token = ssssss use_encryption = true use_compression = true pool_count = 5 http_proxy = http://user:pass@proxyhost:8080 [tcp] type = tcp local_ip = 127.0.0.1 local_port = 9999 remote_port = 8888 **Steps to reproduce the issue:** 1. frpc -c frpc.ini **Describe the results you received:** 返回 C:\frp_0.21.0_windows_amd64>frpc -c frpc.ini 2018/10/28 02:14:33 [I] [proxy_manager.go:300] proxy removed: [] 2018/10/28 02:14:33 [I] [proxy_manager.go:310] proxy added: [tcp] 2018/10/28 02:14:33 [I] [proxy_manager.go:333] visitor removed: [] 2018/10/28 02:14:33 [I] [proxy_manager.go:342] visitor added: [] 2018/10/28 02:14:33 [W] [control.go:113] login to server failed: DialTcpByHttpProxy error, StatusCode [407] DialTcpByHttpProxy error, StatusCode [407] **Describe the results you expected:** 407应该是代理认证失败,相同的代理用户密码用curl就可以connect到frps **Additional information you deem important (e.g. issue happens only occasionally):** 看了一下golib/net/proxy.go代码,这一段里好像 auth.Enable 始终没有被赋值 ``` func DialTcpByHttpProxy(proxyHost string, dstAddr string, auth *ProxyAuth) (c net.Conn, err error) { if c, err = net.Dial("tcp", proxyHost); err != nil { return } req, err := http.NewRequest("CONNECT", "http://"+dstAddr, nil) if err != nil { return } if auth.Enable { req.Header.Set("Proxy-Authorization", "Basic "+base64.StdEncoding.EncodeToString([]byte(auth.Username+":"+auth.Passwd))) } req.Header.Set("User-Agent", "Mozilla/5.0") req.Write(c) ``` **Can you point out what caused this issue (optional)**
gitea-mirror 2026-05-05 12:29:16 -06:00
Author
Owner

@fatedier commented on GitHub (Oct 29, 2018):

看起来是的,你能修改测试下,然后提个 PR fix ?

<!-- gh-comment-id:433768059 --> @fatedier commented on GitHub (Oct 29, 2018): 看起来是的,你能修改测试下,然后提个 PR fix ?
Author
Owner

@streamone commented on GitHub (Oct 29, 2018):

我很愿意帮忙,但是我不会go语言,否则就直接提PR了,抱歉...

<!-- gh-comment-id:433771325 --> @streamone commented on GitHub (Oct 29, 2018): 我很愿意帮忙,但是我不会go语言,否则就直接提PR了,抱歉...
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#763
No description provided.