summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/InspectorServer/HTTPRequest.cpp
diff options
context:
space:
mode:
authorKonstantin Tokarev <annulen@yandex.ru>2016-08-25 19:20:41 +0300
committerKonstantin Tokarev <annulen@yandex.ru>2017-02-02 12:30:55 +0000
commit6882a04fb36642862b11efe514251d32070c3d65 (patch)
treeb7959826000b061fd5ccc7512035c7478742f7b0 /Source/WebKit2/UIProcess/InspectorServer/HTTPRequest.cpp
parentab6df191029eeeb0b0f16f127d553265659f739e (diff)
downloadqtwebkit-6882a04fb36642862b11efe514251d32070c3d65.tar.gz
Imported QtWebKit TP3 (git b57bc6801f1876c3220d5a4bfea33d620d477443)
Change-Id: I3b1d8a2808782c9f34d50240000e20cb38d3680f Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebKit2/UIProcess/InspectorServer/HTTPRequest.cpp')
-rw-r--r--Source/WebKit2/UIProcess/InspectorServer/HTTPRequest.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/Source/WebKit2/UIProcess/InspectorServer/HTTPRequest.cpp b/Source/WebKit2/UIProcess/InspectorServer/HTTPRequest.cpp
index 734926c6c..5be2e9d2f 100644
--- a/Source/WebKit2/UIProcess/InspectorServer/HTTPRequest.cpp
+++ b/Source/WebKit2/UIProcess/InspectorServer/HTTPRequest.cpp
@@ -74,7 +74,7 @@ size_t HTTPRequest::parseRequestLine(const char* data, size_t length, String& fa
{
String url;
size_t result = parseHTTPRequestLine(data, length, failureReason, m_requestMethod, url, m_httpVersion);
- m_url = KURL(KURL(), url);
+ m_url = URL(URL(), url);
return result;
}
@@ -82,7 +82,7 @@ size_t HTTPRequest::parseHeaders(const char* data, size_t length, String& failur
{
const char* p = data;
const char* end = data + length;
- AtomicString name;
+ String name;
String value;
for (; p < data + length; p++) {
size_t consumedLength = parseHTTPHeader(p, end - p, failureReason, name, value);
@@ -93,6 +93,13 @@ size_t HTTPRequest::parseHeaders(const char* data, size_t length, String& failur
break;
m_headerFields.add(name, value);
}
+
+ // If we got here and "name" is empty, it means the headers are valid and ended with a
+ // blank line (parseHTTPHeader returns "name" as empty if parsing a blank line), otherwise
+ // the headers didn't end with a blank line and we have an invalid request.
+ // See also http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html
+ if (!name.isEmpty())
+ return 0;
return p - data;
}
@@ -106,7 +113,7 @@ HTTPRequest::HTTPRequest()
{
}
-HTTPRequest::HTTPRequest(const String& requestMethod, const KURL& url, HTTPVersion version)
+HTTPRequest::HTTPRequest(const String& requestMethod, const URL& url, HTTPVersion version)
: m_url(url)
, m_httpVersion(version)
, m_requestMethod(requestMethod)