{"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":"closed","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":2,"closed_issues":18,"state":"open","created_at":"2015-02-28T12:48:24Z","updated_at":"2015-05-18T13:37:06Z","due_on":"2015-05-31T04:00:00Z","closed_at":null},"comments":20,"created_at":"2015-03-11T02:52:16Z","updated_at":"2015-05-18T13:40:10Z","closed_at":"2015-05-13T04:05:11Z","body":"An immutable value class with a builder. Features to support:\r\n\r\n * [x] toUrl()\r\n * [x] toUri()\r\n * [x] toString()\r\n * [x] resolve(String link)\r\n * [x] compose from scheme, authority, path, query, fragment\r\n * [x] compose query parameters, which may come already-encoded or not\r\n * [x] Pragmatic validation. For example, permit `|` chars. See [issue 1044](https://github.com/square/okhttp/issues/1044).\r\n * [x] effectivePort() method that knows HTTP is 80 and HTTPS is 443\r\n * [x] static defaultPort(String scheme) method to lookup 80 and 443\r\n * [x] static parse(String) method that returns null if the input is not well formed\r\n * [x] Pragmatic canonicalization. `HTTP://SQUARE.COM:80` should be canonicalized to `http://square.com/`.\r\n * [x] 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/103063118","html_url":"https://github.com/square/okhttp/issues/1486#issuecomment-103063118","issue_url":"https://api.github.com/repos/square/okhttp/issues/1486","id":103063118,"user":{"login":"Tolriq","id":932609,"avatar_url":"https://avatars.githubusercontent.com/u/932609?v=3","gravatar_id":"","url":"https://api.github.com/users/Tolriq","html_url":"https://github.com/Tolriq","followers_url":"https://api.github.com/users/Tolriq/followers","following_url":"https://api.github.com/users/Tolriq/following{/other_user}","gists_url":"https://api.github.com/users/Tolriq/gists{/gist_id}","starred_url":"https://api.github.com/users/Tolriq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tolriq/subscriptions","organizations_url":"https://api.github.com/users/Tolriq/orgs","repos_url":"https://api.github.com/users/Tolriq/repos","events_url":"https://api.github.com/users/Tolriq/events{/privacy}","received_events_url":"https://api.github.com/users/Tolriq/received_events","type":"User","site_admin":false},"created_at":"2015-05-18T13:40:10Z","updated_at":"2015-05-18T13:40:10Z","body":"@swankjesse  Thanks :( \r\n\r\nI'm not an licensing expert, is it ok to copy paste this part of the code in closed source application ? There's already disclaimers and everything for using okhttp library."}}