{"action":"created","comment":{"url":"https://api.github.com/repos/aws/aws-sdk-go/pulls/comments/41388803","id":41388803,"diff_hunk":"@@ -0,0 +1,167 @@\n+package v2\n+\n+import (\n+\t\"crypto/hmac\"\n+\t\"crypto/sha256\"\n+\t\"encoding/base64\"\n+\t\"errors\"\n+\t\"fmt\"\n+\t\"net/http\"\n+\t\"net/url\"\n+\t\"sort\"\n+\t\"strings\"\n+\t\"time\"\n+\n+\t\"github.com/aws/aws-sdk-go/aws\"\n+\t\"github.com/aws/aws-sdk-go/aws/credentials\"\n+\t\"github.com/aws/aws-sdk-go/aws/request\"\n+)\n+\n+var (\n+\terrInvalidMethod = errors.New(\"v2 signer only handles HTTP POST\")\n+)\n+\n+const (\n+\tsignatureVersion = \"2\"\n+\tsignatureMethod  = \"HmacSHA256\"\n+\ttimeFormat       = \"2006-01-02T15:04:05Z\"\n+)\n+\n+type signer struct {\n+\t// Values that must be populated from the request\n+\tRequest     *http.Request\n+\tTime        time.Time\n+\tCredentials *credentials.Credentials\n+\tDebug       aws.LogLevelType\n+\tLogger      aws.Logger\n+\n+\tQuery        url.Values\n+\tstringToSign string\n+\tsignature    string\n+}\n+\n+// Sign requests with signature version 2.\n+//\n+// Will sign the requests with the service config's Credentials object\n+// Signing is skipped if the credentials is the credentials.AnonymousCredentials\n+// object.\n+func Sign(req *request.Request) {\n+\t// If the request does not need to be signed ignore the signing of the\n+\t// request if the AnonymousCredentials object is used.\n+\tif req.Service.Config.Credentials == credentials.AnonymousCredentials {\n+\t\treturn\n+\t}\n+\n+\tif req.HTTPRequest.Method != \"POST\" {\n+\t\t// The V2 signer is legacy and only used for SimpleDB.\n+\t\t// Given that SimpleDB only uses POST, this signer is the same.\n+\t\treq.Error = errInvalidMethod","path":"internal/signer/v2/v2.go","position":58,"original_position":58,"commit_id":"cbf6ae4c87f125caa86b2e9aec0a94191b711c63","original_commit_id":"cbf6ae4c87f125caa86b2e9aec0a94191b711c63","user":{"login":"jasdel","id":961963,"avatar_url":"https://avatars.githubusercontent.com/u/961963?v=3","gravatar_id":"","url":"https://api.github.com/users/jasdel","html_url":"https://github.com/jasdel","followers_url":"https://api.github.com/users/jasdel/followers","following_url":"https://api.github.com/users/jasdel/following{/other_user}","gists_url":"https://api.github.com/users/jasdel/gists{/gist_id}","starred_url":"https://api.github.com/users/jasdel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasdel/subscriptions","organizations_url":"https://api.github.com/users/jasdel/orgs","repos_url":"https://api.github.com/users/jasdel/repos","events_url":"https://api.github.com/users/jasdel/events{/privacy}","received_events_url":"https://api.github.com/users/jasdel/received_events","type":"User","site_admin":false},"body":"We can probably remove this if check since it's not apart of the v2 signing.\r\n\r\nWhile true we only plan to use the signer internally for SimpleDB support. If in the future someone wrote their code to connect to an s3 compatible service with the v2 signer they would only be able to make POST requests.\r\n","created_at":"2015-10-07T13:24:21Z","updated_at":"2015-10-07T13:24:21Z","html_url":"https://github.com/aws/aws-sdk-go/pull/316#discussion_r41388803","pull_request_url":"https://api.github.com/repos/aws/aws-sdk-go/pulls/316","_links":{"self":{"href":"https://api.github.com/repos/aws/aws-sdk-go/pulls/comments/41388803"},"html":{"href":"https://github.com/aws/aws-sdk-go/pull/316#discussion_r41388803"},"pull_request":{"href":"https://api.github.com/repos/aws/aws-sdk-go/pulls/316"}}},"pull_request":{"url":"https://api.github.com/repos/aws/aws-sdk-go/pulls/316","id":40117475,"html_url":"https://github.com/aws/aws-sdk-go/pull/316","diff_url":"https://github.com/aws/aws-sdk-go/pull/316.diff","patch_url":"https://github.com/aws/aws-sdk-go/pull/316.patch","issue_url":"https://api.github.com/repos/aws/aws-sdk-go/issues/316","number":316,"state":"open","locked":false,"title":"Implement V2 signing and add simpledb.","user":{"login":"jjeffery","id":458924,"avatar_url":"https://avatars.githubusercontent.com/u/458924?v=3","gravatar_id":"","url":"https://api.github.com/users/jjeffery","html_url":"https://github.com/jjeffery","followers_url":"https://api.github.com/users/jjeffery/followers","following_url":"https://api.github.com/users/jjeffery/following{/other_user}","gists_url":"https://api.github.com/users/jjeffery/gists{/gist_id}","starred_url":"https://api.github.com/users/jjeffery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjeffery/subscriptions","organizations_url":"https://api.github.com/users/jjeffery/orgs","repos_url":"https://api.github.com/users/jjeffery/repos","events_url":"https://api.github.com/users/jjeffery/events{/privacy}","received_events_url":"https://api.github.com/users/jjeffery/received_events","type":"User","site_admin":false},"body":"This pull request adds an implementation of V2 signing and includes the simpledb service.\r\n\r\nResolves #70.","created_at":"2015-07-16T11:01:38Z","updated_at":"2015-10-07T13:24:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ffd9d77ada06da91cb779ca595b9452f2a361b5f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/aws/aws-sdk-go/pulls/316/commits","review_comments_url":"https://api.github.com/repos/aws/aws-sdk-go/pulls/316/comments","review_comment_url":"https://api.github.com/repos/aws/aws-sdk-go/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aws/aws-sdk-go/issues/316/comments","statuses_url":"https://api.github.com/repos/aws/aws-sdk-go/statuses/cbf6ae4c87f125caa86b2e9aec0a94191b711c63","head":{"label":"jjeffery:master","ref":"master","sha":"cbf6ae4c87f125caa86b2e9aec0a94191b711c63","user":{"login":"jjeffery","id":458924,"avatar_url":"https://avatars.githubusercontent.com/u/458924?v=3","gravatar_id":"","url":"https://api.github.com/users/jjeffery","html_url":"https://github.com/jjeffery","followers_url":"https://api.github.com/users/jjeffery/followers","following_url":"https://api.github.com/users/jjeffery/following{/other_user}","gists_url":"https://api.github.com/users/jjeffery/gists{/gist_id}","starred_url":"https://api.github.com/users/jjeffery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjeffery/subscriptions","organizations_url":"https://api.github.com/users/jjeffery/orgs","repos_url":"https://api.github.com/users/jjeffery/repos","events_url":"https://api.github.com/users/jjeffery/events{/privacy}","received_events_url":"https://api.github.com/users/jjeffery/received_events","type":"User","site_admin":false},"repo":{"id":39118702,"name":"aws-sdk-go","full_name":"jjeffery/aws-sdk-go","owner":{"login":"jjeffery","id":458924,"avatar_url":"https://avatars.githubusercontent.com/u/458924?v=3","gravatar_id":"","url":"https://api.github.com/users/jjeffery","html_url":"https://github.com/jjeffery","followers_url":"https://api.github.com/users/jjeffery/followers","following_url":"https://api.github.com/users/jjeffery/following{/other_user}","gists_url":"https://api.github.com/users/jjeffery/gists{/gist_id}","starred_url":"https://api.github.com/users/jjeffery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjeffery/subscriptions","organizations_url":"https://api.github.com/users/jjeffery/orgs","repos_url":"https://api.github.com/users/jjeffery/repos","events_url":"https://api.github.com/users/jjeffery/events{/privacy}","received_events_url":"https://api.github.com/users/jjeffery/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jjeffery/aws-sdk-go","description":"AWS SDK for the Go programming language.","fork":true,"url":"https://api.github.com/repos/jjeffery/aws-sdk-go","forks_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/forks","keys_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/teams","hooks_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/hooks","issue_events_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/issues/events{/number}","events_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/events","assignees_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/assignees{/user}","branches_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/branches{/branch}","tags_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/tags","blobs_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/statuses/{sha}","languages_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/languages","stargazers_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/stargazers","contributors_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/contributors","subscribers_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/subscribers","subscription_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/subscription","commits_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/contents/{+path}","compare_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/merges","archive_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/downloads","issues_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/issues{/number}","pulls_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/pulls{/number}","milestones_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/milestones{/number}","notifications_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/labels{/name}","releases_url":"https://api.github.com/repos/jjeffery/aws-sdk-go/releases{/id}","created_at":"2015-07-15T05:47:08Z","updated_at":"2015-07-15T05:47:11Z","pushed_at":"2015-10-07T04:07:20Z","git_url":"git://github.com/jjeffery/aws-sdk-go.git","ssh_url":"git@github.com:jjeffery/aws-sdk-go.git","clone_url":"https://github.com/jjeffery/aws-sdk-go.git","svn_url":"https://github.com/jjeffery/aws-sdk-go","homepage":"http://aws.amazon.com/sdk-for-go/","size":11801,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"aws:master","ref":"master","sha":"890e878e1bf2abba2e0c33e494daf3ca55b2e563","user":{"login":"aws","id":2232217,"avatar_url":"https://avatars.githubusercontent.com/u/2232217?v=3","gravatar_id":"","url":"https://api.github.com/users/aws","html_url":"https://github.com/aws","followers_url":"https://api.github.com/users/aws/followers","following_url":"https://api.github.com/users/aws/following{/other_user}","gists_url":"https://api.github.com/users/aws/gists{/gist_id}","starred_url":"https://api.github.com/users/aws/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aws/subscriptions","organizations_url":"https://api.github.com/users/aws/orgs","repos_url":"https://api.github.com/users/aws/repos","events_url":"https://api.github.com/users/aws/events{/privacy}","received_events_url":"https://api.github.com/users/aws/received_events","type":"Organization","site_admin":false},"repo":{"id":27576132,"name":"aws-sdk-go","full_name":"aws/aws-sdk-go","owner":{"login":"aws","id":2232217,"avatar_url":"https://avatars.githubusercontent.com/u/2232217?v=3","gravatar_id":"","url":"https://api.github.com/users/aws","html_url":"https://github.com/aws","followers_url":"https://api.github.com/users/aws/followers","following_url":"https://api.github.com/users/aws/following{/other_user}","gists_url":"https://api.github.com/users/aws/gists{/gist_id}","starred_url":"https://api.github.com/users/aws/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aws/subscriptions","organizations_url":"https://api.github.com/users/aws/orgs","repos_url":"https://api.github.com/users/aws/repos","events_url":"https://api.github.com/users/aws/events{/privacy}","received_events_url":"https://api.github.com/users/aws/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aws/aws-sdk-go","description":"AWS SDK for the Go programming language.","fork":false,"url":"https://api.github.com/repos/aws/aws-sdk-go","forks_url":"https://api.github.com/repos/aws/aws-sdk-go/forks","keys_url":"https://api.github.com/repos/aws/aws-sdk-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aws/aws-sdk-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aws/aws-sdk-go/teams","hooks_url":"https://api.github.com/repos/aws/aws-sdk-go/hooks","issue_events_url":"https://api.github.com/repos/aws/aws-sdk-go/issues/events{/number}","events_url":"https://api.github.com/repos/aws/aws-sdk-go/events","assignees_url":"https://api.github.com/repos/aws/aws-sdk-go/assignees{/user}","branches_url":"https://api.github.com/repos/aws/aws-sdk-go/branches{/branch}","tags_url":"https://api.github.com/repos/aws/aws-sdk-go/tags","blobs_url":"https://api.github.com/repos/aws/aws-sdk-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aws/aws-sdk-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aws/aws-sdk-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/aws/aws-sdk-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aws/aws-sdk-go/statuses/{sha}","languages_url":"https://api.github.com/repos/aws/aws-sdk-go/languages","stargazers_url":"https://api.github.com/repos/aws/aws-sdk-go/stargazers","contributors_url":"https://api.github.com/repos/aws/aws-sdk-go/contributors","subscribers_url":"https://api.github.com/repos/aws/aws-sdk-go/subscribers","subscription_url":"https://api.github.com/repos/aws/aws-sdk-go/subscription","commits_url":"https://api.github.com/repos/aws/aws-sdk-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/aws/aws-sdk-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/aws/aws-sdk-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/aws/aws-sdk-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/aws/aws-sdk-go/contents/{+path}","compare_url":"https://api.github.com/repos/aws/aws-sdk-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aws/aws-sdk-go/merges","archive_url":"https://api.github.com/repos/aws/aws-sdk-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aws/aws-sdk-go/downloads","issues_url":"https://api.github.com/repos/aws/aws-sdk-go/issues{/number}","pulls_url":"https://api.github.com/repos/aws/aws-sdk-go/pulls{/number}","milestones_url":"https://api.github.com/repos/aws/aws-sdk-go/milestones{/number}","notifications_url":"https://api.github.com/repos/aws/aws-sdk-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aws/aws-sdk-go/labels{/name}","releases_url":"https://api.github.com/repos/aws/aws-sdk-go/releases{/id}","created_at":"2014-12-05T05:29:41Z","updated_at":"2015-10-06T04:27:35Z","pushed_at":"2015-10-07T04:07:21Z","git_url":"git://github.com/aws/aws-sdk-go.git","ssh_url":"git@github.com:aws/aws-sdk-go.git","clone_url":"https://github.com/aws/aws-sdk-go.git","svn_url":"https://github.com/aws/aws-sdk-go","homepage":"http://aws.amazon.com/sdk-for-go/","size":16411,"stargazers_count":1970,"watchers_count":1970,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":236,"mirror_url":null,"open_issues_count":38,"forks":236,"open_issues":38,"watchers":1970,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/aws/aws-sdk-go/pulls/316"},"html":{"href":"https://github.com/aws/aws-sdk-go/pull/316"},"issue":{"href":"https://api.github.com/repos/aws/aws-sdk-go/issues/316"},"comments":{"href":"https://api.github.com/repos/aws/aws-sdk-go/issues/316/comments"},"review_comments":{"href":"https://api.github.com/repos/aws/aws-sdk-go/pulls/316/comments"},"review_comment":{"href":"https://api.github.com/repos/aws/aws-sdk-go/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aws/aws-sdk-go/pulls/316/commits"},"statuses":{"href":"https://api.github.com/repos/aws/aws-sdk-go/statuses/cbf6ae4c87f125caa86b2e9aec0a94191b711c63"}}}}