{"action":"created","comment":{"url":"https://api.github.com/repos/apple/swift-nio/pulls/comments/184692223","pull_request_review_id":115943597,"id":184692223,"diff_hunk":"@@ -115,19 +124,51 @@ public struct HTTPRequestHead: Equatable {\n     }\n }\n \n-/// Internal representation of a URI\n-enum URI {\n-    case string(String)\n-    case byteBuffer(ByteBuffer)\n-}\n+/// Represents the URI component of an `HTTPRequestHead`. Allows the URI\n+/// to be accessed as a `String` or as raw bytes.\n+public struct HTTPURI: ExpressibleByStringLiteral {\n+    /// Internal representation of a URI\n+    enum _Storage {\n+        case string(String)\n+        case byteBuffer(ByteBuffer)\n+    }\n+\n+    /// Internal storage.\n+    private var storage: _Storage\n+\n+    /// Internal init.\n+    internal init(storage: _Storage) {\n+        self.storage = storage\n+    }\n+\n+    /// See `ExpressibleByStringLiteral`.\n+    public init(stringLiteral value: String) {\n+        storage = .string(value)\n+    }\n+\n+    /// Access this `HTTPURI`'s raw bytes.\n+    /// - Parameter closure: A closure accepting an `UnsafeRawBufferPointer` to this URI's raw bytes.","path":"Sources/NIOHTTP1/HTTPTypes.swift","position":102,"original_position":102,"commit_id":"160385058adf1e1689a33b89de41b0c5b3b654e0","original_commit_id":"160385058adf1e1689a33b89de41b0c5b3b654e0","user":{"login":"helje5","id":7712892,"avatar_url":"https://avatars0.githubusercontent.com/u/7712892?v=4","gravatar_id":"","url":"https://api.github.com/users/helje5","html_url":"https://github.com/helje5","followers_url":"https://api.github.com/users/helje5/followers","following_url":"https://api.github.com/users/helje5/following{/other_user}","gists_url":"https://api.github.com/users/helje5/gists{/gist_id}","starred_url":"https://api.github.com/users/helje5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helje5/subscriptions","organizations_url":"https://api.github.com/users/helje5/orgs","repos_url":"https://api.github.com/users/helje5/repos","events_url":"https://api.github.com/users/helje5/events{/privacy}","received_events_url":"https://api.github.com/users/helje5/received_events","type":"User","site_admin":false},"body":"To be honest I still don't understand why you think that this should ever be a String. I would back the HTTPURI by just a ByteBuffer(/Slice). Probably add a `stringValue` property which creates a String on demand for logging and such. Maybe also add a `pathComponents` property (or an iterator) which does the splitting and percent decoding.\r\n\r\nRational: string of a full path never needed except for logging, octet-preservation, zero copy for proxies, one malloc less for the common case.","created_at":"2018-04-27T13:49:01Z","updated_at":"2018-04-27T13:49:01Z","html_url":"https://github.com/apple/swift-nio/pull/355#discussion_r184692223","pull_request_url":"https://api.github.com/repos/apple/swift-nio/pulls/355","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apple/swift-nio/pulls/comments/184692223"},"html":{"href":"https://github.com/apple/swift-nio/pull/355#discussion_r184692223"},"pull_request":{"href":"https://api.github.com/repos/apple/swift-nio/pulls/355"}},"in_reply_to_id":184660048},"pull_request":{"url":"https://api.github.com/repos/apple/swift-nio/pulls/355","id":184126749,"html_url":"https://github.com/apple/swift-nio/pull/355","diff_url":"https://github.com/apple/swift-nio/pull/355.diff","patch_url":"https://github.com/apple/swift-nio/pull/355.patch","issue_url":"https://api.github.com/repos/apple/swift-nio/issues/355","number":355,"state":"open","locked":false,"title":"add HTTPURI for more performant uri access","user":{"login":"tanner0101","id":1342803,"avatar_url":"https://avatars2.githubusercontent.com/u/1342803?v=4","gravatar_id":"","url":"https://api.github.com/users/tanner0101","html_url":"https://github.com/tanner0101","followers_url":"https://api.github.com/users/tanner0101/followers","following_url":"https://api.github.com/users/tanner0101/following{/other_user}","gists_url":"https://api.github.com/users/tanner0101/gists{/gist_id}","starred_url":"https://api.github.com/users/tanner0101/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tanner0101/subscriptions","organizations_url":"https://api.github.com/users/tanner0101/orgs","repos_url":"https://api.github.com/users/tanner0101/repos","events_url":"https://api.github.com/users/tanner0101/events{/privacy}","received_events_url":"https://api.github.com/users/tanner0101/received_events","type":"User","site_admin":false},"body":"Motivation:\r\n\r\nCurrently the only way to access a request head's uri is via a computed property that converts it to a String. The internal storage however is usually a byte buffer. Being able to access the uri bytes without going through String would be a performance win.\r\n\r\nModifications:\r\n\r\nRemoved URI in favor or HTTPURI and internal HTTPURIStorage\r\n\r\nResult:\r\n\r\nHTTP URI can be accessed more performantly.\r\n\r\nSee https://github.com/apple/swift-nio/issues/342","created_at":"2018-04-25T18:38:10Z","updated_at":"2018-04-27T13:49:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"18af6138aaec1d6ede6efda34a45dca9b38fbe58","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apple/swift-nio/pulls/355/commits","review_comments_url":"https://api.github.com/repos/apple/swift-nio/pulls/355/comments","review_comment_url":"https://api.github.com/repos/apple/swift-nio/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apple/swift-nio/issues/355/comments","statuses_url":"https://api.github.com/repos/apple/swift-nio/statuses/160385058adf1e1689a33b89de41b0c5b3b654e0","head":{"label":"tanner0101:uri-storage","ref":"uri-storage","sha":"160385058adf1e1689a33b89de41b0c5b3b654e0","user":{"login":"tanner0101","id":1342803,"avatar_url":"https://avatars2.githubusercontent.com/u/1342803?v=4","gravatar_id":"","url":"https://api.github.com/users/tanner0101","html_url":"https://github.com/tanner0101","followers_url":"https://api.github.com/users/tanner0101/followers","following_url":"https://api.github.com/users/tanner0101/following{/other_user}","gists_url":"https://api.github.com/users/tanner0101/gists{/gist_id}","starred_url":"https://api.github.com/users/tanner0101/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tanner0101/subscriptions","organizations_url":"https://api.github.com/users/tanner0101/orgs","repos_url":"https://api.github.com/users/tanner0101/repos","events_url":"https://api.github.com/users/tanner0101/events{/privacy}","received_events_url":"https://api.github.com/users/tanner0101/received_events","type":"User","site_admin":false},"repo":{"id":131046515,"name":"swift-nio","full_name":"tanner0101/swift-nio","owner":{"login":"tanner0101","id":1342803,"avatar_url":"https://avatars2.githubusercontent.com/u/1342803?v=4","gravatar_id":"","url":"https://api.github.com/users/tanner0101","html_url":"https://github.com/tanner0101","followers_url":"https://api.github.com/users/tanner0101/followers","following_url":"https://api.github.com/users/tanner0101/following{/other_user}","gists_url":"https://api.github.com/users/tanner0101/gists{/gist_id}","starred_url":"https://api.github.com/users/tanner0101/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tanner0101/subscriptions","organizations_url":"https://api.github.com/users/tanner0101/orgs","repos_url":"https://api.github.com/users/tanner0101/repos","events_url":"https://api.github.com/users/tanner0101/events{/privacy}","received_events_url":"https://api.github.com/users/tanner0101/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tanner0101/swift-nio","description":"Event-driven network application framework for high performance protocol servers & clients, non-blocking.","fork":true,"url":"https://api.github.com/repos/tanner0101/swift-nio","forks_url":"https://api.github.com/repos/tanner0101/swift-nio/forks","keys_url":"https://api.github.com/repos/tanner0101/swift-nio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tanner0101/swift-nio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tanner0101/swift-nio/teams","hooks_url":"https://api.github.com/repos/tanner0101/swift-nio/hooks","issue_events_url":"https://api.github.com/repos/tanner0101/swift-nio/issues/events{/number}","events_url":"https://api.github.com/repos/tanner0101/swift-nio/events","assignees_url":"https://api.github.com/repos/tanner0101/swift-nio/assignees{/user}","branches_url":"https://api.github.com/repos/tanner0101/swift-nio/branches{/branch}","tags_url":"https://api.github.com/repos/tanner0101/swift-nio/tags","blobs_url":"https://api.github.com/repos/tanner0101/swift-nio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tanner0101/swift-nio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tanner0101/swift-nio/git/refs{/sha}","trees_url":"https://api.github.com/repos/tanner0101/swift-nio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tanner0101/swift-nio/statuses/{sha}","languages_url":"https://api.github.com/repos/tanner0101/swift-nio/languages","stargazers_url":"https://api.github.com/repos/tanner0101/swift-nio/stargazers","contributors_url":"https://api.github.com/repos/tanner0101/swift-nio/contributors","subscribers_url":"https://api.github.com/repos/tanner0101/swift-nio/subscribers","subscription_url":"https://api.github.com/repos/tanner0101/swift-nio/subscription","commits_url":"https://api.github.com/repos/tanner0101/swift-nio/commits{/sha}","git_commits_url":"https://api.github.com/repos/tanner0101/swift-nio/git/commits{/sha}","comments_url":"https://api.github.com/repos/tanner0101/swift-nio/comments{/number}","issue_comment_url":"https://api.github.com/repos/tanner0101/swift-nio/issues/comments{/number}","contents_url":"https://api.github.com/repos/tanner0101/swift-nio/contents/{+path}","compare_url":"https://api.github.com/repos/tanner0101/swift-nio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tanner0101/swift-nio/merges","archive_url":"https://api.github.com/repos/tanner0101/swift-nio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tanner0101/swift-nio/downloads","issues_url":"https://api.github.com/repos/tanner0101/swift-nio/issues{/number}","pulls_url":"https://api.github.com/repos/tanner0101/swift-nio/pulls{/number}","milestones_url":"https://api.github.com/repos/tanner0101/swift-nio/milestones{/number}","notifications_url":"https://api.github.com/repos/tanner0101/swift-nio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tanner0101/swift-nio/labels{/name}","releases_url":"https://api.github.com/repos/tanner0101/swift-nio/releases{/id}","deployments_url":"https://api.github.com/repos/tanner0101/swift-nio/deployments","created_at":"2018-04-25T18:16:34Z","updated_at":"2018-04-25T18:16:37Z","pushed_at":"2018-04-26T19:44:58Z","git_url":"git://github.com/tanner0101/swift-nio.git","ssh_url":"git@github.com:tanner0101/swift-nio.git","clone_url":"https://github.com/tanner0101/swift-nio.git","svn_url":"https://github.com/tanner0101/swift-nio","homepage":"","size":7323,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apple:master","ref":"master","sha":"6565ec5a394513af90e9f2cc0f29621c1bee0f6c","user":{"login":"apple","id":10639145,"avatar_url":"https://avatars0.githubusercontent.com/u/10639145?v=4","gravatar_id":"","url":"https://api.github.com/users/apple","html_url":"https://github.com/apple","followers_url":"https://api.github.com/users/apple/followers","following_url":"https://api.github.com/users/apple/following{/other_user}","gists_url":"https://api.github.com/users/apple/gists{/gist_id}","starred_url":"https://api.github.com/users/apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apple/subscriptions","organizations_url":"https://api.github.com/users/apple/orgs","repos_url":"https://api.github.com/users/apple/repos","events_url":"https://api.github.com/users/apple/events{/privacy}","received_events_url":"https://api.github.com/users/apple/received_events","type":"Organization","site_admin":false},"repo":{"id":120498971,"name":"swift-nio","full_name":"apple/swift-nio","owner":{"login":"apple","id":10639145,"avatar_url":"https://avatars0.githubusercontent.com/u/10639145?v=4","gravatar_id":"","url":"https://api.github.com/users/apple","html_url":"https://github.com/apple","followers_url":"https://api.github.com/users/apple/followers","following_url":"https://api.github.com/users/apple/following{/other_user}","gists_url":"https://api.github.com/users/apple/gists{/gist_id}","starred_url":"https://api.github.com/users/apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apple/subscriptions","organizations_url":"https://api.github.com/users/apple/orgs","repos_url":"https://api.github.com/users/apple/repos","events_url":"https://api.github.com/users/apple/events{/privacy}","received_events_url":"https://api.github.com/users/apple/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apple/swift-nio","description":"Event-driven network application framework for high performance protocol servers & clients, non-blocking.","fork":false,"url":"https://api.github.com/repos/apple/swift-nio","forks_url":"https://api.github.com/repos/apple/swift-nio/forks","keys_url":"https://api.github.com/repos/apple/swift-nio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apple/swift-nio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apple/swift-nio/teams","hooks_url":"https://api.github.com/repos/apple/swift-nio/hooks","issue_events_url":"https://api.github.com/repos/apple/swift-nio/issues/events{/number}","events_url":"https://api.github.com/repos/apple/swift-nio/events","assignees_url":"https://api.github.com/repos/apple/swift-nio/assignees{/user}","branches_url":"https://api.github.com/repos/apple/swift-nio/branches{/branch}","tags_url":"https://api.github.com/repos/apple/swift-nio/tags","blobs_url":"https://api.github.com/repos/apple/swift-nio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apple/swift-nio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apple/swift-nio/git/refs{/sha}","trees_url":"https://api.github.com/repos/apple/swift-nio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apple/swift-nio/statuses/{sha}","languages_url":"https://api.github.com/repos/apple/swift-nio/languages","stargazers_url":"https://api.github.com/repos/apple/swift-nio/stargazers","contributors_url":"https://api.github.com/repos/apple/swift-nio/contributors","subscribers_url":"https://api.github.com/repos/apple/swift-nio/subscribers","subscription_url":"https://api.github.com/repos/apple/swift-nio/subscription","commits_url":"https://api.github.com/repos/apple/swift-nio/commits{/sha}","git_commits_url":"https://api.github.com/repos/apple/swift-nio/git/commits{/sha}","comments_url":"https://api.github.com/repos/apple/swift-nio/comments{/number}","issue_comment_url":"https://api.github.com/repos/apple/swift-nio/issues/comments{/number}","contents_url":"https://api.github.com/repos/apple/swift-nio/contents/{+path}","compare_url":"https://api.github.com/repos/apple/swift-nio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apple/swift-nio/merges","archive_url":"https://api.github.com/repos/apple/swift-nio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apple/swift-nio/downloads","issues_url":"https://api.github.com/repos/apple/swift-nio/issues{/number}","pulls_url":"https://api.github.com/repos/apple/swift-nio/pulls{/number}","milestones_url":"https://api.github.com/repos/apple/swift-nio/milestones{/number}","notifications_url":"https://api.github.com/repos/apple/swift-nio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apple/swift-nio/labels{/name}","releases_url":"https://api.github.com/repos/apple/swift-nio/releases{/id}","deployments_url":"https://api.github.com/repos/apple/swift-nio/deployments","created_at":"2018-02-06T17:47:31Z","updated_at":"2018-04-27T11:39:23Z","pushed_at":"2018-04-27T11:26:43Z","git_url":"git://github.com/apple/swift-nio.git","ssh_url":"git@github.com:apple/swift-nio.git","clone_url":"https://github.com/apple/swift-nio.git","svn_url":"https://github.com/apple/swift-nio","homepage":"","size":7334,"stargazers_count":3521,"watchers_count":3521,"language":"Swift","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":143,"mirror_url":null,"archived":false,"open_issues_count":49,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":143,"open_issues":49,"watchers":3521,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apple/swift-nio/pulls/355"},"html":{"href":"https://github.com/apple/swift-nio/pull/355"},"issue":{"href":"https://api.github.com/repos/apple/swift-nio/issues/355"},"comments":{"href":"https://api.github.com/repos/apple/swift-nio/issues/355/comments"},"review_comments":{"href":"https://api.github.com/repos/apple/swift-nio/pulls/355/comments"},"review_comment":{"href":"https://api.github.com/repos/apple/swift-nio/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apple/swift-nio/pulls/355/commits"},"statuses":{"href":"https://api.github.com/repos/apple/swift-nio/statuses/160385058adf1e1689a33b89de41b0c5b3b654e0"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"helje5"}}