summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/InspectorServer/HTTPRequest.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-05-30 12:48:17 +0200
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-05-30 12:48:17 +0200
commit881da28418d380042aa95a97f0cbd42560a64f7c (patch)
treea794dff3274695e99c651902dde93d934ea7a5af /Source/WebKit2/UIProcess/InspectorServer/HTTPRequest.cpp
parent7e104c57a70fdf551bb3d22a5d637cdcbc69dbea (diff)
parent0fcedcd17cc00d3dd44c718b3cb36c1033319671 (diff)
downloadqtwebkit-881da28418d380042aa95a97f0cbd42560a64f7c.tar.gz
Merge 'wip/next' into dev
Change-Id: Iff9ee5e23bb326c4371ec8ed81d56f2f05d680e9
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)