{"action":"created","comment":{"url":"https://api.github.com/repos/django/django/pulls/comments/24492970","id":24492970,"diff_hunk":"@@ -33,6 +33,12 @@\n RFC3986_GENDELIMS = str(\":/?#[]@\")\n RFC3986_SUBDELIMS = str(\"!$&'()*+,;=\")\n \n+PROTOCOL_TO_PORT = {\n+    'http': 80,\n+    'https': 443,\n+    'ftp': 21,","path":"django/utils/http.py","position":7,"original_position":7,"commit_id":"85c74ffb7190ebfdc53bbdd3bd82061803c78f00","original_commit_id":"85c74ffb7190ebfdc53bbdd3bd82061803c78f00","user":{"login":"lukasklein","id":1492869,"avatar_url":"https://avatars.githubusercontent.com/u/1492869?v=3","gravatar_id":"","url":"https://api.github.com/users/lukasklein","html_url":"https://github.com/lukasklein","followers_url":"https://api.github.com/users/lukasklein/followers","following_url":"https://api.github.com/users/lukasklein/following{/other_user}","gists_url":"https://api.github.com/users/lukasklein/gists{/gist_id}","starred_url":"https://api.github.com/users/lukasklein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukasklein/subscriptions","organizations_url":"https://api.github.com/users/lukasklein/orgs","repos_url":"https://api.github.com/users/lukasklein/repos","events_url":"https://api.github.com/users/lukasklein/events{/privacy}","received_events_url":"https://api.github.com/users/lukasklein/received_events","type":"User","site_admin":false},"body":"The only protocols serving a Django site should be http and https indeed. For the sake of performance, should we still use `socket.getservbyname()` or can we stick with the hard-coded dict? I mean, how often have the http and https ports changed [in the time since Django exists]?","created_at":"2015-02-11T13:06:11Z","updated_at":"2015-02-11T13:06:11Z","html_url":"https://github.com/django/django/pull/4108#discussion_r24492970","pull_request_url":"https://api.github.com/repos/django/django/pulls/4108","_links":{"self":{"href":"https://api.github.com/repos/django/django/pulls/comments/24492970"},"html":{"href":"https://github.com/django/django/pull/4108#discussion_r24492970"},"pull_request":{"href":"https://api.github.com/repos/django/django/pulls/4108"}}},"pull_request":{"url":"https://api.github.com/repos/django/django/pulls/4108","id":29079878,"html_url":"https://github.com/django/django/pull/4108","diff_url":"https://github.com/django/django/pull/4108.diff","patch_url":"https://github.com/django/django/pull/4108.patch","issue_url":"https://api.github.com/repos/django/django/issues/4108","number":4108,"state":"open","locked":false,"title":"Fix `utils.http.same_origin` to comply with RFC6454 (Trac #24321)","user":{"login":"lukasklein","id":1492869,"avatar_url":"https://avatars.githubusercontent.com/u/1492869?v=3","gravatar_id":"","url":"https://api.github.com/users/lukasklein","html_url":"https://github.com/lukasklein","followers_url":"https://api.github.com/users/lukasklein/followers","following_url":"https://api.github.com/users/lukasklein/following{/other_user}","gists_url":"https://api.github.com/users/lukasklein/gists{/gist_id}","starred_url":"https://api.github.com/users/lukasklein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukasklein/subscriptions","organizations_url":"https://api.github.com/users/lukasklein/orgs","repos_url":"https://api.github.com/users/lukasklein/repos","events_url":"https://api.github.com/users/lukasklein/events{/privacy}","received_events_url":"https://api.github.com/users/lukasklein/received_events","type":"User","site_admin":false},"body":"Trac Ticket: https://code.djangoproject.com/ticket/24321#ticket\r\n\r\nAccording to RFC6454 (http://tools.ietf.org/html/rfc6454#section-3.2.1) this should both be true:\r\n\r\n```python\r\n>>> from django.utils.http import same_origin\r\n>>> same_origin('http://google.com', 'http://google.com')\r\nTrue\r\n>>> same_origin('http://google.com', 'http://google.com:80')\r\nFalse\r\n```\r\n\r\nQuote:\r\n> All of the following resources have the same origin:\r\n>\r\n>   http://example.com/\r\n>   http://example.com:80/\r\n>   http://example.com/path/file\r\n>\r\n>   Each of the URIs has the same scheme, host, and port components.\r\n\r\nDjango's `same_origin` uses the standard urllib, which will return an empty port if none is explicitly specified, which is why I have extended the `same_origin` method to use a protocol-to-port-mapping if no port is explicitly declared.","created_at":"2015-02-11T10:20:29Z","updated_at":"2015-02-11T13:06:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9954e2fb74c68cdc10d49a5607ce9c873d79120c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/django/django/pulls/4108/commits","review_comments_url":"https://api.github.com/repos/django/django/pulls/4108/comments","review_comment_url":"https://api.github.com/repos/django/django/pulls/comments/{number}","comments_url":"https://api.github.com/repos/django/django/issues/4108/comments","statuses_url":"https://api.github.com/repos/django/django/statuses/85c74ffb7190ebfdc53bbdd3bd82061803c78f00","head":{"label":"lukasklein:master","ref":"master","sha":"85c74ffb7190ebfdc53bbdd3bd82061803c78f00","user":{"login":"lukasklein","id":1492869,"avatar_url":"https://avatars.githubusercontent.com/u/1492869?v=3","gravatar_id":"","url":"https://api.github.com/users/lukasklein","html_url":"https://github.com/lukasklein","followers_url":"https://api.github.com/users/lukasklein/followers","following_url":"https://api.github.com/users/lukasklein/following{/other_user}","gists_url":"https://api.github.com/users/lukasklein/gists{/gist_id}","starred_url":"https://api.github.com/users/lukasklein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukasklein/subscriptions","organizations_url":"https://api.github.com/users/lukasklein/orgs","repos_url":"https://api.github.com/users/lukasklein/repos","events_url":"https://api.github.com/users/lukasklein/events{/privacy}","received_events_url":"https://api.github.com/users/lukasklein/received_events","type":"User","site_admin":false},"repo":{"id":30640808,"name":"django","full_name":"lukasklein/django","owner":{"login":"lukasklein","id":1492869,"avatar_url":"https://avatars.githubusercontent.com/u/1492869?v=3","gravatar_id":"","url":"https://api.github.com/users/lukasklein","html_url":"https://github.com/lukasklein","followers_url":"https://api.github.com/users/lukasklein/followers","following_url":"https://api.github.com/users/lukasklein/following{/other_user}","gists_url":"https://api.github.com/users/lukasklein/gists{/gist_id}","starred_url":"https://api.github.com/users/lukasklein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukasklein/subscriptions","organizations_url":"https://api.github.com/users/lukasklein/orgs","repos_url":"https://api.github.com/users/lukasklein/repos","events_url":"https://api.github.com/users/lukasklein/events{/privacy}","received_events_url":"https://api.github.com/users/lukasklein/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lukasklein/django","description":"The Web framework for perfectionists with deadlines.","fork":true,"url":"https://api.github.com/repos/lukasklein/django","forks_url":"https://api.github.com/repos/lukasklein/django/forks","keys_url":"https://api.github.com/repos/lukasklein/django/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lukasklein/django/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lukasklein/django/teams","hooks_url":"https://api.github.com/repos/lukasklein/django/hooks","issue_events_url":"https://api.github.com/repos/lukasklein/django/issues/events{/number}","events_url":"https://api.github.com/repos/lukasklein/django/events","assignees_url":"https://api.github.com/repos/lukasklein/django/assignees{/user}","branches_url":"https://api.github.com/repos/lukasklein/django/branches{/branch}","tags_url":"https://api.github.com/repos/lukasklein/django/tags","blobs_url":"https://api.github.com/repos/lukasklein/django/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lukasklein/django/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lukasklein/django/git/refs{/sha}","trees_url":"https://api.github.com/repos/lukasklein/django/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lukasklein/django/statuses/{sha}","languages_url":"https://api.github.com/repos/lukasklein/django/languages","stargazers_url":"https://api.github.com/repos/lukasklein/django/stargazers","contributors_url":"https://api.github.com/repos/lukasklein/django/contributors","subscribers_url":"https://api.github.com/repos/lukasklein/django/subscribers","subscription_url":"https://api.github.com/repos/lukasklein/django/subscription","commits_url":"https://api.github.com/repos/lukasklein/django/commits{/sha}","git_commits_url":"https://api.github.com/repos/lukasklein/django/git/commits{/sha}","comments_url":"https://api.github.com/repos/lukasklein/django/comments{/number}","issue_comment_url":"https://api.github.com/repos/lukasklein/django/issues/comments/{number}","contents_url":"https://api.github.com/repos/lukasklein/django/contents/{+path}","compare_url":"https://api.github.com/repos/lukasklein/django/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lukasklein/django/merges","archive_url":"https://api.github.com/repos/lukasklein/django/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lukasklein/django/downloads","issues_url":"https://api.github.com/repos/lukasklein/django/issues{/number}","pulls_url":"https://api.github.com/repos/lukasklein/django/pulls{/number}","milestones_url":"https://api.github.com/repos/lukasklein/django/milestones{/number}","notifications_url":"https://api.github.com/repos/lukasklein/django/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lukasklein/django/labels{/name}","releases_url":"https://api.github.com/repos/lukasklein/django/releases{/id}","created_at":"2015-02-11T09:39:48Z","updated_at":"2015-02-11T10:10:16Z","pushed_at":"2015-02-11T10:10:15Z","git_url":"git://github.com/lukasklein/django.git","ssh_url":"git@github.com:lukasklein/django.git","clone_url":"https://github.com/lukasklein/django.git","svn_url":"https://github.com/lukasklein/django","homepage":"https://www.djangoproject.com/","size":255238,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"django:master","ref":"master","sha":"19188826b4aa989475418f1ea9bf8631b04da1e8","user":{"login":"django","id":27804,"avatar_url":"https://avatars.githubusercontent.com/u/27804?v=3","gravatar_id":"","url":"https://api.github.com/users/django","html_url":"https://github.com/django","followers_url":"https://api.github.com/users/django/followers","following_url":"https://api.github.com/users/django/following{/other_user}","gists_url":"https://api.github.com/users/django/gists{/gist_id}","starred_url":"https://api.github.com/users/django/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/django/subscriptions","organizations_url":"https://api.github.com/users/django/orgs","repos_url":"https://api.github.com/users/django/repos","events_url":"https://api.github.com/users/django/events{/privacy}","received_events_url":"https://api.github.com/users/django/received_events","type":"Organization","site_admin":false},"repo":{"id":4164482,"name":"django","full_name":"django/django","owner":{"login":"django","id":27804,"avatar_url":"https://avatars.githubusercontent.com/u/27804?v=3","gravatar_id":"","url":"https://api.github.com/users/django","html_url":"https://github.com/django","followers_url":"https://api.github.com/users/django/followers","following_url":"https://api.github.com/users/django/following{/other_user}","gists_url":"https://api.github.com/users/django/gists{/gist_id}","starred_url":"https://api.github.com/users/django/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/django/subscriptions","organizations_url":"https://api.github.com/users/django/orgs","repos_url":"https://api.github.com/users/django/repos","events_url":"https://api.github.com/users/django/events{/privacy}","received_events_url":"https://api.github.com/users/django/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/django/django","description":"The Web framework for perfectionists with deadlines.","fork":false,"url":"https://api.github.com/repos/django/django","forks_url":"https://api.github.com/repos/django/django/forks","keys_url":"https://api.github.com/repos/django/django/keys{/key_id}","collaborators_url":"https://api.github.com/repos/django/django/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/django/django/teams","hooks_url":"https://api.github.com/repos/django/django/hooks","issue_events_url":"https://api.github.com/repos/django/django/issues/events{/number}","events_url":"https://api.github.com/repos/django/django/events","assignees_url":"https://api.github.com/repos/django/django/assignees{/user}","branches_url":"https://api.github.com/repos/django/django/branches{/branch}","tags_url":"https://api.github.com/repos/django/django/tags","blobs_url":"https://api.github.com/repos/django/django/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/django/django/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/django/django/git/refs{/sha}","trees_url":"https://api.github.com/repos/django/django/git/trees{/sha}","statuses_url":"https://api.github.com/repos/django/django/statuses/{sha}","languages_url":"https://api.github.com/repos/django/django/languages","stargazers_url":"https://api.github.com/repos/django/django/stargazers","contributors_url":"https://api.github.com/repos/django/django/contributors","subscribers_url":"https://api.github.com/repos/django/django/subscribers","subscription_url":"https://api.github.com/repos/django/django/subscription","commits_url":"https://api.github.com/repos/django/django/commits{/sha}","git_commits_url":"https://api.github.com/repos/django/django/git/commits{/sha}","comments_url":"https://api.github.com/repos/django/django/comments{/number}","issue_comment_url":"https://api.github.com/repos/django/django/issues/comments/{number}","contents_url":"https://api.github.com/repos/django/django/contents/{+path}","compare_url":"https://api.github.com/repos/django/django/compare/{base}...{head}","merges_url":"https://api.github.com/repos/django/django/merges","archive_url":"https://api.github.com/repos/django/django/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/django/django/downloads","issues_url":"https://api.github.com/repos/django/django/issues{/number}","pulls_url":"https://api.github.com/repos/django/django/pulls{/number}","milestones_url":"https://api.github.com/repos/django/django/milestones{/number}","notifications_url":"https://api.github.com/repos/django/django/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/django/django/labels{/name}","releases_url":"https://api.github.com/repos/django/django/releases{/id}","created_at":"2012-04-28T02:47:18Z","updated_at":"2015-02-11T12:58:48Z","pushed_at":"2015-02-11T01:17:21Z","git_url":"git://github.com/django/django.git","ssh_url":"git@github.com:django/django.git","clone_url":"https://github.com/django/django.git","svn_url":"https://github.com/django/django","homepage":"https://www.djangoproject.com/","size":255238,"stargazers_count":12895,"watchers_count":12895,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5031,"mirror_url":null,"open_issues_count":90,"forks":5031,"open_issues":90,"watchers":12895,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/django/django/pulls/4108"},"html":{"href":"https://github.com/django/django/pull/4108"},"issue":{"href":"https://api.github.com/repos/django/django/issues/4108"},"comments":{"href":"https://api.github.com/repos/django/django/issues/4108/comments"},"review_comments":{"href":"https://api.github.com/repos/django/django/pulls/4108/comments"},"review_comment":{"href":"https://api.github.com/repos/django/django/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/django/django/pulls/4108/commits"},"statuses":{"href":"https://api.github.com/repos/django/django/statuses/85c74ffb7190ebfdc53bbdd3bd82061803c78f00"}}}}