Commit 11e28fd6 authored by tfarina's avatar tfarina Committed by Commit bot

net: make use of base::Erase() in AssembleRawHeaders()

This simplifies the code and makes it easier to understand for the casual
reader.

https://groups.google.com/a/chromium.org/d/msg/chromium-dev/QwLhUSk6kfI/HN5-df0-AwAJ

BUG=None
TEST=net_unittests
R=eroman@chromium.org

Review-Url: https://codereview.chromium.org/2746653002
Cr-Commit-Position: refs/heads/master@{#456246}
parent 2e31bd80
......@@ -10,6 +10,7 @@
#include <algorithm>
#include "base/logging.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_tokenizer.h"
......@@ -707,8 +708,8 @@ std::string HttpUtil::AssembleRawHeaders(const char* input_begin,
// Use '\0' as the canonical line terminator. If the input already contained
// any embeded '\0' characters we will strip them first to avoid interpreting
// them as line breaks.
raw_headers.erase(std::remove(raw_headers.begin(), raw_headers.end(), '\0'),
raw_headers.end());
base::Erase(raw_headers, '\0');
std::replace(raw_headers.begin(), raw_headers.end(), '\n', '\0');
return raw_headers;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment