Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
curl --local-port does not try last port in range #3251
(Mentioned in passing in #3248 but now raising as a separate issue.)
I did this
freia013:~/work/curl $ src/curl --local-port 1023-1024 localhost curl: (45) bind failed with errno 13: Permission denied freia013:~/work/curl $ src/curl --local-port 1024 localhost curl: (7) Failed to connect to localhost port 80: Connection refused freia013:~/work/curl $ src/curl --local-port 1023-1025 localhost curl: (7) Failed to connect to localhost port 80: Connection refused
I expected the following
With "1023-1024", curl should try to use port 1024 when 1023 fails, but it only tries 1023 then gives up. If I increase the range to "1023-1025" then it does use 1024. This can be seen in greater detail with additional -v or -libcurl.
localportrange needs to be incremented by one when subtracting last from first.