{"action":"created","comment":{"url":"https://api.github.com/repos/cloudflare/cfssl/pulls/comments/48106321","id":48106321,"diff_hunk":"@@ -159,7 +171,20 @@ func (rs Responder) ServeHTTP(response http.ResponseWriter, request *http.Reques\n \t\treturn\n \t}\n \n+\tparsedResponse, err := ocsp.ParseResponse(ocspResponse, nil)\n+\tif err != nil {\n+\t\tlog.Errorf(\"Error parsing response: %s\", err)\n+\t\tresponse.Write(unauthorizedErrorResponse)\n+\t\treturn\n+\t}\n+\n \t// Write OCSP response to response\n+\tresponse.Header().Add(\"Last-Modified\", parsedResponse.ProducedAt.Format(time.RFC1123))\n+\tresponse.Header().Add(\"Expires\", parsedResponse.NextUpdate.Format(time.RFC1123))\n+\tmaxAge := int64(parsedResponse.NextUpdate.Sub(rs.clk.Now()) / time.Second)\n+\tif maxAge > 0 {\n+\t\tresponse.Header().Add(\"Cache-Control\", fmt.Sprintf(\"max-age=%d\", maxAge))","path":"ocsp/responder.go","position":64,"original_position":64,"commit_id":"041286c8347240d76f16e5ff14fa8b686c279f10","original_commit_id":"041286c8347240d76f16e5ff14fa8b686c279f10","user":{"login":"tbroyer","id":173813,"avatar_url":"https://avatars.githubusercontent.com/u/173813?v=3","gravatar_id":"","url":"https://api.github.com/users/tbroyer","html_url":"https://github.com/tbroyer","followers_url":"https://api.github.com/users/tbroyer/followers","following_url":"https://api.github.com/users/tbroyer/following{/other_user}","gists_url":"https://api.github.com/users/tbroyer/gists{/gist_id}","starred_url":"https://api.github.com/users/tbroyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbroyer/subscriptions","organizations_url":"https://api.github.com/users/tbroyer/orgs","repos_url":"https://api.github.com/users/tbroyer/repos","events_url":"https://api.github.com/users/tbroyer/events{/privacy}","received_events_url":"https://api.github.com/users/tbroyer/received_events","type":"User","site_admin":false},"body":"`Cache-Control` should also include `public,no-transform,must-revalidate`, and the `max-age` should be a bit earlier than `NextUpdate` such that a client observing HTTP cache semantics will refresh before its cached response expires (`NextUpdate`-wise)\r\n\r\nSee https://tools.ietf.org/html/rfc5019#section-6 for details. Note that it also suggests to include an `ETag` and RECOMMENDS a value for it.","created_at":"2015-12-20T18:13:04Z","updated_at":"2015-12-20T18:13:04Z","html_url":"https://github.com/cloudflare/cfssl/pull/425#discussion_r48106321","pull_request_url":"https://api.github.com/repos/cloudflare/cfssl/pulls/425","_links":{"self":{"href":"https://api.github.com/repos/cloudflare/cfssl/pulls/comments/48106321"},"html":{"href":"https://github.com/cloudflare/cfssl/pull/425#discussion_r48106321"},"pull_request":{"href":"https://api.github.com/repos/cloudflare/cfssl/pulls/425"}}},"pull_request":{"url":"https://api.github.com/repos/cloudflare/cfssl/pulls/425","id":50600294,"html_url":"https://github.com/cloudflare/cfssl/pull/425","diff_url":"https://github.com/cloudflare/cfssl/pull/425.diff","patch_url":"https://github.com/cloudflare/cfssl/pull/425.patch","issue_url":"https://api.github.com/repos/cloudflare/cfssl/issues/425","number":425,"state":"closed","locked":false,"title":"Set caching headers in OCSP responder","user":{"login":"jsha","id":220205,"avatar_url":"https://avatars.githubusercontent.com/u/220205?v=3","gravatar_id":"","url":"https://api.github.com/users/jsha","html_url":"https://github.com/jsha","followers_url":"https://api.github.com/users/jsha/followers","following_url":"https://api.github.com/users/jsha/following{/other_user}","gists_url":"https://api.github.com/users/jsha/gists{/gist_id}","starred_url":"https://api.github.com/users/jsha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsha/subscriptions","organizations_url":"https://api.github.com/users/jsha/orgs","repos_url":"https://api.github.com/users/jsha/repos","events_url":"https://api.github.com/users/jsha/events{/privacy}","received_events_url":"https://api.github.com/users/jsha/received_events","type":"User","site_admin":false},"body":"Also, rename response.pem to response.der, put working responses in resp64.pem,\r\nand move some responder tests into responder_test.go","created_at":"2015-11-13T03:21:47Z","updated_at":"2015-12-20T18:13:04Z","closed_at":"2015-11-16T20:21:03Z","merged_at":"2015-11-16T20:21:03Z","merge_commit_sha":"0d3b3e742bfd693b7bf1528c87a4e81bc47e3b5f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cloudflare/cfssl/pulls/425/commits","review_comments_url":"https://api.github.com/repos/cloudflare/cfssl/pulls/425/comments","review_comment_url":"https://api.github.com/repos/cloudflare/cfssl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cloudflare/cfssl/issues/425/comments","statuses_url":"https://api.github.com/repos/cloudflare/cfssl/statuses/041286c8347240d76f16e5ff14fa8b686c279f10","head":{"label":"jsha:ocsp-cache","ref":"ocsp-cache","sha":"041286c8347240d76f16e5ff14fa8b686c279f10","user":{"login":"jsha","id":220205,"avatar_url":"https://avatars.githubusercontent.com/u/220205?v=3","gravatar_id":"","url":"https://api.github.com/users/jsha","html_url":"https://github.com/jsha","followers_url":"https://api.github.com/users/jsha/followers","following_url":"https://api.github.com/users/jsha/following{/other_user}","gists_url":"https://api.github.com/users/jsha/gists{/gist_id}","starred_url":"https://api.github.com/users/jsha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsha/subscriptions","organizations_url":"https://api.github.com/users/jsha/orgs","repos_url":"https://api.github.com/users/jsha/repos","events_url":"https://api.github.com/users/jsha/events{/privacy}","received_events_url":"https://api.github.com/users/jsha/received_events","type":"User","site_admin":false},"repo":{"id":34080168,"name":"cfssl","full_name":"jsha/cfssl","owner":{"login":"jsha","id":220205,"avatar_url":"https://avatars.githubusercontent.com/u/220205?v=3","gravatar_id":"","url":"https://api.github.com/users/jsha","html_url":"https://github.com/jsha","followers_url":"https://api.github.com/users/jsha/followers","following_url":"https://api.github.com/users/jsha/following{/other_user}","gists_url":"https://api.github.com/users/jsha/gists{/gist_id}","starred_url":"https://api.github.com/users/jsha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsha/subscriptions","organizations_url":"https://api.github.com/users/jsha/orgs","repos_url":"https://api.github.com/users/jsha/repos","events_url":"https://api.github.com/users/jsha/events{/privacy}","received_events_url":"https://api.github.com/users/jsha/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jsha/cfssl","description":"CFSSL: CloudFlare's PKI toolkit","fork":true,"url":"https://api.github.com/repos/jsha/cfssl","forks_url":"https://api.github.com/repos/jsha/cfssl/forks","keys_url":"https://api.github.com/repos/jsha/cfssl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jsha/cfssl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jsha/cfssl/teams","hooks_url":"https://api.github.com/repos/jsha/cfssl/hooks","issue_events_url":"https://api.github.com/repos/jsha/cfssl/issues/events{/number}","events_url":"https://api.github.com/repos/jsha/cfssl/events","assignees_url":"https://api.github.com/repos/jsha/cfssl/assignees{/user}","branches_url":"https://api.github.com/repos/jsha/cfssl/branches{/branch}","tags_url":"https://api.github.com/repos/jsha/cfssl/tags","blobs_url":"https://api.github.com/repos/jsha/cfssl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jsha/cfssl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jsha/cfssl/git/refs{/sha}","trees_url":"https://api.github.com/repos/jsha/cfssl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jsha/cfssl/statuses/{sha}","languages_url":"https://api.github.com/repos/jsha/cfssl/languages","stargazers_url":"https://api.github.com/repos/jsha/cfssl/stargazers","contributors_url":"https://api.github.com/repos/jsha/cfssl/contributors","subscribers_url":"https://api.github.com/repos/jsha/cfssl/subscribers","subscription_url":"https://api.github.com/repos/jsha/cfssl/subscription","commits_url":"https://api.github.com/repos/jsha/cfssl/commits{/sha}","git_commits_url":"https://api.github.com/repos/jsha/cfssl/git/commits{/sha}","comments_url":"https://api.github.com/repos/jsha/cfssl/comments{/number}","issue_comment_url":"https://api.github.com/repos/jsha/cfssl/issues/comments{/number}","contents_url":"https://api.github.com/repos/jsha/cfssl/contents/{+path}","compare_url":"https://api.github.com/repos/jsha/cfssl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jsha/cfssl/merges","archive_url":"https://api.github.com/repos/jsha/cfssl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jsha/cfssl/downloads","issues_url":"https://api.github.com/repos/jsha/cfssl/issues{/number}","pulls_url":"https://api.github.com/repos/jsha/cfssl/pulls{/number}","milestones_url":"https://api.github.com/repos/jsha/cfssl/milestones{/number}","notifications_url":"https://api.github.com/repos/jsha/cfssl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jsha/cfssl/labels{/name}","releases_url":"https://api.github.com/repos/jsha/cfssl/releases{/id}","created_at":"2015-04-16T20:56:44Z","updated_at":"2015-04-16T20:56:45Z","pushed_at":"2015-12-01T20:05:04Z","git_url":"git://github.com/jsha/cfssl.git","ssh_url":"git@github.com:jsha/cfssl.git","clone_url":"https://github.com/jsha/cfssl.git","svn_url":"https://github.com/jsha/cfssl","homepage":"https://blog.cloudflare.com/introducing-cfssl","size":2224,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cloudflare:master","ref":"master","sha":"689134bc9106de549f8f4b141d2c36685c03fd82","user":{"login":"cloudflare","id":314135,"avatar_url":"https://avatars.githubusercontent.com/u/314135?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudflare","html_url":"https://github.com/cloudflare","followers_url":"https://api.github.com/users/cloudflare/followers","following_url":"https://api.github.com/users/cloudflare/following{/other_user}","gists_url":"https://api.github.com/users/cloudflare/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudflare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudflare/subscriptions","organizations_url":"https://api.github.com/users/cloudflare/orgs","repos_url":"https://api.github.com/users/cloudflare/repos","events_url":"https://api.github.com/users/cloudflare/events{/privacy}","received_events_url":"https://api.github.com/users/cloudflare/received_events","type":"Organization","site_admin":false},"repo":{"id":21591001,"name":"cfssl","full_name":"cloudflare/cfssl","owner":{"login":"cloudflare","id":314135,"avatar_url":"https://avatars.githubusercontent.com/u/314135?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudflare","html_url":"https://github.com/cloudflare","followers_url":"https://api.github.com/users/cloudflare/followers","following_url":"https://api.github.com/users/cloudflare/following{/other_user}","gists_url":"https://api.github.com/users/cloudflare/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudflare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudflare/subscriptions","organizations_url":"https://api.github.com/users/cloudflare/orgs","repos_url":"https://api.github.com/users/cloudflare/repos","events_url":"https://api.github.com/users/cloudflare/events{/privacy}","received_events_url":"https://api.github.com/users/cloudflare/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudflare/cfssl","description":"CFSSL: CloudFlare's PKI and TLS toolkit","fork":false,"url":"https://api.github.com/repos/cloudflare/cfssl","forks_url":"https://api.github.com/repos/cloudflare/cfssl/forks","keys_url":"https://api.github.com/repos/cloudflare/cfssl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudflare/cfssl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudflare/cfssl/teams","hooks_url":"https://api.github.com/repos/cloudflare/cfssl/hooks","issue_events_url":"https://api.github.com/repos/cloudflare/cfssl/issues/events{/number}","events_url":"https://api.github.com/repos/cloudflare/cfssl/events","assignees_url":"https://api.github.com/repos/cloudflare/cfssl/assignees{/user}","branches_url":"https://api.github.com/repos/cloudflare/cfssl/branches{/branch}","tags_url":"https://api.github.com/repos/cloudflare/cfssl/tags","blobs_url":"https://api.github.com/repos/cloudflare/cfssl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudflare/cfssl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudflare/cfssl/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudflare/cfssl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudflare/cfssl/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudflare/cfssl/languages","stargazers_url":"https://api.github.com/repos/cloudflare/cfssl/stargazers","contributors_url":"https://api.github.com/repos/cloudflare/cfssl/contributors","subscribers_url":"https://api.github.com/repos/cloudflare/cfssl/subscribers","subscription_url":"https://api.github.com/repos/cloudflare/cfssl/subscription","commits_url":"https://api.github.com/repos/cloudflare/cfssl/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudflare/cfssl/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudflare/cfssl/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudflare/cfssl/issues/comments{/number}","contents_url":"https://api.github.com/repos/cloudflare/cfssl/contents/{+path}","compare_url":"https://api.github.com/repos/cloudflare/cfssl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudflare/cfssl/merges","archive_url":"https://api.github.com/repos/cloudflare/cfssl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudflare/cfssl/downloads","issues_url":"https://api.github.com/repos/cloudflare/cfssl/issues{/number}","pulls_url":"https://api.github.com/repos/cloudflare/cfssl/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudflare/cfssl/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudflare/cfssl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudflare/cfssl/labels{/name}","releases_url":"https://api.github.com/repos/cloudflare/cfssl/releases{/id}","created_at":"2014-07-07T23:49:12Z","updated_at":"2015-12-17T12:26:34Z","pushed_at":"2015-12-19T00:38:41Z","git_url":"git://github.com/cloudflare/cfssl.git","ssh_url":"git@github.com:cloudflare/cfssl.git","clone_url":"https://github.com/cloudflare/cfssl.git","svn_url":"https://github.com/cloudflare/cfssl","homepage":"https://cfssl.org/","size":4842,"stargazers_count":954,"watchers_count":954,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":114,"mirror_url":null,"open_issues_count":53,"forks":114,"open_issues":53,"watchers":954,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cloudflare/cfssl/pulls/425"},"html":{"href":"https://github.com/cloudflare/cfssl/pull/425"},"issue":{"href":"https://api.github.com/repos/cloudflare/cfssl/issues/425"},"comments":{"href":"https://api.github.com/repos/cloudflare/cfssl/issues/425/comments"},"review_comments":{"href":"https://api.github.com/repos/cloudflare/cfssl/pulls/425/comments"},"review_comment":{"href":"https://api.github.com/repos/cloudflare/cfssl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cloudflare/cfssl/pulls/425/commits"},"statuses":{"href":"https://api.github.com/repos/cloudflare/cfssl/statuses/041286c8347240d76f16e5ff14fa8b686c279f10"}}}}