Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 356466 - HostReachableValidator: encoding of URLs is broken
Summary: HostReachableValidator: encoding of URLs is broken
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Skalli (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-01 08:53 EDT by Michael Ochmann CLA
Modified: 2022-10-03 10:28 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Ochmann CLA 2011-09-01 08:53:26 EDT
URLs of the form http://host:port/path%20with%20blanks are encoded as http://host:port/path%2520with%2520blanks which is wrong
Comment 1 Michael Ochmann CLA 2012-07-18 09:36:05 EDT
* URLs entered for projects sometimes are "slightly" invalid, e.g.
contain blanks in paths; browsers usually try to "sanitize" such URLs,
and so should HostReachableValidator
* encoding of URLs/URIs in Java is a mess:
java.net.URI(String) accepts only 100% valid URIs, while
java.net.URI(String, String,...) encodes path and query parameters;
java.net.URL(String) happily accepts for example paths with blanks,
and returns these paths with blanks
* implemented a simple "sanitize" mechanism in URLUtils#stringToURL():
- first try java.net.URI(String) : if the string is a valid URI, just
convert the URI to an URL and return it
- if java.net.URI(String) throws an exception, try
java.net.URL(String): if that fails too, then give up; otherwise
construct a URI with ava.net.URI(String, String,...) and retrieve
the necessary params from the URL: now they are properly encoded!
- finally convert the URI back to an URL using URI#toAsciiString()

https://git.eclipse.org/r/#/c/6844/