Chromium Code Reviews| Index: net/http/http_util.cc |
| =================================================================== |
| --- net/http/http_util.cc (revision 100022) |
| +++ net/http/http_util.cc (working copy) |
| @@ -547,7 +547,7 @@ |
| raw_headers.append(FindFirstNonLWS(line_begin, line_end), line_end); |
| } else { |
| // Terminate the previous line. |
| - raw_headers.push_back('\0'); |
| + raw_headers.push_back('\n'); |
| // Copy the raw data to output. |
| raw_headers.append(line_begin, line_end); |
| @@ -557,7 +557,15 @@ |
| } |
| } |
| - raw_headers.append("\0\0", 2); |
| + raw_headers.append("\n\n", 2); |
| + |
| + // Use '\0' as the canonical line terminator. If the input already contained |
| + // any embeded NULLs we will strip them first to avoid interpreting them as |
|
wtc
2011/09/12 18:48:09
Nit: NULLs => '\0' characters
for consistenty.
eroman
2011/09/12 21:19:24
Done.
|
| + // line breaks. |
| + raw_headers.erase(std::remove(raw_headers.begin(), raw_headers.end(), '\0'), |
| + raw_headers.end()); |
| + std::replace(raw_headers.begin(), raw_headers.end(), '\n', '\0'); |
|
wtc
2011/09/12 18:48:09
This seems a high cost (two extra linear scans of
eroman
2011/09/12 21:19:24
I did some performance tests for moderate sized he
|
| + |
| return raw_headers; |
| } |