{"action":"created","issue":{"url":"https://api.github.com/repos/square/okhttp/issues/1486","labels_url":"https://api.github.com/repos/square/okhttp/issues/1486/labels{/name}","comments_url":"https://api.github.com/repos/square/okhttp/issues/1486/comments","events_url":"https://api.github.com/repos/square/okhttp/issues/1486/events","html_url":"https://github.com/square/okhttp/issues/1486","id":60602442,"number":1486,"title":"OkHttp Url API","user":{"login":"swankjesse","id":133019,"avatar_url":"https://avatars.githubusercontent.com/u/133019?v=3","gravatar_id":"","url":"https://api.github.com/users/swankjesse","html_url":"https://github.com/swankjesse","followers_url":"https://api.github.com/users/swankjesse/followers","following_url":"https://api.github.com/users/swankjesse/following{/other_user}","gists_url":"https://api.github.com/users/swankjesse/gists{/gist_id}","starred_url":"https://api.github.com/users/swankjesse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swankjesse/subscriptions","organizations_url":"https://api.github.com/users/swankjesse/orgs","repos_url":"https://api.github.com/users/swankjesse/repos","events_url":"https://api.github.com/users/swankjesse/events{/privacy}","received_events_url":"https://api.github.com/users/swankjesse/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/square/okhttp/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/square/okhttp/milestones/12","html_url":"https://github.com/square/okhttp/milestones/2.4","labels_url":"https://api.github.com/repos/square/okhttp/milestones/12/labels","id":999936,"number":12,"title":"2.4","description":"","creator":{"login":"swankjesse","id":133019,"avatar_url":"https://avatars.githubusercontent.com/u/133019?v=3","gravatar_id":"","url":"https://api.github.com/users/swankjesse","html_url":"https://github.com/swankjesse","followers_url":"https://api.github.com/users/swankjesse/followers","following_url":"https://api.github.com/users/swankjesse/following{/other_user}","gists_url":"https://api.github.com/users/swankjesse/gists{/gist_id}","starred_url":"https://api.github.com/users/swankjesse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swankjesse/subscriptions","organizations_url":"https://api.github.com/users/swankjesse/orgs","repos_url":"https://api.github.com/users/swankjesse/repos","events_url":"https://api.github.com/users/swankjesse/events{/privacy}","received_events_url":"https://api.github.com/users/swankjesse/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":10,"state":"open","created_at":"2015-02-28T12:48:24Z","updated_at":"2015-04-21T02:26:13Z","due_on":"2015-05-31T04:00:00Z","closed_at":null},"comments":9,"created_at":"2015-03-11T02:52:16Z","updated_at":"2015-04-26T20:55:49Z","closed_at":null,"body":"An immutable value class with a builder. Features to support:\r\n\r\n * [ ] toUrl()\r\n * [ ] toUri()\r\n * [ ] toString()\r\n * [ ] resolve(String link)\r\n * [ ] compose from scheme, authority, path, query, fragment\r\n * [ ] compose query parameters, which may come already-encoded or not\r\n * [ ] Pragmatic validation. For example, permit `|` chars. See [issue 1044](https://github.com/square/okhttp/issues/1044).\r\n * [ ] effectivePort() method that knows HTTP is 80 and HTTPS is 443\r\n * [ ] static defaultPort(String scheme) method to lookup 80 and 443\r\n * [ ] static parse(String) method that returns null if the input is not well formed\r\n * [ ] Pragmatic canonicalization. `HTTP://SQUARE.COM:80` should be canonicalized to `http://square.com/`.\r\n * [ ] equals and hashCode that leverage the pragmatic canonicalization\r\n\r\nWe need to be thoughtful around how the APIs work when data needs encoding. If I call `path()` does that return `/foo%7cbar` or `/foo|bar` ? My guess is that as a rule, we _never_ decode `%7c` into `|` because encoding and decoding URL components necessarily lives at the application level. (Otherwise consider the path `/foo%2fbar/baz`, which decodes to `/foo/bar/baz`). This strategy makes more sense when you recognize that the charset is itself unspecified and lives at the application level.\r\n\r\nI'd like to consider deliberately not supporting URL schemes other than `http` and `https`. There's marginal benefit to handling `mailto:` and `file:` in the same class, and it means that more code would need to validate that the URL they're holding is of the type they expect. (What about `ws:` and `wss:` ?)\r\n\r\nI'd like to support internationalized domain names, though not necessarily immediately.\r\n\r\nWhat do we name it? `Url`? `HttpUrl` ? `OkUrl` ?\r\n\r\nResources:\r\nhttp://developer.android.com/reference/java/net/URL.html\r\nhttp://developer.android.com/reference/java/net/URI.html\r\nhttp://developer.android.com/reference/android/net/Uri.html\r\n"},"comment":{"url":"https://api.github.com/repos/square/okhttp/issues/comments/96433998","html_url":"https://github.com/square/okhttp/issues/1486#issuecomment-96433998","issue_url":"https://api.github.com/repos/square/okhttp/issues/1486","id":96433998,"user":{"login":"frownlee","id":8821878,"avatar_url":"https://avatars.githubusercontent.com/u/8821878?v=3","gravatar_id":"","url":"https://api.github.com/users/frownlee","html_url":"https://github.com/frownlee","followers_url":"https://api.github.com/users/frownlee/followers","following_url":"https://api.github.com/users/frownlee/following{/other_user}","gists_url":"https://api.github.com/users/frownlee/gists{/gist_id}","starred_url":"https://api.github.com/users/frownlee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frownlee/subscriptions","organizations_url":"https://api.github.com/users/frownlee/orgs","repos_url":"https://api.github.com/users/frownlee/repos","events_url":"https://api.github.com/users/frownlee/events{/privacy}","received_events_url":"https://api.github.com/users/frownlee/received_events","type":"User","site_admin":false},"created_at":"2015-04-26T20:55:49Z","updated_at":"2015-04-26T20:55:49Z","body":"Automatic punycode conversion?"}}