{"action":"created","comment":{"url":"https://api.github.com/repos/excon/excon/pulls/comments/23584715","id":23584715,"diff_hunk":"@@ -24,119 +25,44 @@ def initialize(data = {})\n       @nonblock = data[:nonblock]\n       @read_buffer = ''\n       @eof = false\n-\n       connect\n     end\n \n-    def read(max_length=nil)\n-      if @eof\n-        return max_length ? nil : ''\n-      elsif @nonblock\n-        begin\n-          if max_length\n-            until @read_buffer.length >= max_length\n-              @read_buffer << @socket.read_nonblock(max_length - @read_buffer.length)\n-            end\n-          else\n-            while true\n-              @read_buffer << @socket.read_nonblock(@data[:chunk_size])\n-            end\n-          end\n-        rescue OpenSSL::SSL::SSLError => error\n-          if error.message == 'read would block'\n-            if IO.select([@socket], nil, nil, @data[:read_timeout])\n-              retry\n-            else\n-              raise(Excon::Errors::Timeout.new(\"read timeout reached\"))\n-            end\n-          else\n-            raise(error)\n-          end\n-        rescue Errno::EAGAIN, Errno::EWOULDBLOCK, IO::WaitReadable\n-          if @read_buffer.empty?\n-            # if we didn't read anything, try again...\n-            if IO.select([@socket], nil, nil, @data[:read_timeout])\n-              retry\n-            else\n-              raise(Excon::Errors::Timeout.new(\"read timeout reached\"))\n-            end\n-          end\n-        rescue EOFError\n-          @eof = true\n-        end\n+    def read(max_length = nil)\n+      # if @eof\n+      return max_length ? nil : '' if @eof","path":"lib/excon/socket.rb","position":54,"original_position":54,"commit_id":"987e7812c0660930feedd26630e9a6fb1ccea27a","original_commit_id":"987e7812c0660930feedd26630e9a6fb1ccea27a","user":{"login":"starbelly","id":8829116,"avatar_url":"https://avatars.githubusercontent.com/u/8829116?v=3","gravatar_id":"","url":"https://api.github.com/users/starbelly","html_url":"https://github.com/starbelly","followers_url":"https://api.github.com/users/starbelly/followers","following_url":"https://api.github.com/users/starbelly/following{/other_user}","gists_url":"https://api.github.com/users/starbelly/gists{/gist_id}","starred_url":"https://api.github.com/users/starbelly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starbelly/subscriptions","organizations_url":"https://api.github.com/users/starbelly/orgs","repos_url":"https://api.github.com/users/starbelly/repos","events_url":"https://api.github.com/users/starbelly/events{/privacy}","received_events_url":"https://api.github.com/users/starbelly/received_events","type":"User","site_admin":false},"body":"Totally. I get OCD about condense conditionals. ","created_at":"2015-01-27T03:13:27Z","updated_at":"2015-01-27T03:13:27Z","html_url":"https://github.com/excon/excon/pull/455#discussion_r23584715","pull_request_url":"https://api.github.com/repos/excon/excon/pulls/455","_links":{"self":{"href":"https://api.github.com/repos/excon/excon/pulls/comments/23584715"},"html":{"href":"https://github.com/excon/excon/pull/455#discussion_r23584715"},"pull_request":{"href":"https://api.github.com/repos/excon/excon/pulls/455"}}},"pull_request":{"url":"https://api.github.com/repos/excon/excon/pulls/455","id":27536470,"html_url":"https://github.com/excon/excon/pull/455","diff_url":"https://github.com/excon/excon/pull/455.diff","patch_url":"https://github.com/excon/excon/pull/455.patch","issue_url":"https://api.github.com/repos/excon/excon/issues/455","number":455,"state":"open","locked":false,"title":"Re-implement timeout monitoring for sockets via IO.select","user":{"login":"starbelly","id":8829116,"avatar_url":"https://avatars.githubusercontent.com/u/8829116?v=3","gravatar_id":"","url":"https://api.github.com/users/starbelly","html_url":"https://github.com/starbelly","followers_url":"https://api.github.com/users/starbelly/followers","following_url":"https://api.github.com/users/starbelly/following{/other_user}","gists_url":"https://api.github.com/users/starbelly/gists{/gist_id}","starred_url":"https://api.github.com/users/starbelly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starbelly/subscriptions","organizations_url":"https://api.github.com/users/starbelly/orgs","repos_url":"https://api.github.com/users/starbelly/repos","events_url":"https://api.github.com/users/starbelly/events{/privacy}","received_events_url":"https://api.github.com/users/starbelly/received_events","type":"User","site_admin":false},"body":" - decompose write into write_nonblock and write_block\r\n - decompose read into read_nonblock and read_block\r\n - added timeout_reached() and raise_timeout_error() to make monitoring DRY","created_at":"2015-01-16T21:07:27Z","updated_at":"2015-01-27T03:13:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2efc1729470dd414643c85f83bd2ce8b98875fab","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/excon/excon/pulls/455/commits","review_comments_url":"https://api.github.com/repos/excon/excon/pulls/455/comments","review_comment_url":"https://api.github.com/repos/excon/excon/pulls/comments/{number}","comments_url":"https://api.github.com/repos/excon/excon/issues/455/comments","statuses_url":"https://api.github.com/repos/excon/excon/statuses/987e7812c0660930feedd26630e9a6fb1ccea27a","head":{"label":"starbelly:fix_timeouts","ref":"fix_timeouts","sha":"987e7812c0660930feedd26630e9a6fb1ccea27a","user":{"login":"starbelly","id":8829116,"avatar_url":"https://avatars.githubusercontent.com/u/8829116?v=3","gravatar_id":"","url":"https://api.github.com/users/starbelly","html_url":"https://github.com/starbelly","followers_url":"https://api.github.com/users/starbelly/followers","following_url":"https://api.github.com/users/starbelly/following{/other_user}","gists_url":"https://api.github.com/users/starbelly/gists{/gist_id}","starred_url":"https://api.github.com/users/starbelly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starbelly/subscriptions","organizations_url":"https://api.github.com/users/starbelly/orgs","repos_url":"https://api.github.com/users/starbelly/repos","events_url":"https://api.github.com/users/starbelly/events{/privacy}","received_events_url":"https://api.github.com/users/starbelly/received_events","type":"User","site_admin":false},"repo":{"id":29209007,"name":"excon","full_name":"starbelly/excon","owner":{"login":"starbelly","id":8829116,"avatar_url":"https://avatars.githubusercontent.com/u/8829116?v=3","gravatar_id":"","url":"https://api.github.com/users/starbelly","html_url":"https://github.com/starbelly","followers_url":"https://api.github.com/users/starbelly/followers","following_url":"https://api.github.com/users/starbelly/following{/other_user}","gists_url":"https://api.github.com/users/starbelly/gists{/gist_id}","starred_url":"https://api.github.com/users/starbelly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starbelly/subscriptions","organizations_url":"https://api.github.com/users/starbelly/orgs","repos_url":"https://api.github.com/users/starbelly/repos","events_url":"https://api.github.com/users/starbelly/events{/privacy}","received_events_url":"https://api.github.com/users/starbelly/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/starbelly/excon","description":"Usable, fast, simple HTTP 1.1 for Ruby","fork":true,"url":"https://api.github.com/repos/starbelly/excon","forks_url":"https://api.github.com/repos/starbelly/excon/forks","keys_url":"https://api.github.com/repos/starbelly/excon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/starbelly/excon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/starbelly/excon/teams","hooks_url":"https://api.github.com/repos/starbelly/excon/hooks","issue_events_url":"https://api.github.com/repos/starbelly/excon/issues/events{/number}","events_url":"https://api.github.com/repos/starbelly/excon/events","assignees_url":"https://api.github.com/repos/starbelly/excon/assignees{/user}","branches_url":"https://api.github.com/repos/starbelly/excon/branches{/branch}","tags_url":"https://api.github.com/repos/starbelly/excon/tags","blobs_url":"https://api.github.com/repos/starbelly/excon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/starbelly/excon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/starbelly/excon/git/refs{/sha}","trees_url":"https://api.github.com/repos/starbelly/excon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/starbelly/excon/statuses/{sha}","languages_url":"https://api.github.com/repos/starbelly/excon/languages","stargazers_url":"https://api.github.com/repos/starbelly/excon/stargazers","contributors_url":"https://api.github.com/repos/starbelly/excon/contributors","subscribers_url":"https://api.github.com/repos/starbelly/excon/subscribers","subscription_url":"https://api.github.com/repos/starbelly/excon/subscription","commits_url":"https://api.github.com/repos/starbelly/excon/commits{/sha}","git_commits_url":"https://api.github.com/repos/starbelly/excon/git/commits{/sha}","comments_url":"https://api.github.com/repos/starbelly/excon/comments{/number}","issue_comment_url":"https://api.github.com/repos/starbelly/excon/issues/comments/{number}","contents_url":"https://api.github.com/repos/starbelly/excon/contents/{+path}","compare_url":"https://api.github.com/repos/starbelly/excon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/starbelly/excon/merges","archive_url":"https://api.github.com/repos/starbelly/excon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/starbelly/excon/downloads","issues_url":"https://api.github.com/repos/starbelly/excon/issues{/number}","pulls_url":"https://api.github.com/repos/starbelly/excon/pulls{/number}","milestones_url":"https://api.github.com/repos/starbelly/excon/milestones{/number}","notifications_url":"https://api.github.com/repos/starbelly/excon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/starbelly/excon/labels{/name}","releases_url":"https://api.github.com/repos/starbelly/excon/releases{/id}","created_at":"2015-01-13T20:18:09Z","updated_at":"2015-01-13T20:18:10Z","pushed_at":"2015-01-17T10:21:38Z","git_url":"git://github.com/starbelly/excon.git","ssh_url":"git@github.com:starbelly/excon.git","clone_url":"https://github.com/starbelly/excon.git","svn_url":"https://github.com/starbelly/excon","homepage":"http://excon.io","size":1835,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"excon:master","ref":"master","sha":"e6ea72d476ebbf6d5f522a4a5d5d0bbb7a46b88a","user":{"login":"excon","id":6210164,"avatar_url":"https://avatars.githubusercontent.com/u/6210164?v=3","gravatar_id":"","url":"https://api.github.com/users/excon","html_url":"https://github.com/excon","followers_url":"https://api.github.com/users/excon/followers","following_url":"https://api.github.com/users/excon/following{/other_user}","gists_url":"https://api.github.com/users/excon/gists{/gist_id}","starred_url":"https://api.github.com/users/excon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/excon/subscriptions","organizations_url":"https://api.github.com/users/excon/orgs","repos_url":"https://api.github.com/users/excon/repos","events_url":"https://api.github.com/users/excon/events{/privacy}","received_events_url":"https://api.github.com/users/excon/received_events","type":"Organization","site_admin":false},"repo":{"id":349203,"name":"excon","full_name":"excon/excon","owner":{"login":"excon","id":6210164,"avatar_url":"https://avatars.githubusercontent.com/u/6210164?v=3","gravatar_id":"","url":"https://api.github.com/users/excon","html_url":"https://github.com/excon","followers_url":"https://api.github.com/users/excon/followers","following_url":"https://api.github.com/users/excon/following{/other_user}","gists_url":"https://api.github.com/users/excon/gists{/gist_id}","starred_url":"https://api.github.com/users/excon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/excon/subscriptions","organizations_url":"https://api.github.com/users/excon/orgs","repos_url":"https://api.github.com/users/excon/repos","events_url":"https://api.github.com/users/excon/events{/privacy}","received_events_url":"https://api.github.com/users/excon/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/excon/excon","description":"Usable, fast, simple HTTP 1.1 for Ruby","fork":false,"url":"https://api.github.com/repos/excon/excon","forks_url":"https://api.github.com/repos/excon/excon/forks","keys_url":"https://api.github.com/repos/excon/excon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/excon/excon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/excon/excon/teams","hooks_url":"https://api.github.com/repos/excon/excon/hooks","issue_events_url":"https://api.github.com/repos/excon/excon/issues/events{/number}","events_url":"https://api.github.com/repos/excon/excon/events","assignees_url":"https://api.github.com/repos/excon/excon/assignees{/user}","branches_url":"https://api.github.com/repos/excon/excon/branches{/branch}","tags_url":"https://api.github.com/repos/excon/excon/tags","blobs_url":"https://api.github.com/repos/excon/excon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/excon/excon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/excon/excon/git/refs{/sha}","trees_url":"https://api.github.com/repos/excon/excon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/excon/excon/statuses/{sha}","languages_url":"https://api.github.com/repos/excon/excon/languages","stargazers_url":"https://api.github.com/repos/excon/excon/stargazers","contributors_url":"https://api.github.com/repos/excon/excon/contributors","subscribers_url":"https://api.github.com/repos/excon/excon/subscribers","subscription_url":"https://api.github.com/repos/excon/excon/subscription","commits_url":"https://api.github.com/repos/excon/excon/commits{/sha}","git_commits_url":"https://api.github.com/repos/excon/excon/git/commits{/sha}","comments_url":"https://api.github.com/repos/excon/excon/comments{/number}","issue_comment_url":"https://api.github.com/repos/excon/excon/issues/comments/{number}","contents_url":"https://api.github.com/repos/excon/excon/contents/{+path}","compare_url":"https://api.github.com/repos/excon/excon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/excon/excon/merges","archive_url":"https://api.github.com/repos/excon/excon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/excon/excon/downloads","issues_url":"https://api.github.com/repos/excon/excon/issues{/number}","pulls_url":"https://api.github.com/repos/excon/excon/pulls{/number}","milestones_url":"https://api.github.com/repos/excon/excon/milestones{/number}","notifications_url":"https://api.github.com/repos/excon/excon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/excon/excon/labels{/name}","releases_url":"https://api.github.com/repos/excon/excon/releases{/id}","created_at":"2009-10-25T17:50:46Z","updated_at":"2015-01-27T02:20:35Z","pushed_at":"2015-01-27T02:20:33Z","git_url":"git://github.com/excon/excon.git","ssh_url":"git@github.com:excon/excon.git","clone_url":"https://github.com/excon/excon.git","svn_url":"https://github.com/excon/excon","homepage":"http://excon.io","size":3400,"stargazers_count":574,"watchers_count":574,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":137,"mirror_url":null,"open_issues_count":52,"forks":137,"open_issues":52,"watchers":574,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/excon/excon/pulls/455"},"html":{"href":"https://github.com/excon/excon/pull/455"},"issue":{"href":"https://api.github.com/repos/excon/excon/issues/455"},"comments":{"href":"https://api.github.com/repos/excon/excon/issues/455/comments"},"review_comments":{"href":"https://api.github.com/repos/excon/excon/pulls/455/comments"},"review_comment":{"href":"https://api.github.com/repos/excon/excon/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/excon/excon/pulls/455/commits"},"statuses":{"href":"https://api.github.com/repos/excon/excon/statuses/987e7812c0660930feedd26630e9a6fb1ccea27a"}}}}