URL: return error on malformed URLs with junk after port number

... because it causes confusion with users. Example URLs:

"http://[127.0.0.1]:11211:80" which a lot of languages' URL parsers will
parse and claim uses port number 80, while libcurl would use port number
11211.

"http://user@example.com:80@localhost" which by the WHATWG URL spec will
be treated to contain user name 'user@example.com' but according to
RFC3986 is user name 'user' for the host 'example.com' and then port 80
is followed by "@localhost"

Both these formats are now rejected, and verified so in test 1260.

Reported-by: Orange Tsai
3 files changed
tree: d11600c715804a7d85c6005e2d121d000168f245
  1. .github/
  2. CMake/
  3. docs/
  4. include/
  5. lib/
  6. m4/
  7. packages/
  8. projects/
  9. scripts/
  10. src/
  11. tests/
  12. winbuild/
  13. .dir-locals.el
  14. .gitattributes
  15. .gitignore
  16. .travis.yml
  17. acinclude.m4
  18. appveyor.yml
  19. buildconf
  20. buildconf.bat
  21. CHANGES
  22. CMakeLists.txt
  23. configure.ac
  24. COPYING
  25. CTestConfig.cmake
  26. curl-config.in
  27. GIT-INFO
  28. libcurl.pc.in
  29. MacOSX-Framework
  30. Makefile.am
  31. Makefile.dist
  32. maketgz
  33. README
  34. README.md
  35. RELEASE-NOTES
README.md

curl logo CII Best Practices

Curl is a command-line tool for transferring data specified with URL syntax. Find out how to use curl by reading the curl.1 man page or the MANUAL document. Find out how to install Curl by reading the INSTALL document.

libcurl is the library curl is using to do its job. It is readily available to be used by your software. Read the libcurl.3 man page to learn how!

You find answers to the most frequent questions we get in the FAQ document.

Study the COPYING file for distribution terms and similar. If you distribute curl binaries or other binaries that involve libcurl, you might enjoy the LICENSE-MIXING document.

Contact

If you have problems, questions, ideas or suggestions, please contact us by posting to a suitable mailing list.

All contributors to the project are listed in the THANKS document.

Website

Visit the curl web site for the latest news and downloads.

Git

To download the very latest source off the Git server do this:

git clone https://github.com/curl/curl.git

(you'll get a directory named curl created, filled with the source code)

Notice

Curl contains pieces of source code that is Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan. This notice is included here to comply with the distribution terms.