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

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

Issue 10870080: Add SPDY request headers to DevTools. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Back to CL #6 Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_header_block_unittest.cc ('k') | net/spdy/spdy_http_utils.h » ('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_http_stream.h" 5 #include "net/spdy/spdy_http_stream.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/stringprintf.h" 15 #include "base/stringprintf.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "net/base/address_list.h" 17 #include "net/base/address_list.h"
18 #include "net/base/host_port_pair.h" 18 #include "net/base/host_port_pair.h"
19 #include "net/base/load_flags.h" 19 #include "net/base/load_flags.h"
20 #include "net/base/net_log.h" 20 #include "net/base/net_log.h"
21 #include "net/base/net_util.h" 21 #include "net/base/net_util.h"
22 #include "net/http/http_request_headers.h" 22 #include "net/http/http_request_headers.h"
23 #include "net/http/http_request_info.h" 23 #include "net/http/http_request_info.h"
24 #include "net/http/http_response_info.h" 24 #include "net/http/http_response_info.h"
25 #include "net/http/http_util.h" 25 #include "net/http/http_util.h"
26 #include "net/spdy/spdy_header_block.h"
26 #include "net/spdy/spdy_http_utils.h" 27 #include "net/spdy/spdy_http_utils.h"
27 #include "net/spdy/spdy_session.h" 28 #include "net/spdy/spdy_session.h"
28 29
29 namespace net { 30 namespace net {
30 31
31 namespace {
32
33 Value* NetLogSpdySendRequestCallback(const SpdyHeaderBlock* headers,
34 NetLog::LogLevel /* log_level */) {
35 DictionaryValue* dict = new DictionaryValue();
36 ListValue* headers_list = new ListValue();
37 for (SpdyHeaderBlock::const_iterator it = headers->begin();
38 it != headers->end(); ++it) {
39 headers_list->Append(new StringValue(base::StringPrintf(
40 "%s: %s", it->first.c_str(), it->second.c_str())));
41 }
42 dict->Set("headers", headers_list);
43 return dict;
44 }
45
46 } // namespace
47
48 SpdyHttpStream::SpdyHttpStream(SpdySession* spdy_session, 32 SpdyHttpStream::SpdyHttpStream(SpdySession* spdy_session,
49 bool direct) 33 bool direct)
50 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), 34 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
51 stream_(NULL), 35 stream_(NULL),
52 spdy_session_(spdy_session), 36 spdy_session_(spdy_session),
53 response_info_(NULL), 37 response_info_(NULL),
54 download_finished_(false), 38 download_finished_(false),
55 response_headers_received_(false), 39 response_headers_received_(false),
56 user_buffer_len_(0), 40 user_buffer_len_(0),
57 buffered_read_callback_pending_(false), 41 buffered_read_callback_pending_(false),
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 CHECK(stream_.get()); 198 CHECK(stream_.get());
215 199
216 stream_->SetDelegate(this); 200 stream_->SetDelegate(this);
217 201
218 scoped_ptr<SpdyHeaderBlock> headers(new SpdyHeaderBlock); 202 scoped_ptr<SpdyHeaderBlock> headers(new SpdyHeaderBlock);
219 CreateSpdyHeadersFromHttpRequest(*request_info_, request_headers, 203 CreateSpdyHeadersFromHttpRequest(*request_info_, request_headers,
220 headers.get(), stream_->GetProtocolVersion(), 204 headers.get(), stream_->GetProtocolVersion(),
221 direct_); 205 direct_);
222 stream_->net_log().AddEvent( 206 stream_->net_log().AddEvent(
223 NetLog::TYPE_HTTP_TRANSACTION_SPDY_SEND_REQUEST_HEADERS, 207 NetLog::TYPE_HTTP_TRANSACTION_SPDY_SEND_REQUEST_HEADERS,
224 base::Bind(&NetLogSpdySendRequestCallback, headers.get())); 208 base::Bind(&SpdyHeaderBlockNetLogCallback, headers.get()));
225 stream_->set_spdy_headers(headers.Pass()); 209 stream_->set_spdy_headers(headers.Pass());
226 210
227 stream_->SetRequestTime(request_time); 211 stream_->SetRequestTime(request_time);
228 // This should only get called in the case of a request occurring 212 // This should only get called in the case of a request occurring
229 // during server push that has already begun but hasn't finished, 213 // during server push that has already begun but hasn't finished,
230 // so we set the response's request time to be the actual one 214 // so we set the response's request time to be the actual one
231 if (response_info_) 215 if (response_info_)
232 response_info_->request_time = request_time; 216 response_info_->request_time = request_time;
233 217
234 CHECK(!request_body_stream_.get()); 218 CHECK(!request_body_stream_.get());
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 bool SpdyHttpStream::IsSpdyHttpStream() const { 542 bool SpdyHttpStream::IsSpdyHttpStream() const {
559 return true; 543 return true;
560 } 544 }
561 545
562 void SpdyHttpStream::Drain(HttpNetworkSession* session) { 546 void SpdyHttpStream::Drain(HttpNetworkSession* session) {
563 Close(false); 547 Close(false);
564 delete this; 548 delete this;
565 } 549 }
566 550
567 } // namespace net 551 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_header_block_unittest.cc ('k') | net/spdy/spdy_http_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698