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

Fix windows proxy #285

Closed
wants to merge 1 commit into from
Closed

Fix windows proxy #285

wants to merge 1 commit into from

Conversation

siwee
Copy link
Contributor

@siwee siwee commented Dec 12, 2022

Fix idm does't recognize the system proxy, and LAN segment bypass.

@nekohasekai
Copy link
Member

Can you explain what removing 'http' does?

@siwee
Copy link
Contributor Author

siwee commented Dec 18, 2022

Hi, @nekohasekai

The default proxy protocol of the Windows system is http. http://127.0.0.1 is valid in most cases, but it cannot work in some software, for example: IDM (internate download manager). So I thought compatibility would be better without http://, I tested it and it works. I refer to clash and other software, none of them add http:// prefix.

image

Thanks.

@database64128
Copy link
Contributor

If you set the system proxy via the Settings app or Internet Options, the http:// prefix will be automatically added. I think it's best for sing-box to align with the system's default behavior.

If you purchased IDM, you should ask the IDM developers to fix this bug. Or just specify the proxy manually in IDM's configuration.

@siwee
Copy link
Contributor Author

siwee commented Dec 19, 2022

If you set the system proxy via the Settings app or Internet Options, the http:// prefix will be automatically added. I think it's best for sing-box to align with the system's default behavior.

If you purchased IDM, you should ask the IDM developers to fix this bug. Or just specify the proxy manually in IDM's configuration.

By default, the system does not add the http:// prefix. To find out the default behavior of Windows, you only need to manually set the Windows system proxy, then open the Windows registry, find the HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer key, and then you can look at the value to know the conclusion.

The default proxy protocol of windows is http, but there is no need to specify http:// prefix

BTW, there is nothing wrong with IDM's default behavior.

@database64128
Copy link
Contributor

By default, the system does not add the http:// prefix. To find out the default behavior of Windows, you only need to manually set the Windows system proxy, then open the Windows registry, find the HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer key, and then you can look at the value to know the conclusion.

That's not the case on my Windows 11 system. I only posted my reply because that's how it works on my system. And so far I have encountered exactly 0 programs that have issues with this.

BTW, there is nothing wrong with IDM's default behavior.

If it doesn't work, then something's wrong with it.

@siwee
Copy link
Contributor Author

siwee commented Dec 19, 2022

That's not the case on my Windows 11 system. I only posted my reply because that's how it works on my system. And so far I have encountered exactly 0 programs that have issues with this.

image

image

What did you see?

If it doesn't work, then something's wrong with it.

IDM may be able to do better, but for now it's playing by the rules. It's okay to follow the rules, right?

@siwee
Copy link
Contributor Author

siwee commented Dec 19, 2022

In conclusion, http://<ip>:<port> is fine in most cases, but some software will make mistakes. To fix it just remove the http:// prefix. This doesn't affect otherwise working software, and it conforms to Windows default behavior.

@database64128
Copy link
Contributor

but for now it's playing by the rules.

Clearly it's not. Otherwise it would've worked.

What did you see?

I use localhost instead of 127.0.0.1 as the proxy address. That's probably why the system prepended http://.

@siwee
Copy link
Contributor Author

siwee commented Dec 20, 2022

I use localhost instead of 127.0.0.1 as the proxy address. That's probably why the system prepended http://.

My conclusion after verification is not as you said.

image

localhost and 127.0.0.1 make no difference in this case.

@database64128
Copy link
Contributor

OK. I just double-checked and found out the culprit is Internet Options. Opening Internet Options would add the http:// prefix if it wasn't already there.

@siwee
Copy link
Contributor Author

siwee commented Dec 20, 2022

@database64128 Can you tell me the steps to reproduce? Thanks.

@database64128
Copy link
Contributor

On my system, simply opening Internet Options would change localhost:8080 to http://localhost:8080.

@dyhkwong
Copy link
Contributor

I think the http:// scheme is initially added to workaround a python bug. Some software doesn't work with http://, some others doesn't work without http://. Prepending http:// is legit, so why not report it to the broken software instead?

For proxy exception, some users may want to customize it (e.g. bypassing localhost.ptlogin2.qq.com). How about leaving it as is (do not override it on starting/stopping)?

@nekohasekai
Copy link
Member

The official example provides the prefix, so the problem should be in the application that does not work.

https://learn.microsoft.com/en-us/windows/win32/wininet/setting-and-retrieving-internet-options#setting-connection-options

@nekohasekai
Copy link
Member

nekohasekai commented Dec 26, 2022

For proxy exception, some users may want to customize it (e.g. bypassing localhost.ptlogin2.qq.com). How about leaving it as is (do not override it on starting/stopping)?

f5c5570

@siwee
Copy link
Contributor Author

siwee commented Dec 26, 2022

The official example provides the prefix, so the problem should be in the application that does not work.

https://learn.microsoft.com/en-us/windows/win32/wininet/setting-and-retrieving-internet-options#setting-connection-options

Hi, @nekohasekai

I think we have a difference between Windows and Wininet as a standard. Windows is the protagonist. We should take Windows default behavior as standard. I refer to clash for windows and shadowsocks and v2rayN, their format is host:port instead of http://host:port.

@nekohasekai
Copy link
Member

I think we still need something standard, something that comes from documentation rather than behavior from your device or some closed source 3rd party software that you like. Please show your code.

@siwee
Copy link
Contributor Author

siwee commented Dec 26, 2022

PR closed. Thanks everyone!

@siwee siwee closed this Dec 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants