Menu

#1396 cURL ignores named services

closed-invalid
None
5
2014-07-09
2014-07-08
No

cURL does not respect named services. In fact, it seems to ignore any non-numeric string passed after the : in the hostname, and revert to port 80.

On Ubuntu 12.04 and 14.04, if I curl for example:

$ curl localhost:discard/

I would expect for it to attempt to connect to port 9 (according to man 5 services and the contents of /etc/services). Instead, it exits with the error:

curl: (7) Failed to connect to localhost port 80: Connection refused

Should I expect this to work?

Discussion

  • Daniel Stenberg

    Daniel Stenberg - 2014-07-09
    • status: open --> closed-invalid
    • assigned_to: Daniel Stenberg
     
  • Daniel Stenberg

    Daniel Stenberg - 2014-07-09

    curl requires you to provide a "URL", the ones we support are defined mostly in RFC3986 and as section 3.2.3 in there says:

    "an optional port number in decimal"

    Thus, you cannot provide any port in a URL that isn't a decimal number. A service name is not a legitimate port number and thus curl does not support that. It simply is not expected to work!