{"action":"created","comment":{"url":"https://api.github.com/repos/twitter/CocoaSPDY/pulls/comments/41294602","id":41294602,"diff_hunk":"@@ -0,0 +1,79 @@\n+//\n+//  SPDYCacheStoragePolicy.m\n+//  SPDY\n+//\n+//  Copyright (c) 2014 Twitter, Inc. All rights reserved.\n+//  Licensed under the Apache License v2.0\n+//  http://www.apache.org/licenses/LICENSE-2.0\n+//\n+//  Derived from code in Apple, Inc.'s CustomHTTPProtocol sample\n+//  project, found as of this notice at\n+//  https://developer.apple.com/LIBRARY/IOS/samplecode/CustomHTTPProtocol\n+//\n+\n+#import \"SPDYCacheStoragePolicy.h\"\n+\n+extern NSURLCacheStoragePolicy SPDYCacheStoragePolicy(NSURLRequest *request, NSHTTPURLResponse *response)\n+{\n+    bool                     cacheable;\n+    NSURLCacheStoragePolicy  result;\n+\n+    // First determine if the request is cacheable based on its status code.\n+    \n+    switch (response.statusCode) {\n+        case 200:\n+        case 203:\n+        case 206:\n+        case 301:\n+        case 304:\n+        case 404:\n+        case 410:\n+            cacheable = YES;\n+            break;\n+        default:\n+            cacheable = NO;\n+            break;\n+    }\n+\n+    // If the response might be cacheable, look at the \"Cache-Control\" header in \n+    // the response.\n+\n+    // IMPORTANT: We can't rely on -rangeOfString: returning valid results if the target \n+    // string is nil, so we have to explicitly test for nil in the following two cases.\n+\n+    if (cacheable) {\n+        NSString *responseHeader;\n+\n+        responseHeader = [response.allHeaderFields[@\"cache-control\"] lowercaseString];\n+        if (responseHeader != nil && [responseHeader rangeOfString:@\"no-store\"].location != NSNotFound) {\n+            cacheable = NO;\n+        }\n+    }\n+\n+    // If we still think it might be cacheable, look at the \"Cache-Control\" header in \n+    // the request.\n+\n+    if (cacheable) {\n+        NSString *requestHeader;\n+\n+        requestHeader = [request.allHTTPHeaderFields[@\"cache-control\"] lowercaseString];","path":"SPDY/SPDYCacheStoragePolicy.m","position":59,"original_position":59,"commit_id":"cd47cb65413bfa6a550c23ad348d24bb1921b31c","original_commit_id":"cd47cb65413bfa6a550c23ad348d24bb1921b31c","user":{"login":"NSProgrammer","id":1816176,"avatar_url":"https://avatars.githubusercontent.com/u/1816176?v=3","gravatar_id":"","url":"https://api.github.com/users/NSProgrammer","html_url":"https://github.com/NSProgrammer","followers_url":"https://api.github.com/users/NSProgrammer/followers","following_url":"https://api.github.com/users/NSProgrammer/following{/other_user}","gists_url":"https://api.github.com/users/NSProgrammer/gists{/gist_id}","starred_url":"https://api.github.com/users/NSProgrammer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NSProgrammer/subscriptions","organizations_url":"https://api.github.com/users/NSProgrammer/orgs","repos_url":"https://api.github.com/users/NSProgrammer/repos","events_url":"https://api.github.com/users/NSProgrammer/events{/privacy}","received_events_url":"https://api.github.com/users/NSProgrammer/received_events","type":"User","site_admin":false},"body":"ditto for request","created_at":"2015-10-06T17:24:36Z","updated_at":"2015-10-06T17:24:36Z","html_url":"https://github.com/twitter/CocoaSPDY/pull/135#discussion_r41294602","pull_request_url":"https://api.github.com/repos/twitter/CocoaSPDY/pulls/135","_links":{"self":{"href":"https://api.github.com/repos/twitter/CocoaSPDY/pulls/comments/41294602"},"html":{"href":"https://github.com/twitter/CocoaSPDY/pull/135#discussion_r41294602"},"pull_request":{"href":"https://api.github.com/repos/twitter/CocoaSPDY/pulls/135"}}},"pull_request":{"url":"https://api.github.com/repos/twitter/CocoaSPDY/pulls/135","id":46865587,"html_url":"https://github.com/twitter/CocoaSPDY/pull/135","diff_url":"https://github.com/twitter/CocoaSPDY/pull/135.diff","patch_url":"https://github.com/twitter/CocoaSPDY/pull/135.patch","issue_url":"https://api.github.com/repos/twitter/CocoaSPDY/issues/135","number":135,"state":"open","locked":false,"title":"Groundwork for future push work","user":{"login":"kgoodier","id":6953724,"avatar_url":"https://avatars.githubusercontent.com/u/6953724?v=3","gravatar_id":"","url":"https://api.github.com/users/kgoodier","html_url":"https://github.com/kgoodier","followers_url":"https://api.github.com/users/kgoodier/followers","following_url":"https://api.github.com/users/kgoodier/following{/other_user}","gists_url":"https://api.github.com/users/kgoodier/gists{/gist_id}","starred_url":"https://api.github.com/users/kgoodier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kgoodier/subscriptions","organizations_url":"https://api.github.com/users/kgoodier/orgs","repos_url":"https://api.github.com/users/kgoodier/repos","events_url":"https://api.github.com/users/kgoodier/events{/privacy}","received_events_url":"https://api.github.com/users/kgoodier/received_events","type":"User","site_admin":false},"body":"Some miscellaneous items to overall move things forward, and in particular lay the groundwork for future push stream work.\r\n\r\n- rework how streams are closed / canceled\r\n- refactor common test code\r\n- cache storage policy\r\n","created_at":"2015-10-06T06:10:54Z","updated_at":"2015-10-06T17:24:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ced5a3c200a7e5549b6a597e22e8829ecfa9ff88","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/twitter/CocoaSPDY/pulls/135/commits","review_comments_url":"https://api.github.com/repos/twitter/CocoaSPDY/pulls/135/comments","review_comment_url":"https://api.github.com/repos/twitter/CocoaSPDY/pulls/comments{/number}","comments_url":"https://api.github.com/repos/twitter/CocoaSPDY/issues/135/comments","statuses_url":"https://api.github.com/repos/twitter/CocoaSPDY/statuses/cd47cb65413bfa6a550c23ad348d24bb1921b31c","head":{"label":"kgoodier:develop-future","ref":"develop-future","sha":"cd47cb65413bfa6a550c23ad348d24bb1921b31c","user":{"login":"kgoodier","id":6953724,"avatar_url":"https://avatars.githubusercontent.com/u/6953724?v=3","gravatar_id":"","url":"https://api.github.com/users/kgoodier","html_url":"https://github.com/kgoodier","followers_url":"https://api.github.com/users/kgoodier/followers","following_url":"https://api.github.com/users/kgoodier/following{/other_user}","gists_url":"https://api.github.com/users/kgoodier/gists{/gist_id}","starred_url":"https://api.github.com/users/kgoodier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kgoodier/subscriptions","organizations_url":"https://api.github.com/users/kgoodier/orgs","repos_url":"https://api.github.com/users/kgoodier/repos","events_url":"https://api.github.com/users/kgoodier/events{/privacy}","received_events_url":"https://api.github.com/users/kgoodier/received_events","type":"User","site_admin":false},"repo":{"id":20940545,"name":"CocoaSPDY","full_name":"kgoodier/CocoaSPDY","owner":{"login":"kgoodier","id":6953724,"avatar_url":"https://avatars.githubusercontent.com/u/6953724?v=3","gravatar_id":"","url":"https://api.github.com/users/kgoodier","html_url":"https://github.com/kgoodier","followers_url":"https://api.github.com/users/kgoodier/followers","following_url":"https://api.github.com/users/kgoodier/following{/other_user}","gists_url":"https://api.github.com/users/kgoodier/gists{/gist_id}","starred_url":"https://api.github.com/users/kgoodier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kgoodier/subscriptions","organizations_url":"https://api.github.com/users/kgoodier/orgs","repos_url":"https://api.github.com/users/kgoodier/repos","events_url":"https://api.github.com/users/kgoodier/events{/privacy}","received_events_url":"https://api.github.com/users/kgoodier/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kgoodier/CocoaSPDY","description":"SPDY for iOS and OS X","fork":true,"url":"https://api.github.com/repos/kgoodier/CocoaSPDY","forks_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/forks","keys_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/teams","hooks_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/hooks","issue_events_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/issues/events{/number}","events_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/events","assignees_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/assignees{/user}","branches_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/branches{/branch}","tags_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/tags","blobs_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/git/refs{/sha}","trees_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/statuses/{sha}","languages_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/languages","stargazers_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/stargazers","contributors_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/contributors","subscribers_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/subscribers","subscription_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/subscription","commits_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/commits{/sha}","git_commits_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/git/commits{/sha}","comments_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/comments{/number}","issue_comment_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/issues/comments{/number}","contents_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/contents/{+path}","compare_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/merges","archive_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/downloads","issues_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/issues{/number}","pulls_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/pulls{/number}","milestones_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/milestones{/number}","notifications_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/labels{/name}","releases_url":"https://api.github.com/repos/kgoodier/CocoaSPDY/releases{/id}","created_at":"2014-06-17T21:41:36Z","updated_at":"2015-05-27T08:08:14Z","pushed_at":"2015-10-06T06:16:42Z","git_url":"git://github.com/kgoodier/CocoaSPDY.git","ssh_url":"git@github.com:kgoodier/CocoaSPDY.git","clone_url":"https://github.com/kgoodier/CocoaSPDY.git","svn_url":"https://github.com/kgoodier/CocoaSPDY","homepage":"","size":1826,"stargazers_count":1,"watchers_count":1,"language":"Objective-C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"develop"}},"base":{"label":"twitter:develop","ref":"develop","sha":"9c185ccae6b34eed958a2d1dbd50faff4d9283eb","user":{"login":"twitter","id":50278,"avatar_url":"https://avatars.githubusercontent.com/u/50278?v=3","gravatar_id":"","url":"https://api.github.com/users/twitter","html_url":"https://github.com/twitter","followers_url":"https://api.github.com/users/twitter/followers","following_url":"https://api.github.com/users/twitter/following{/other_user}","gists_url":"https://api.github.com/users/twitter/gists{/gist_id}","starred_url":"https://api.github.com/users/twitter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twitter/subscriptions","organizations_url":"https://api.github.com/users/twitter/orgs","repos_url":"https://api.github.com/users/twitter/repos","events_url":"https://api.github.com/users/twitter/events{/privacy}","received_events_url":"https://api.github.com/users/twitter/received_events","type":"Organization","site_admin":false},"repo":{"id":15299224,"name":"CocoaSPDY","full_name":"twitter/CocoaSPDY","owner":{"login":"twitter","id":50278,"avatar_url":"https://avatars.githubusercontent.com/u/50278?v=3","gravatar_id":"","url":"https://api.github.com/users/twitter","html_url":"https://github.com/twitter","followers_url":"https://api.github.com/users/twitter/followers","following_url":"https://api.github.com/users/twitter/following{/other_user}","gists_url":"https://api.github.com/users/twitter/gists{/gist_id}","starred_url":"https://api.github.com/users/twitter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twitter/subscriptions","organizations_url":"https://api.github.com/users/twitter/orgs","repos_url":"https://api.github.com/users/twitter/repos","events_url":"https://api.github.com/users/twitter/events{/privacy}","received_events_url":"https://api.github.com/users/twitter/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/twitter/CocoaSPDY","description":"SPDY for iOS and OS X","fork":false,"url":"https://api.github.com/repos/twitter/CocoaSPDY","forks_url":"https://api.github.com/repos/twitter/CocoaSPDY/forks","keys_url":"https://api.github.com/repos/twitter/CocoaSPDY/keys{/key_id}","collaborators_url":"https://api.github.com/repos/twitter/CocoaSPDY/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/twitter/CocoaSPDY/teams","hooks_url":"https://api.github.com/repos/twitter/CocoaSPDY/hooks","issue_events_url":"https://api.github.com/repos/twitter/CocoaSPDY/issues/events{/number}","events_url":"https://api.github.com/repos/twitter/CocoaSPDY/events","assignees_url":"https://api.github.com/repos/twitter/CocoaSPDY/assignees{/user}","branches_url":"https://api.github.com/repos/twitter/CocoaSPDY/branches{/branch}","tags_url":"https://api.github.com/repos/twitter/CocoaSPDY/tags","blobs_url":"https://api.github.com/repos/twitter/CocoaSPDY/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/twitter/CocoaSPDY/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/twitter/CocoaSPDY/git/refs{/sha}","trees_url":"https://api.github.com/repos/twitter/CocoaSPDY/git/trees{/sha}","statuses_url":"https://api.github.com/repos/twitter/CocoaSPDY/statuses/{sha}","languages_url":"https://api.github.com/repos/twitter/CocoaSPDY/languages","stargazers_url":"https://api.github.com/repos/twitter/CocoaSPDY/stargazers","contributors_url":"https://api.github.com/repos/twitter/CocoaSPDY/contributors","subscribers_url":"https://api.github.com/repos/twitter/CocoaSPDY/subscribers","subscription_url":"https://api.github.com/repos/twitter/CocoaSPDY/subscription","commits_url":"https://api.github.com/repos/twitter/CocoaSPDY/commits{/sha}","git_commits_url":"https://api.github.com/repos/twitter/CocoaSPDY/git/commits{/sha}","comments_url":"https://api.github.com/repos/twitter/CocoaSPDY/comments{/number}","issue_comment_url":"https://api.github.com/repos/twitter/CocoaSPDY/issues/comments{/number}","contents_url":"https://api.github.com/repos/twitter/CocoaSPDY/contents/{+path}","compare_url":"https://api.github.com/repos/twitter/CocoaSPDY/compare/{base}...{head}","merges_url":"https://api.github.com/repos/twitter/CocoaSPDY/merges","archive_url":"https://api.github.com/repos/twitter/CocoaSPDY/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/twitter/CocoaSPDY/downloads","issues_url":"https://api.github.com/repos/twitter/CocoaSPDY/issues{/number}","pulls_url":"https://api.github.com/repos/twitter/CocoaSPDY/pulls{/number}","milestones_url":"https://api.github.com/repos/twitter/CocoaSPDY/milestones{/number}","notifications_url":"https://api.github.com/repos/twitter/CocoaSPDY/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/twitter/CocoaSPDY/labels{/name}","releases_url":"https://api.github.com/repos/twitter/CocoaSPDY/releases{/id}","created_at":"2013-12-19T01:50:59Z","updated_at":"2015-10-06T13:59:49Z","pushed_at":"2015-10-06T06:10:55Z","git_url":"git://github.com/twitter/CocoaSPDY.git","ssh_url":"git@github.com:twitter/CocoaSPDY.git","clone_url":"https://github.com/twitter/CocoaSPDY.git","svn_url":"https://github.com/twitter/CocoaSPDY","homepage":"","size":1818,"stargazers_count":2016,"watchers_count":2016,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":205,"mirror_url":null,"open_issues_count":16,"forks":205,"open_issues":16,"watchers":2016,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/twitter/CocoaSPDY/pulls/135"},"html":{"href":"https://github.com/twitter/CocoaSPDY/pull/135"},"issue":{"href":"https://api.github.com/repos/twitter/CocoaSPDY/issues/135"},"comments":{"href":"https://api.github.com/repos/twitter/CocoaSPDY/issues/135/comments"},"review_comments":{"href":"https://api.github.com/repos/twitter/CocoaSPDY/pulls/135/comments"},"review_comment":{"href":"https://api.github.com/repos/twitter/CocoaSPDY/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/twitter/CocoaSPDY/pulls/135/commits"},"statuses":{"href":"https://api.github.com/repos/twitter/CocoaSPDY/statuses/cd47cb65413bfa6a550c23ad348d24bb1921b31c"}}}}