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

[FR] 5-Digit port #604

Closed
God-damnit-all opened this issue Feb 8, 2020 · 2 comments
Closed

[FR] 5-Digit port #604

God-damnit-all opened this issue Feb 8, 2020 · 2 comments

Comments

@God-damnit-all
Copy link
Contributor

Port conflicts are inevitable, especially as far as Windows is concerned. The OS can be incredibly picky about what 4-digit ports programs are allowed to be used, reserving such huge batches of them at a time, and so 5-digit ports are rapidly becoming the norm. Unfortunately I can't ever get port 6414 to open and I have to change the code and host my own version of the oauth-redirect.html page.

Offering an alternative or finding a way to shift users to the new port without breaking their setup if they're still using the old one would be nice. It's a pain to have to keep changing the code after I update gallery-dl. I thought of submitting a PR but was concerned my solution would be far too hacky.

mikf added a commit that referenced this issue Feb 9, 2020
@mikf
Copy link
Owner

mikf commented Feb 9, 2020

So I've added an option to specify the port number gallery-dl listens on during OAuth authorization (da0d5f6), and it should be possible to get it to work with some manual intervention, but it's not a "good" solution.

You'll have to manually adjust the port number in your browser's address bar when being redirected, since all sites using OAuth will always redirect to localhost:6414, and it's generally not possible to use a different or even arbitrary port for the redirect address. (Most sites will raise an error when using an unknown redirect address)

@God-damnit-all
Copy link
Contributor Author

Here is a workaround, might require a reboot before using in case 6414 is already being used. Run this command in an elevated command prompt or elevated powershell:

netsh int ipv4 add excludedportrange protocol=tcp startport=6414 numberofports=1

This will make Windows not reserve the port. This command is also useful for port ranges, for instance here's how to reserve all the ports Discord uses for its RPC server:

netsh int ipv4 add excludedportrange protocol=tcp startport=6463 numberofports=10

To remove reserved ports, it's the same command but with add changed to delete. To see all your reserved ports, use this command:

netsh int ipv4 show excludedportrange tcp

Needless to say, given how many projects use 4-digit ports and how aggressive Windows is when it comes to occupying 4-digit ports, this makes life a lot easier.

@God-damnit-all God-damnit-all changed the title 5-Digit port [FR] 5-Digit port Jan 1, 2022
@mikf mikf closed this as not planned Won't fix, can't repro, duplicate, stale Dec 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants