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

Side by Side Diff: net/spdy/spdy_stream.cc

Issue 1357953002: Replace the existing SpdyHeaderBlock typedef with a class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add NET_EXPORT to fix compile error on win_chromium_compile_dbg_ng. Created 5 years, 2 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 | « net/spdy/spdy_session_unittest.cc ('k') | net/spdy/spdy_stream_test_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/spdy/spdy_stream.h" 5 #include "net/spdy/spdy_stream.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 if (new_response_headers.find("transfer-encoding") != 875 if (new_response_headers.find("transfer-encoding") !=
876 new_response_headers.end()) { 876 new_response_headers.end()) {
877 session_->ResetStream(stream_id_, RST_STREAM_PROTOCOL_ERROR, 877 session_->ResetStream(stream_id_, RST_STREAM_PROTOCOL_ERROR,
878 "Received transfer-encoding header"); 878 "Received transfer-encoding header");
879 return ERR_SPDY_PROTOCOL_ERROR; 879 return ERR_SPDY_PROTOCOL_ERROR;
880 } 880 }
881 881
882 for (SpdyHeaderBlock::const_iterator it = new_response_headers.begin(); 882 for (SpdyHeaderBlock::const_iterator it = new_response_headers.begin();
883 it != new_response_headers.end(); ++it) { 883 it != new_response_headers.end(); ++it) {
884 // Disallow uppercase headers. 884 // Disallow uppercase headers.
885 if (ContainsUppercaseAscii(it->first)) { 885 if (ContainsUppercaseAscii(it->first.as_string())) {
886 session_->ResetStream(stream_id_, RST_STREAM_PROTOCOL_ERROR, 886 session_->ResetStream(
887 "Upper case characters in header: " + it->first); 887 stream_id_, RST_STREAM_PROTOCOL_ERROR,
888 "Upper case characters in header: " + it->first.as_string());
888 return ERR_SPDY_PROTOCOL_ERROR; 889 return ERR_SPDY_PROTOCOL_ERROR;
889 } 890 }
890 891
891 SpdyHeaderBlock::iterator it2 = response_headers_.lower_bound(it->first); 892 SpdyHeaderBlock::iterator it2 =
893 response_headers_.find(it->first.as_string());
892 // Disallow duplicate headers. This is just to be conservative. 894 // Disallow duplicate headers. This is just to be conservative.
893 if (it2 != response_headers_.end() && it2->first == it->first) { 895 if (it2 != response_headers_.end()) {
894 session_->ResetStream(stream_id_, RST_STREAM_PROTOCOL_ERROR, 896 session_->ResetStream(stream_id_, RST_STREAM_PROTOCOL_ERROR,
895 "Duplicate header: " + it->first); 897 "Duplicate header: " + it->first.as_string());
896 return ERR_SPDY_PROTOCOL_ERROR; 898 return ERR_SPDY_PROTOCOL_ERROR;
897 } 899 }
898 900
899 response_headers_.insert(it2, *it); 901 response_headers_.insert(*it);
900 } 902 }
901 903
902 // If delegate_ is not yet attached, we'll call 904 // If delegate_ is not yet attached, we'll call
903 // OnResponseHeadersUpdated() after the delegate gets attached to 905 // OnResponseHeadersUpdated() after the delegate gets attached to
904 // the stream. 906 // the stream.
905 if (delegate_) { 907 if (delegate_) {
906 // The call to OnResponseHeadersUpdated() below may delete |this|, 908 // The call to OnResponseHeadersUpdated() below may delete |this|,
907 // so use |weak_this| to detect that. 909 // so use |weak_this| to detect that.
908 base::WeakPtr<SpdyStream> weak_this = GetWeakPtr(); 910 base::WeakPtr<SpdyStream> weak_this = GetWeakPtr();
909 911
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, 946 description = base::StringPrintf("Unknown state 0x%08X (%u)", state,
945 state); 947 state);
946 break; 948 break;
947 } 949 }
948 return description; 950 return description;
949 } 951 }
950 952
951 #undef STATE_CASE 953 #undef STATE_CASE
952 954
953 } // namespace net 955 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session_unittest.cc ('k') | net/spdy/spdy_stream_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698