Revert of Update WV test license server config to use portable sdk server. (https...
[chromium-blink-merge.git] / net / spdy / hpack_encoder.cc
blob3755cc14dbd9d2459085d3b12996bdd704078fef
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "net/spdy/hpack_encoder.h"
7 #include "net/spdy/hpack_output_stream.h"
9 namespace net {
11 using std::string;
13 HpackEncoder::HpackEncoder(uint32 max_string_literal_size)
14 : max_string_literal_size_(max_string_literal_size) {}
16 HpackEncoder::~HpackEncoder() {}
18 bool HpackEncoder::EncodeHeaderSet(const std::map<string, string>& header_set,
19 string* output) {
20 // TOOD(akalin): Do more sophisticated encoding.
21 HpackOutputStream output_stream(max_string_literal_size_);
22 for (std::map<string, string>::const_iterator it = header_set.begin();
23 it != header_set.end(); ++it) {
24 // TODO(akalin): Clarify in the spec that encoding with the name
25 // as a literal is OK even if the name already exists in the
26 // header table.
27 if (!output_stream.AppendLiteralHeaderNoIndexingWithName(
28 it->first, it->second)) {
29 return false;
32 output_stream.TakeString(output);
33 return true;
36 } // namespace net