{"action":"created","comment":{"url":"https://api.github.com/repos/wilson0xb4/http-server/pulls/comments/33878574","id":33878574,"diff_hunk":"@@ -0,0 +1,58 @@\n+import server\n+\n+\n+def start_server(conn, addr):\n+    \"\"\"Start server and begin loop to accept requests.\n+\n+    While in loop, server will respond to appropriate HTTP requests with\n+    a valid resonpse, logging requests to standard out.\n+    \"\"\"\n+\n+    while True:\n+        accum = []\n+        try:\n+            while True:\n+                request = conn.recv(64)\n+                accum.append(request)\n+                if len(request) < 64:\n+                    break\n+            request_text = b''.join(accum)\n+            print request_text\n+\n+            response = b''\n+\n+            try:\n+                uri = server.parse_request(request_text)\n+                body, content_type = server.resolve_uri(uri)\n+                response = server.response_ok(body, content_type)\n+            except SyntaxError as e:\n+                response = server.response_error(400, e.message)\n+            except NotImplementedError as e:\n+                response = server.response_error(405, e.message)\n+            except KeyError as e:\n+                response = server.response_error(400, e.message)\n+            except ValueError as e:\n+                response = server.response_error(403, e.message)\n+            except LookupError as e:\n+                response = server.response_error(404, e.message)\n+","path":"gen_server.py","position":38,"original_position":38,"commit_id":"10e5c9b64a528221cf6192c9ad3bf2384cedcc8e","original_commit_id":"10e5c9b64a528221cf6192c9ad3bf2384cedcc8e","user":{"login":"jonathanstallings","id":10945369,"avatar_url":"https://avatars.githubusercontent.com/u/10945369?v=3","gravatar_id":"","url":"https://api.github.com/users/jonathanstallings","html_url":"https://github.com/jonathanstallings","followers_url":"https://api.github.com/users/jonathanstallings/followers","following_url":"https://api.github.com/users/jonathanstallings/following{/other_user}","gists_url":"https://api.github.com/users/jonathanstallings/gists{/gist_id}","starred_url":"https://api.github.com/users/jonathanstallings/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonathanstallings/subscriptions","organizations_url":"https://api.github.com/users/jonathanstallings/orgs","repos_url":"https://api.github.com/users/jonathanstallings/repos","events_url":"https://api.github.com/users/jonathanstallings/events{/privacy}","received_events_url":"https://api.github.com/users/jonathanstallings/received_events","type":"User","site_admin":false},"body":"Wow! Very good point. Thank you, Cris.","created_at":"2015-07-03T19:28:43Z","updated_at":"2015-07-03T19:28:43Z","html_url":"https://github.com/wilson0xb4/http-server/pull/5#discussion_r33878574","pull_request_url":"https://api.github.com/repos/wilson0xb4/http-server/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/wilson0xb4/http-server/pulls/comments/33878574"},"html":{"href":"https://github.com/wilson0xb4/http-server/pull/5#discussion_r33878574"},"pull_request":{"href":"https://api.github.com/repos/wilson0xb4/http-server/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/wilson0xb4/http-server/pulls/5","id":39139243,"html_url":"https://github.com/wilson0xb4/http-server/pull/5","diff_url":"https://github.com/wilson0xb4/http-server/pull/5.diff","patch_url":"https://github.com/wilson0xb4/http-server/pull/5.patch","issue_url":"https://api.github.com/repos/wilson0xb4/http-server/issues/5","number":5,"state":"open","locked":false,"title":"Concurrency","user":{"login":"wilson0xb4","id":1644683,"avatar_url":"https://avatars.githubusercontent.com/u/1644683?v=3","gravatar_id":"","url":"https://api.github.com/users/wilson0xb4","html_url":"https://github.com/wilson0xb4","followers_url":"https://api.github.com/users/wilson0xb4/followers","following_url":"https://api.github.com/users/wilson0xb4/following{/other_user}","gists_url":"https://api.github.com/users/wilson0xb4/gists{/gist_id}","starred_url":"https://api.github.com/users/wilson0xb4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilson0xb4/subscriptions","organizations_url":"https://api.github.com/users/wilson0xb4/orgs","repos_url":"https://api.github.com/users/wilson0xb4/repos","events_url":"https://api.github.com/users/wilson0xb4/events{/privacy}","received_events_url":"https://api.github.com/users/wilson0xb4/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-07-03T01:12:31Z","updated_at":"2015-07-03T19:28:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4a63f186e2872fafebec7f0dc8fb91adf8aea41a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/wilson0xb4/http-server/pulls/5/commits","review_comments_url":"https://api.github.com/repos/wilson0xb4/http-server/pulls/5/comments","review_comment_url":"https://api.github.com/repos/wilson0xb4/http-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wilson0xb4/http-server/issues/5/comments","statuses_url":"https://api.github.com/repos/wilson0xb4/http-server/statuses/10e5c9b64a528221cf6192c9ad3bf2384cedcc8e","head":{"label":"wilson0xb4:concurrency","ref":"concurrency","sha":"10e5c9b64a528221cf6192c9ad3bf2384cedcc8e","user":{"login":"wilson0xb4","id":1644683,"avatar_url":"https://avatars.githubusercontent.com/u/1644683?v=3","gravatar_id":"","url":"https://api.github.com/users/wilson0xb4","html_url":"https://github.com/wilson0xb4","followers_url":"https://api.github.com/users/wilson0xb4/followers","following_url":"https://api.github.com/users/wilson0xb4/following{/other_user}","gists_url":"https://api.github.com/users/wilson0xb4/gists{/gist_id}","starred_url":"https://api.github.com/users/wilson0xb4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilson0xb4/subscriptions","organizations_url":"https://api.github.com/users/wilson0xb4/orgs","repos_url":"https://api.github.com/users/wilson0xb4/repos","events_url":"https://api.github.com/users/wilson0xb4/events{/privacy}","received_events_url":"https://api.github.com/users/wilson0xb4/received_events","type":"User","site_admin":false},"repo":{"id":38271903,"name":"http-server","full_name":"wilson0xb4/http-server","owner":{"login":"wilson0xb4","id":1644683,"avatar_url":"https://avatars.githubusercontent.com/u/1644683?v=3","gravatar_id":"","url":"https://api.github.com/users/wilson0xb4","html_url":"https://github.com/wilson0xb4","followers_url":"https://api.github.com/users/wilson0xb4/followers","following_url":"https://api.github.com/users/wilson0xb4/following{/other_user}","gists_url":"https://api.github.com/users/wilson0xb4/gists{/gist_id}","starred_url":"https://api.github.com/users/wilson0xb4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilson0xb4/subscriptions","organizations_url":"https://api.github.com/users/wilson0xb4/orgs","repos_url":"https://api.github.com/users/wilson0xb4/repos","events_url":"https://api.github.com/users/wilson0xb4/events{/privacy}","received_events_url":"https://api.github.com/users/wilson0xb4/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wilson0xb4/http-server","description":"A simple HTTP server in Python","fork":false,"url":"https://api.github.com/repos/wilson0xb4/http-server","forks_url":"https://api.github.com/repos/wilson0xb4/http-server/forks","keys_url":"https://api.github.com/repos/wilson0xb4/http-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wilson0xb4/http-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wilson0xb4/http-server/teams","hooks_url":"https://api.github.com/repos/wilson0xb4/http-server/hooks","issue_events_url":"https://api.github.com/repos/wilson0xb4/http-server/issues/events{/number}","events_url":"https://api.github.com/repos/wilson0xb4/http-server/events","assignees_url":"https://api.github.com/repos/wilson0xb4/http-server/assignees{/user}","branches_url":"https://api.github.com/repos/wilson0xb4/http-server/branches{/branch}","tags_url":"https://api.github.com/repos/wilson0xb4/http-server/tags","blobs_url":"https://api.github.com/repos/wilson0xb4/http-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wilson0xb4/http-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wilson0xb4/http-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/wilson0xb4/http-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wilson0xb4/http-server/statuses/{sha}","languages_url":"https://api.github.com/repos/wilson0xb4/http-server/languages","stargazers_url":"https://api.github.com/repos/wilson0xb4/http-server/stargazers","contributors_url":"https://api.github.com/repos/wilson0xb4/http-server/contributors","subscribers_url":"https://api.github.com/repos/wilson0xb4/http-server/subscribers","subscription_url":"https://api.github.com/repos/wilson0xb4/http-server/subscription","commits_url":"https://api.github.com/repos/wilson0xb4/http-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/wilson0xb4/http-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/wilson0xb4/http-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/wilson0xb4/http-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/wilson0xb4/http-server/contents/{+path}","compare_url":"https://api.github.com/repos/wilson0xb4/http-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wilson0xb4/http-server/merges","archive_url":"https://api.github.com/repos/wilson0xb4/http-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wilson0xb4/http-server/downloads","issues_url":"https://api.github.com/repos/wilson0xb4/http-server/issues{/number}","pulls_url":"https://api.github.com/repos/wilson0xb4/http-server/pulls{/number}","milestones_url":"https://api.github.com/repos/wilson0xb4/http-server/milestones{/number}","notifications_url":"https://api.github.com/repos/wilson0xb4/http-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wilson0xb4/http-server/labels{/name}","releases_url":"https://api.github.com/repos/wilson0xb4/http-server/releases{/id}","created_at":"2015-06-29T21:18:35Z","updated_at":"2015-06-30T01:08:01Z","pushed_at":"2015-07-03T01:12:31Z","git_url":"git://github.com/wilson0xb4/http-server.git","ssh_url":"git@github.com:wilson0xb4/http-server.git","clone_url":"https://github.com/wilson0xb4/http-server.git","svn_url":"https://github.com/wilson0xb4/http-server","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"wilson0xb4:master","ref":"master","sha":"628961c5c945795edfea317b9d0bac66d688644d","user":{"login":"wilson0xb4","id":1644683,"avatar_url":"https://avatars.githubusercontent.com/u/1644683?v=3","gravatar_id":"","url":"https://api.github.com/users/wilson0xb4","html_url":"https://github.com/wilson0xb4","followers_url":"https://api.github.com/users/wilson0xb4/followers","following_url":"https://api.github.com/users/wilson0xb4/following{/other_user}","gists_url":"https://api.github.com/users/wilson0xb4/gists{/gist_id}","starred_url":"https://api.github.com/users/wilson0xb4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilson0xb4/subscriptions","organizations_url":"https://api.github.com/users/wilson0xb4/orgs","repos_url":"https://api.github.com/users/wilson0xb4/repos","events_url":"https://api.github.com/users/wilson0xb4/events{/privacy}","received_events_url":"https://api.github.com/users/wilson0xb4/received_events","type":"User","site_admin":false},"repo":{"id":38271903,"name":"http-server","full_name":"wilson0xb4/http-server","owner":{"login":"wilson0xb4","id":1644683,"avatar_url":"https://avatars.githubusercontent.com/u/1644683?v=3","gravatar_id":"","url":"https://api.github.com/users/wilson0xb4","html_url":"https://github.com/wilson0xb4","followers_url":"https://api.github.com/users/wilson0xb4/followers","following_url":"https://api.github.com/users/wilson0xb4/following{/other_user}","gists_url":"https://api.github.com/users/wilson0xb4/gists{/gist_id}","starred_url":"https://api.github.com/users/wilson0xb4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilson0xb4/subscriptions","organizations_url":"https://api.github.com/users/wilson0xb4/orgs","repos_url":"https://api.github.com/users/wilson0xb4/repos","events_url":"https://api.github.com/users/wilson0xb4/events{/privacy}","received_events_url":"https://api.github.com/users/wilson0xb4/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wilson0xb4/http-server","description":"A simple HTTP server in Python","fork":false,"url":"https://api.github.com/repos/wilson0xb4/http-server","forks_url":"https://api.github.com/repos/wilson0xb4/http-server/forks","keys_url":"https://api.github.com/repos/wilson0xb4/http-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wilson0xb4/http-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wilson0xb4/http-server/teams","hooks_url":"https://api.github.com/repos/wilson0xb4/http-server/hooks","issue_events_url":"https://api.github.com/repos/wilson0xb4/http-server/issues/events{/number}","events_url":"https://api.github.com/repos/wilson0xb4/http-server/events","assignees_url":"https://api.github.com/repos/wilson0xb4/http-server/assignees{/user}","branches_url":"https://api.github.com/repos/wilson0xb4/http-server/branches{/branch}","tags_url":"https://api.github.com/repos/wilson0xb4/http-server/tags","blobs_url":"https://api.github.com/repos/wilson0xb4/http-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wilson0xb4/http-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wilson0xb4/http-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/wilson0xb4/http-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wilson0xb4/http-server/statuses/{sha}","languages_url":"https://api.github.com/repos/wilson0xb4/http-server/languages","stargazers_url":"https://api.github.com/repos/wilson0xb4/http-server/stargazers","contributors_url":"https://api.github.com/repos/wilson0xb4/http-server/contributors","subscribers_url":"https://api.github.com/repos/wilson0xb4/http-server/subscribers","subscription_url":"https://api.github.com/repos/wilson0xb4/http-server/subscription","commits_url":"https://api.github.com/repos/wilson0xb4/http-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/wilson0xb4/http-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/wilson0xb4/http-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/wilson0xb4/http-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/wilson0xb4/http-server/contents/{+path}","compare_url":"https://api.github.com/repos/wilson0xb4/http-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wilson0xb4/http-server/merges","archive_url":"https://api.github.com/repos/wilson0xb4/http-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wilson0xb4/http-server/downloads","issues_url":"https://api.github.com/repos/wilson0xb4/http-server/issues{/number}","pulls_url":"https://api.github.com/repos/wilson0xb4/http-server/pulls{/number}","milestones_url":"https://api.github.com/repos/wilson0xb4/http-server/milestones{/number}","notifications_url":"https://api.github.com/repos/wilson0xb4/http-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wilson0xb4/http-server/labels{/name}","releases_url":"https://api.github.com/repos/wilson0xb4/http-server/releases{/id}","created_at":"2015-06-29T21:18:35Z","updated_at":"2015-06-30T01:08:01Z","pushed_at":"2015-07-03T01:12:31Z","git_url":"git://github.com/wilson0xb4/http-server.git","ssh_url":"git@github.com:wilson0xb4/http-server.git","clone_url":"https://github.com/wilson0xb4/http-server.git","svn_url":"https://github.com/wilson0xb4/http-server","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wilson0xb4/http-server/pulls/5"},"html":{"href":"https://github.com/wilson0xb4/http-server/pull/5"},"issue":{"href":"https://api.github.com/repos/wilson0xb4/http-server/issues/5"},"comments":{"href":"https://api.github.com/repos/wilson0xb4/http-server/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/wilson0xb4/http-server/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/wilson0xb4/http-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wilson0xb4/http-server/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/wilson0xb4/http-server/statuses/10e5c9b64a528221cf6192c9ad3bf2384cedcc8e"}}}}