Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: Source/platform/network/HTTPRequest.cpp

Issue 314083002: parseHTTPHeaders should return the number of consumed bytes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@async-initializer
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/platform/network/HTTPParsersTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2011 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 m_url = KURL(KURL(), url); 74 m_url = KURL(KURL(), url);
75 return result; 75 return result;
76 } 76 }
77 77
78 size_t HTTPRequest::parseHeaders(const char* data, size_t length, String& failur eReason) 78 size_t HTTPRequest::parseHeaders(const char* data, size_t length, String& failur eReason)
79 { 79 {
80 const char* p = data; 80 const char* p = data;
81 const char* end = data + length; 81 const char* end = data + length;
82 AtomicString name; 82 AtomicString name;
83 AtomicString value; 83 AtomicString value;
84 for (; p < data + length; p++) { 84 while (p < data + length) {
85 size_t consumedLength = parseHTTPHeader(p, end - p, failureReason, name, value); 85 size_t consumedLength = parseHTTPHeader(p, end - p, failureReason, name, value);
86 if (!consumedLength) 86 if (!consumedLength)
87 return 0; 87 return 0;
88 p += consumedLength; 88 p += consumedLength;
89 if (name.isEmpty()) 89 if (name.isEmpty())
90 break; 90 break;
tyoshino (SeeGerritForStatus) 2014/06/05 08:24:15 we never reached here before your last fix?
yhirano 2014/06/05 08:33:20 Yes, when "\r\n" is consumed.
91 m_headerFields.add(name, value); 91 m_headerFields.add(name, value);
92 } 92 }
93 return p - data; 93 return p - data;
94 } 94 }
95 95
96 size_t HTTPRequest::parseRequestBody(const char* data, size_t length) 96 size_t HTTPRequest::parseRequestBody(const char* data, size_t length)
97 { 97 {
98 return parseHTTPRequestBody(data, length, m_body); 98 return parseHTTPRequestBody(data, length, m_body);
99 } 99 }
100 100
101 HTTPRequest::HTTPRequest() 101 HTTPRequest::HTTPRequest()
102 : m_httpVersion(Unknown) 102 : m_httpVersion(Unknown)
103 { 103 {
104 } 104 }
105 105
106 HTTPRequest::HTTPRequest(const String& requestMethod, const KURL& url, HTTPVersi on version) 106 HTTPRequest::HTTPRequest(const String& requestMethod, const KURL& url, HTTPVersi on version)
107 : m_url(url) 107 : m_url(url)
108 , m_httpVersion(version) 108 , m_httpVersion(version)
109 , m_requestMethod(requestMethod) 109 , m_requestMethod(requestMethod)
110 { 110 {
111 } 111 }
112 112
113 HTTPRequest::~HTTPRequest() 113 HTTPRequest::~HTTPRequest()
114 { 114 {
115 } 115 }
116 116
117 } // namespace WebCore 117 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/platform/network/HTTPParsersTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698