{"action":"created","comment":{"url":"https://api.github.com/repos/cloudflare/cfssl/pulls/comments/101634397","pull_request_review_id":22369768,"id":101634397,"diff_hunk":"@@ -49,6 +51,49 @@ func (src InMemorySource) Response(request *ocsp.Request) (response []byte, pres\n \treturn\n }\n \n+// SqliteSource represnts a source of OCSP responses backed by certdb\n+type SqliteSource struct {\n+\tAccessor certdb.Accessor\n+}\n+\n+// NewSqliteSource creates a new SqliteSource type and associated dbAccessor\n+func NewSqliteSource(dbAccessor certdb.Accessor) Source {\n+\treturn SqliteSource{\n+\t\tAccessor: dbAccessor,\n+\t}\n+}\n+\n+// Response implements cfssl.ocsp.responder.Source, returning the OCSP response\n+// with the expiration date furthest in the future\n+func (src SqliteSource) Response(req *ocsp.Request) ([]byte, bool) {\n+\tif req == nil {\n+\t\treturn nil, false\n+\t}\n+\n+\t// Extract the AKI string from req.IssuerKeyHash\n+\taki := hex.EncodeToString(req.IssuerKeyHash)\n+\n+\tsn := req.SerialNumber\n+\tif sn == nil {\n+\t\treturn nil, false\n+\t}\n+\tstrSN := sn.String()\n+\n+\trecords, err := src.Accessor.GetOCSP(strSN, aki)\n+\tif err == nil || len(records) == 0 {","path":"ocsp/responder.go","position":49,"original_position":49,"commit_id":"ac4af344336d88ae5c34b531c1e31375e8f04008","original_commit_id":"ac4af344336d88ae5c34b531c1e31375e8f04008","user":{"login":"lziest","id":1222706,"avatar_url":"https://avatars.githubusercontent.com/u/1222706?v=3","gravatar_id":"","url":"https://api.github.com/users/lziest","html_url":"https://github.com/lziest","followers_url":"https://api.github.com/users/lziest/followers","following_url":"https://api.github.com/users/lziest/following{/other_user}","gists_url":"https://api.github.com/users/lziest/gists{/gist_id}","starred_url":"https://api.github.com/users/lziest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lziest/subscriptions","organizations_url":"https://api.github.com/users/lziest/orgs","repos_url":"https://api.github.com/users/lziest/repos","events_url":"https://api.github.com/users/lziest/events{/privacy}","received_events_url":"https://api.github.com/users/lziest/received_events","type":"User","site_admin":false},"body":"Also, consider to add some logs. I think it's better to differentiate the errors here. if err != nil, log the error. If no record is returned, just return (nil, false)","created_at":"2017-02-16T21:44:52Z","updated_at":"2017-02-16T21:44:57Z","html_url":"https://github.com/cloudflare/cfssl/pull/728#discussion_r101634397","pull_request_url":"https://api.github.com/repos/cloudflare/cfssl/pulls/728","_links":{"self":{"href":"https://api.github.com/repos/cloudflare/cfssl/pulls/comments/101634397"},"html":{"href":"https://github.com/cloudflare/cfssl/pull/728#discussion_r101634397"},"pull_request":{"href":"https://api.github.com/repos/cloudflare/cfssl/pulls/728"}}},"pull_request":{"url":"https://api.github.com/repos/cloudflare/cfssl/pulls/728","id":105803603,"html_url":"https://github.com/cloudflare/cfssl/pull/728","diff_url":"https://github.com/cloudflare/cfssl/pull/728.diff","patch_url":"https://github.com/cloudflare/cfssl/pull/728.patch","issue_url":"https://api.github.com/repos/cloudflare/cfssl/issues/728","number":728,"state":"open","locked":false,"title":"add Sqlite backend support","user":{"login":"bjt79","id":10744008,"avatar_url":"https://avatars.githubusercontent.com/u/10744008?v=3","gravatar_id":"","url":"https://api.github.com/users/bjt79","html_url":"https://github.com/bjt79","followers_url":"https://api.github.com/users/bjt79/followers","following_url":"https://api.github.com/users/bjt79/following{/other_user}","gists_url":"https://api.github.com/users/bjt79/gists{/gist_id}","starred_url":"https://api.github.com/users/bjt79/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bjt79/subscriptions","organizations_url":"https://api.github.com/users/bjt79/orgs","repos_url":"https://api.github.com/users/bjt79/repos","events_url":"https://api.github.com/users/bjt79/events{/privacy}","received_events_url":"https://api.github.com/users/bjt79/received_events","type":"User","site_admin":false},"body":"TODO: add tests","created_at":"2017-02-12T19:48:41Z","updated_at":"2017-02-16T21:44:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c4a028fc8a3961b2b02ff3466c1d43a9ec9b5c52","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/cloudflare/cfssl/pulls/728/commits","review_comments_url":"https://api.github.com/repos/cloudflare/cfssl/pulls/728/comments","review_comment_url":"https://api.github.com/repos/cloudflare/cfssl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cloudflare/cfssl/issues/728/comments","statuses_url":"https://api.github.com/repos/cloudflare/cfssl/statuses/ac4af344336d88ae5c34b531c1e31375e8f04008","head":{"label":"bjt79:sqlite_source","ref":"sqlite_source","sha":"ac4af344336d88ae5c34b531c1e31375e8f04008","user":{"login":"bjt79","id":10744008,"avatar_url":"https://avatars.githubusercontent.com/u/10744008?v=3","gravatar_id":"","url":"https://api.github.com/users/bjt79","html_url":"https://github.com/bjt79","followers_url":"https://api.github.com/users/bjt79/followers","following_url":"https://api.github.com/users/bjt79/following{/other_user}","gists_url":"https://api.github.com/users/bjt79/gists{/gist_id}","starred_url":"https://api.github.com/users/bjt79/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bjt79/subscriptions","organizations_url":"https://api.github.com/users/bjt79/orgs","repos_url":"https://api.github.com/users/bjt79/repos","events_url":"https://api.github.com/users/bjt79/events{/privacy}","received_events_url":"https://api.github.com/users/bjt79/received_events","type":"User","site_admin":false},"repo":{"id":81734377,"name":"cfssl","full_name":"bjt79/cfssl","owner":{"login":"bjt79","id":10744008,"avatar_url":"https://avatars.githubusercontent.com/u/10744008?v=3","gravatar_id":"","url":"https://api.github.com/users/bjt79","html_url":"https://github.com/bjt79","followers_url":"https://api.github.com/users/bjt79/followers","following_url":"https://api.github.com/users/bjt79/following{/other_user}","gists_url":"https://api.github.com/users/bjt79/gists{/gist_id}","starred_url":"https://api.github.com/users/bjt79/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bjt79/subscriptions","organizations_url":"https://api.github.com/users/bjt79/orgs","repos_url":"https://api.github.com/users/bjt79/repos","events_url":"https://api.github.com/users/bjt79/events{/privacy}","received_events_url":"https://api.github.com/users/bjt79/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bjt79/cfssl","description":"CFSSL: Cloudflare's PKI and TLS toolkit","fork":true,"url":"https://api.github.com/repos/bjt79/cfssl","forks_url":"https://api.github.com/repos/bjt79/cfssl/forks","keys_url":"https://api.github.com/repos/bjt79/cfssl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bjt79/cfssl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bjt79/cfssl/teams","hooks_url":"https://api.github.com/repos/bjt79/cfssl/hooks","issue_events_url":"https://api.github.com/repos/bjt79/cfssl/issues/events{/number}","events_url":"https://api.github.com/repos/bjt79/cfssl/events","assignees_url":"https://api.github.com/repos/bjt79/cfssl/assignees{/user}","branches_url":"https://api.github.com/repos/bjt79/cfssl/branches{/branch}","tags_url":"https://api.github.com/repos/bjt79/cfssl/tags","blobs_url":"https://api.github.com/repos/bjt79/cfssl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bjt79/cfssl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bjt79/cfssl/git/refs{/sha}","trees_url":"https://api.github.com/repos/bjt79/cfssl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bjt79/cfssl/statuses/{sha}","languages_url":"https://api.github.com/repos/bjt79/cfssl/languages","stargazers_url":"https://api.github.com/repos/bjt79/cfssl/stargazers","contributors_url":"https://api.github.com/repos/bjt79/cfssl/contributors","subscribers_url":"https://api.github.com/repos/bjt79/cfssl/subscribers","subscription_url":"https://api.github.com/repos/bjt79/cfssl/subscription","commits_url":"https://api.github.com/repos/bjt79/cfssl/commits{/sha}","git_commits_url":"https://api.github.com/repos/bjt79/cfssl/git/commits{/sha}","comments_url":"https://api.github.com/repos/bjt79/cfssl/comments{/number}","issue_comment_url":"https://api.github.com/repos/bjt79/cfssl/issues/comments{/number}","contents_url":"https://api.github.com/repos/bjt79/cfssl/contents/{+path}","compare_url":"https://api.github.com/repos/bjt79/cfssl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bjt79/cfssl/merges","archive_url":"https://api.github.com/repos/bjt79/cfssl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bjt79/cfssl/downloads","issues_url":"https://api.github.com/repos/bjt79/cfssl/issues{/number}","pulls_url":"https://api.github.com/repos/bjt79/cfssl/pulls{/number}","milestones_url":"https://api.github.com/repos/bjt79/cfssl/milestones{/number}","notifications_url":"https://api.github.com/repos/bjt79/cfssl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bjt79/cfssl/labels{/name}","releases_url":"https://api.github.com/repos/bjt79/cfssl/releases{/id}","deployments_url":"https://api.github.com/repos/bjt79/cfssl/deployments","created_at":"2017-02-12T15:08:04Z","updated_at":"2017-02-12T15:08:06Z","pushed_at":"2017-02-16T00:52:54Z","git_url":"git://github.com/bjt79/cfssl.git","ssh_url":"git@github.com:bjt79/cfssl.git","clone_url":"https://github.com/bjt79/cfssl.git","svn_url":"https://github.com/bjt79/cfssl","homepage":"https://cfssl.org/","size":8751,"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":"cloudflare:master","ref":"master","sha":"a1037dfad494dd688836c029f848eaa4d0609e38","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}","deployments_url":"https://api.github.com/repos/cloudflare/cfssl/deployments","created_at":"2014-07-07T23:49:12Z","updated_at":"2017-02-16T21:15:25Z","pushed_at":"2017-02-16T00:52:55Z","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":8748,"stargazers_count":1793,"watchers_count":1793,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":254,"mirror_url":null,"open_issues_count":91,"forks":254,"open_issues":91,"watchers":1793,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cloudflare/cfssl/pulls/728"},"html":{"href":"https://github.com/cloudflare/cfssl/pull/728"},"issue":{"href":"https://api.github.com/repos/cloudflare/cfssl/issues/728"},"comments":{"href":"https://api.github.com/repos/cloudflare/cfssl/issues/728/comments"},"review_comments":{"href":"https://api.github.com/repos/cloudflare/cfssl/pulls/728/comments"},"review_comment":{"href":"https://api.github.com/repos/cloudflare/cfssl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cloudflare/cfssl/pulls/728/commits"},"statuses":{"href":"https://api.github.com/repos/cloudflare/cfssl/statuses/ac4af344336d88ae5c34b531c1e31375e8f04008"}}}}
{"actor":{"display_login":"lziest"}}