{"action":"created","comment":{"url":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/comments/168955763","pull_request_review_id":97407001,"id":168955763,"diff_hunk":"@@ -30,314 +31,322 @@\n #include \"requestparser.h\"\n \n #include <QDebug>\n-#include <QDir>\n+#include <QRegularExpression>\n #include <QStringList>\n #include <QUrl>\n #include <QUrlQuery>\n \n-const QByteArray EOL(\"\\r\\n\");\n-const QByteArray EOH(\"\\r\\n\\r\\n\");\n+#include \"base/utils/string.h\"\n \n-inline QString unquoted(const QString &str)\n+using namespace Http;\n+using QStringPair = QPair<QString, QString>;\n+\n+namespace\n {\n-    if ((str[0] == '\\\"') && (str[str.length() - 1] == '\\\"'))\n-        return str.mid(1, str.length() - 2);\n+    const QByteArray EOH = QByteArray(CRLF).repeated(2);\n \n-    return str;\n-}\n+    QByteArray chopIfEndsWith(QByteArray in, const QByteArray &str)\n+    {\n+        if (in.endsWith(str))\n+            in.chop(str.size());\n+        return in;\n+    }\n \n-using namespace Http;\n+    QList<QByteArray> split(const QByteArray &in, const QByteArray &sep, const QString::SplitBehavior behavior = QString::KeepEmptyParts)\n+    {\n+        // mimic QString::split(sep, behavior)\n \n-RequestParser::ErrorCode RequestParser::parse(const QByteArray &data, Request &request, uint maxContentLength)\n-{\n-    return RequestParser(maxContentLength).parseHttpRequest(data, request);\n+        if (sep.isEmpty())\n+            return {in};\n+\n+        QList<QByteArray> ret;\n+\n+        int head = 0;\n+        while (head < in.size()) {\n+            int end = in.indexOf(sep, head);\n+            if (end < 0)\n+                end = in.size();\n+\n+            // omit empty parts\n+            const QByteArray part((in.constData() + head), (end - head));\n+            if (!part.isEmpty() || (behavior == QString::KeepEmptyParts))\n+                ret += part;\n+\n+            head = end + sep.size();\n+        }\n+\n+        return ret;\n+    }\n+\n+    QByteArray viewMid(const QByteArray &in, const int pos, const int len = -1)","path":"src/base/http/requestparser.cpp","position":70,"original_position":70,"commit_id":"a91c1214413ff5130b7357ab8c102c1cebe6370f","original_commit_id":"a91c1214413ff5130b7357ab8c102c1cebe6370f","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":"yes, fixed.","created_at":"2018-02-18T15:41:46Z","updated_at":"2018-02-18T15:41:47Z","html_url":"https://github.com/qbittorrent/qBittorrent/pull/8427#discussion_r168955763","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/168955763"},"html":{"href":"https://github.com/qbittorrent/qBittorrent/pull/8427#discussion_r168955763"},"pull_request":{"href":"https://api.github.com/repos/qbittorrent/qBittorrent/pulls/8427"}},"in_reply_to_id":168952047},"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-18T15:41:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"768020caad3764780474618c8443e8bdae709949","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":16,"closed_issues":6,"state":"open","created_at":"2018-01-23T17:05:19Z","updated_at":"2018-02-18T15:21:51Z","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/a91c1214413ff5130b7357ab8c102c1cebe6370f","head":{"label":"Chocobo1:server2","ref":"server2","sha":"a91c1214413ff5130b7357ab8c102c1cebe6370f","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-18T06:38:55Z","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":156806,"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-18T08:00:16Z","pushed_at":"2018-02-18T15:21:51Z","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":3845,"watchers_count":3845,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":764,"mirror_url":null,"archived":false,"open_issues_count":2842,"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":764,"open_issues":2842,"watchers":3845,"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/a91c1214413ff5130b7357ab8c102c1cebe6370f"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"Chocobo1"}}