{"action":"created","comment":{"url":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/comments/168940662","pull_request_review_id":97392736,"id":168940662,"diff_hunk":"@@ -58,37 +60,60 @@ Connection::~Connection()\n void Connection::read()\n {\n     m_idleTimer.restart();\n-\n     m_receivedData.append(m_socket->readAll());\n-    Request request;\n-    RequestParser::ErrorCode err = RequestParser::parse(m_receivedData, request);  // TODO: transform request headers to lowercase\n-\n-    switch (err) {\n-    case RequestParser::IncompleteRequest:\n-        // Partial request waiting for the rest\n-        break;\n-\n-    case RequestParser::BadRequest:\n-        sendResponse(Response(400, \"Bad Request\"));\n-        m_receivedData.clear();\n-        break;\n-\n-    case RequestParser::NoError:\n-        const Environment env {m_socket->localAddress(), m_socket->localPort(), m_socket->peerAddress(), m_socket->peerPort()};\n-\n-        Response response = m_requestHandler->processRequest(request, env);\n-        if (acceptsGzipEncoding(request.headers[\"accept-encoding\"]))\n-            response.headers[HEADER_CONTENT_ENCODING] = \"gzip\";\n-        sendResponse(response);\n-        m_receivedData.clear();\n-        break;\n+\n+    while (!m_receivedData.isEmpty()) {\n+        const RequestParser::ParseResult result = RequestParser::parse(m_receivedData);\n+\n+        switch (result.status) {\n+        case RequestParser::ParseStatus::Incomplete: {\n+            const long bufferLimit = RequestParser::MAX_REQUEST_SIZE * 1.1;  // some margin for headers\n+            if (m_receivedData.size() > bufferLimit) {\n+                Logger::instance()->addMessage(tr(\"Http request size exceeds limiation, closing socket. Limit: %ld, IP: %s\")\n+                                               .arg(bufferLimit).arg(m_socket->peerAddress().toString()), Log::WARNING);\n+                m_socket->close();","path":"src/base/http/connection.cpp","position":62,"original_position":62,"commit_id":"5099ba3b41aa780cb3ba15820786d1e46db13c5a","original_commit_id":"5099ba3b41aa780cb3ba15820786d1e46db13c5a","user":{"login":"glassez","id":5063477,"avatar_url":"https://avatars3.githubusercontent.com/u/5063477?v=4","gravatar_id":"","url":"https://api.github.com/users/glassez","html_url":"https://github.com/glassez","followers_url":"https://api.github.com/users/glassez/followers","following_url":"https://api.github.com/users/glassez/following{/other_user}","gists_url":"https://api.github.com/users/glassez/gists{/gist_id}","starred_url":"https://api.github.com/users/glassez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glassez/subscriptions","organizations_url":"https://api.github.com/users/glassez/orgs","repos_url":"https://api.github.com/users/glassez/repos","events_url":"https://api.github.com/users/glassez/events{/privacy}","received_events_url":"https://api.github.com/users/glassez/received_events","type":"User","site_admin":false},"body":"It seems like wrong logic in this method.","created_at":"2018-02-18T05:51:07Z","updated_at":"2018-02-18T05:51:07Z","html_url":"https://github.com/qbittorrent/qBittorrent/pull/8427#discussion_r168940662","pull_request_url":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/8427","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/comments/168940662"},"html":{"href":"https://github.com/qbittorrent/qBittorrent/pull/8427#discussion_r168940662"},"pull_request":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/8427"}},"in_reply_to_id":168926553},"pull_request":{"url":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/8427","id":169675892,"html_url":"https://github.com/qbittorrent/qBittorrent/pull/8427","diff_url":"https://github.com/qbittorrent/qBittorrent/pull/8427.diff","patch_url":"https://github.com/qbittorrent/qBittorrent/pull/8427.patch","issue_url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/8427","number":8427,"state":"open","locked":false,"title":"Rewrite RequestParser","user":{"login":"Chocobo1","id":9395168,"avatar_url":"https://avatars2.githubusercontent.com/u/9395168?v=4","gravatar_id":"","url":"https://api.github.com/users/Chocobo1","html_url":"https://github.com/Chocobo1","followers_url":"https://api.github.com/users/Chocobo1/followers","following_url":"https://api.github.com/users/Chocobo1/following{/other_user}","gists_url":"https://api.github.com/users/Chocobo1/gists{/gist_id}","starred_url":"https://api.github.com/users/Chocobo1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Chocobo1/subscriptions","organizations_url":"https://api.github.com/users/Chocobo1/orgs","repos_url":"https://api.github.com/users/Chocobo1/repos","events_url":"https://api.github.com/users/Chocobo1/events{/privacy}","received_events_url":"https://api.github.com/users/Chocobo1/received_events","type":"User","site_admin":false},"body":"Major points:\r\n* Enable Http persistence connection: This enables reusing existing TCP\r\nconnection instead of opening a new connection for every request\r\n* Add more checks and also more strict checks for invalid conditions\r\n\r\nMinor points:\r\n* Add http version field\r\n* Raise max request size to 20MB\r\n* Add author in license\r\n* Use Qt5 new connect syntax\r\n","created_at":"2018-02-16T17:00:39Z","updated_at":"2018-02-18T05:51:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8b3ac5dd6134749f2dd3608e0b4d57d0660861fa","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":{"url":"https://api.github.com/repos/qbittorrent/qBittorrent/milestones/44","html_url":"https://github.com/qbittorrent/qBittorrent/milestone/44","labels_url":"https://api.github.com/repos/qbittorrent/qBittorrent/milestones/44/labels","id":3058182,"number":44,"title":"4.0.5","description":null,"creator":{"login":"glassez","id":5063477,"avatar_url":"https://avatars3.githubusercontent.com/u/5063477?v=4","gravatar_id":"","url":"https://api.github.com/users/glassez","html_url":"https://github.com/glassez","followers_url":"https://api.github.com/users/glassez/followers","following_url":"https://api.github.com/users/glassez/following{/other_user}","gists_url":"https://api.github.com/users/glassez/gists{/gist_id}","starred_url":"https://api.github.com/users/glassez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glassez/subscriptions","organizations_url":"https://api.github.com/users/glassez/orgs","repos_url":"https://api.github.com/users/glassez/repos","events_url":"https://api.github.com/users/glassez/events{/privacy}","received_events_url":"https://api.github.com/users/glassez/received_events","type":"User","site_admin":false},"open_issues":15,"closed_issues":5,"state":"open","created_at":"2018-01-23T17:05:19Z","updated_at":"2018-02-17T17:26:30Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/8427/commits","review_comments_url":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/8427/comments","review_comment_url":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/comments{/number}","comments_url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/8427/comments","statuses_url":"https://api.github.com/repos/qbittorrent/qBittorrent/statuses/5099ba3b41aa780cb3ba15820786d1e46db13c5a","head":{"label":"Chocobo1:server2","ref":"server2","sha":"5099ba3b41aa780cb3ba15820786d1e46db13c5a","user":{"login":"Chocobo1","id":9395168,"avatar_url":"https://avatars2.githubusercontent.com/u/9395168?v=4","gravatar_id":"","url":"https://api.github.com/users/Chocobo1","html_url":"https://github.com/Chocobo1","followers_url":"https://api.github.com/users/Chocobo1/followers","following_url":"https://api.github.com/users/Chocobo1/following{/other_user}","gists_url":"https://api.github.com/users/Chocobo1/gists{/gist_id}","starred_url":"https://api.github.com/users/Chocobo1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Chocobo1/subscriptions","organizations_url":"https://api.github.com/users/Chocobo1/orgs","repos_url":"https://api.github.com/users/Chocobo1/repos","events_url":"https://api.github.com/users/Chocobo1/events{/privacy}","received_events_url":"https://api.github.com/users/Chocobo1/received_events","type":"User","site_admin":false},"repo":{"id":30459428,"name":"qBittorrent","full_name":"Chocobo1/qBittorrent","owner":{"login":"Chocobo1","id":9395168,"avatar_url":"https://avatars2.githubusercontent.com/u/9395168?v=4","gravatar_id":"","url":"https://api.github.com/users/Chocobo1","html_url":"https://github.com/Chocobo1","followers_url":"https://api.github.com/users/Chocobo1/followers","following_url":"https://api.github.com/users/Chocobo1/following{/other_user}","gists_url":"https://api.github.com/users/Chocobo1/gists{/gist_id}","starred_url":"https://api.github.com/users/Chocobo1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Chocobo1/subscriptions","organizations_url":"https://api.github.com/users/Chocobo1/orgs","repos_url":"https://api.github.com/users/Chocobo1/repos","events_url":"https://api.github.com/users/Chocobo1/events{/privacy}","received_events_url":"https://api.github.com/users/Chocobo1/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Chocobo1/qBittorrent","description":"qBittorrent BitTorrent client","fork":true,"url":"https://api.github.com/repos/Chocobo1/qBittorrent","forks_url":"https://api.github.com/repos/Chocobo1/qBittorrent/forks","keys_url":"https://api.github.com/repos/Chocobo1/qBittorrent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Chocobo1/qBittorrent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Chocobo1/qBittorrent/teams","hooks_url":"https://api.github.com/repos/Chocobo1/qBittorrent/hooks","issue_events_url":"https://api.github.com/repos/Chocobo1/qBittorrent/issues/events{/number}","events_url":"https://api.github.com/repos/Chocobo1/qBittorrent/events","assignees_url":"https://api.github.com/repos/Chocobo1/qBittorrent/assignees{/user}","branches_url":"https://api.github.com/repos/Chocobo1/qBittorrent/branches{/branch}","tags_url":"https://api.github.com/repos/Chocobo1/qBittorrent/tags","blobs_url":"https://api.github.com/repos/Chocobo1/qBittorrent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Chocobo1/qBittorrent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Chocobo1/qBittorrent/git/refs{/sha}","trees_url":"https://api.github.com/repos/Chocobo1/qBittorrent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Chocobo1/qBittorrent/statuses/{sha}","languages_url":"https://api.github.com/repos/Chocobo1/qBittorrent/languages","stargazers_url":"https://api.github.com/repos/Chocobo1/qBittorrent/stargazers","contributors_url":"https://api.github.com/repos/Chocobo1/qBittorrent/contributors","subscribers_url":"https://api.github.com/repos/Chocobo1/qBittorrent/subscribers","subscription_url":"https://api.github.com/repos/Chocobo1/qBittorrent/subscription","commits_url":"https://api.github.com/repos/Chocobo1/qBittorrent/commits{/sha}","git_commits_url":"https://api.github.com/repos/Chocobo1/qBittorrent/git/commits{/sha}","comments_url":"https://api.github.com/repos/Chocobo1/qBittorrent/comments{/number}","issue_comment_url":"https://api.github.com/repos/Chocobo1/qBittorrent/issues/comments{/number}","contents_url":"https://api.github.com/repos/Chocobo1/qBittorrent/contents/{+path}","compare_url":"https://api.github.com/repos/Chocobo1/qBittorrent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Chocobo1/qBittorrent/merges","archive_url":"https://api.github.com/repos/Chocobo1/qBittorrent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Chocobo1/qBittorrent/downloads","issues_url":"https://api.github.com/repos/Chocobo1/qBittorrent/issues{/number}","pulls_url":"https://api.github.com/repos/Chocobo1/qBittorrent/pulls{/number}","milestones_url":"https://api.github.com/repos/Chocobo1/qBittorrent/milestones{/number}","notifications_url":"https://api.github.com/repos/Chocobo1/qBittorrent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Chocobo1/qBittorrent/labels{/name}","releases_url":"https://api.github.com/repos/Chocobo1/qBittorrent/releases{/id}","deployments_url":"https://api.github.com/repos/Chocobo1/qBittorrent/deployments","created_at":"2015-02-07T15:14:20Z","updated_at":"2016-10-24T16:37:49Z","pushed_at":"2018-02-16T17:41:16Z","git_url":"git://github.com/Chocobo1/qBittorrent.git","ssh_url":"git@github.com:Chocobo1/qBittorrent.git","clone_url":"https://github.com/Chocobo1/qBittorrent.git","svn_url":"https://github.com/Chocobo1/qBittorrent","homepage":"http://www.qbittorrent.org","size":156808,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0"},"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"qbittorrent:master","ref":"master","sha":"98a1c111b90b4ae75da3113320e0f0c7562cb8ca","user":{"login":"qbittorrent","id":2131270,"avatar_url":"https://avatars2.githubusercontent.com/u/2131270?v=4","gravatar_id":"","url":"https://api.github.com/users/qbittorrent","html_url":"https://github.com/qbittorrent","followers_url":"https://api.github.com/users/qbittorrent/followers","following_url":"https://api.github.com/users/qbittorrent/following{/other_user}","gists_url":"https://api.github.com/users/qbittorrent/gists{/gist_id}","starred_url":"https://api.github.com/users/qbittorrent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qbittorrent/subscriptions","organizations_url":"https://api.github.com/users/qbittorrent/orgs","repos_url":"https://api.github.com/users/qbittorrent/repos","events_url":"https://api.github.com/users/qbittorrent/events{/privacy}","received_events_url":"https://api.github.com/users/qbittorrent/received_events","type":"Organization","site_admin":false},"repo":{"id":3351871,"name":"qBittorrent","full_name":"qbittorrent/qBittorrent","owner":{"login":"qbittorrent","id":2131270,"avatar_url":"https://avatars2.githubusercontent.com/u/2131270?v=4","gravatar_id":"","url":"https://api.github.com/users/qbittorrent","html_url":"https://github.com/qbittorrent","followers_url":"https://api.github.com/users/qbittorrent/followers","following_url":"https://api.github.com/users/qbittorrent/following{/other_user}","gists_url":"https://api.github.com/users/qbittorrent/gists{/gist_id}","starred_url":"https://api.github.com/users/qbittorrent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qbittorrent/subscriptions","organizations_url":"https://api.github.com/users/qbittorrent/orgs","repos_url":"https://api.github.com/users/qbittorrent/repos","events_url":"https://api.github.com/users/qbittorrent/events{/privacy}","received_events_url":"https://api.github.com/users/qbittorrent/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/qbittorrent/qBittorrent","description":"qBittorrent BitTorrent client","fork":false,"url":"https://api.github.com/repos/qbittorrent/qBittorrent","forks_url":"https://api.github.com/repos/qbittorrent/qBittorrent/forks","keys_url":"https://api.github.com/repos/qbittorrent/qBittorrent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/qbittorrent/qBittorrent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/qbittorrent/qBittorrent/teams","hooks_url":"https://api.github.com/repos/qbittorrent/qBittorrent/hooks","issue_events_url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/events{/number}","events_url":"https://api.github.com/repos/qbittorrent/qBittorrent/events","assignees_url":"https://api.github.com/repos/qbittorrent/qBittorrent/assignees{/user}","branches_url":"https://api.github.com/repos/qbittorrent/qBittorrent/branches{/branch}","tags_url":"https://api.github.com/repos/qbittorrent/qBittorrent/tags","blobs_url":"https://api.github.com/repos/qbittorrent/qBittorrent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/qbittorrent/qBittorrent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/qbittorrent/qBittorrent/git/refs{/sha}","trees_url":"https://api.github.com/repos/qbittorrent/qBittorrent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/qbittorrent/qBittorrent/statuses/{sha}","languages_url":"https://api.github.com/repos/qbittorrent/qBittorrent/languages","stargazers_url":"https://api.github.com/repos/qbittorrent/qBittorrent/stargazers","contributors_url":"https://api.github.com/repos/qbittorrent/qBittorrent/contributors","subscribers_url":"https://api.github.com/repos/qbittorrent/qBittorrent/subscribers","subscription_url":"https://api.github.com/repos/qbittorrent/qBittorrent/subscription","commits_url":"https://api.github.com/repos/qbittorrent/qBittorrent/commits{/sha}","git_commits_url":"https://api.github.com/repos/qbittorrent/qBittorrent/git/commits{/sha}","comments_url":"https://api.github.com/repos/qbittorrent/qBittorrent/comments{/number}","issue_comment_url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/comments{/number}","contents_url":"https://api.github.com/repos/qbittorrent/qBittorrent/contents/{+path}","compare_url":"https://api.github.com/repos/qbittorrent/qBittorrent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/qbittorrent/qBittorrent/merges","archive_url":"https://api.github.com/repos/qbittorrent/qBittorrent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/qbittorrent/qBittorrent/downloads","issues_url":"https://api.github.com/repos/qbittorrent/qBittorrent/issues{/number}","pulls_url":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls{/number}","milestones_url":"https://api.github.com/repos/qbittorrent/qBittorrent/milestones{/number}","notifications_url":"https://api.github.com/repos/qbittorrent/qBittorrent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/qbittorrent/qBittorrent/labels{/name}","releases_url":"https://api.github.com/repos/qbittorrent/qBittorrent/releases{/id}","deployments_url":"https://api.github.com/repos/qbittorrent/qBittorrent/deployments","created_at":"2012-02-04T09:37:46Z","updated_at":"2018-02-18T00:13:56Z","pushed_at":"2018-02-18T02:25:48Z","git_url":"git://github.com/qbittorrent/qBittorrent.git","ssh_url":"git@github.com:qbittorrent/qBittorrent.git","clone_url":"https://github.com/qbittorrent/qBittorrent.git","svn_url":"https://github.com/qbittorrent/qBittorrent","homepage":"https://www.qbittorrent.org","size":161494,"stargazers_count":3844,"watchers_count":3844,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":765,"mirror_url":null,"archived":false,"open_issues_count":2839,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0"},"forks":765,"open_issues":2839,"watchers":3844,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/8427"},"html":{"href":"https://github.com/qbittorrent/qBittorrent/pull/8427"},"issue":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/8427"},"comments":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/issues/8427/comments"},"review_comments":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/8427/comments"},"review_comment":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/8427/commits"},"statuses":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/statuses/5099ba3b41aa780cb3ba15820786d1e46db13c5a"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"glassez"}}