Index: net/http/http_util.cc |
diff --git a/net/http/http_util.cc b/net/http/http_util.cc |
index baa2eff1043a34926c328be9eeadf15d08cbf3cd..5d314d12f688d3aef71f2c2686e83962d7666825 100644 |
--- a/net/http/http_util.cc |
+++ b/net/http/http_util.cc |
@@ -542,9 +542,19 @@ int HttpUtil::LocateStartOfStatusLine(const char* buf, int buf_len) { |
return -1; // Not found |
} |
-int HttpUtil::LocateEndOfHeaders(const char* buf, int buf_len, int i) { |
- bool was_lf = false; |
+static int LocateEndOfHeadersHelper(const char* buf, |
+ int buf_len, |
+ int i, |
+ bool accept_empty_header_list) { |
char last_c = '\0'; |
+ bool was_lf = false; |
+ if (accept_empty_header_list) { |
+ // Normally two line breaks signal the end of a header list. An empty header |
+ // list ends with a single line break at the start of the buffer. |
+ last_c = '\n'; |
+ was_lf = true; |
+ } |
+ |
for (; i < buf_len; ++i) { |
char c = buf[i]; |
if (c == '\n') { |
@@ -559,6 +569,16 @@ int HttpUtil::LocateEndOfHeaders(const char* buf, int buf_len, int i) { |
return -1; |
} |
+int HttpUtil::LocateEndOfAdditionalHeaders(const char* buf, |
+ int buf_len, |
+ int i) { |
+ return LocateEndOfHeadersHelper(buf, buf_len, i, true); |
+} |
+ |
+int HttpUtil::LocateEndOfHeaders(const char* buf, int buf_len, int i) { |
+ return LocateEndOfHeadersHelper(buf, buf_len, i, false); |
+} |
+ |
// In order for a line to be continuable, it must specify a |
// non-blank header-name. Line continuations are specifically for |
// header values -- do not allow headers names to span lines. |