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

Side by Side Diff: net/quic/quic_client_promised_info.cc

Issue 1692253004: QUIC - chromium server push support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initial for-review version Created 4 years, 10 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
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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/quic/quic_client_promised_info.h" 5 #include "net/quic/quic_client_promised_info.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/quic/spdy_utils.h" 8 #include "net/quic/spdy_utils.h"
9 9
10 using net::SpdyHeaderBlock; 10 using net::SpdyHeaderBlock;
(...skipping 19 matching lines...) Expand all
30 } 30 }
31 31
32 void QuicClientPromisedInfo::Init() { 32 void QuicClientPromisedInfo::Init() {
33 cleanup_alarm_.reset( 33 cleanup_alarm_.reset(
34 helper_->CreateAlarm(new QuicClientPromisedInfo::CleanupAlarm(this))); 34 helper_->CreateAlarm(new QuicClientPromisedInfo::CleanupAlarm(this)));
35 cleanup_alarm_->Set(helper_->GetClock()->ApproximateNow().Add( 35 cleanup_alarm_->Set(helper_->GetClock()->ApproximateNow().Add(
36 QuicTime::Delta::FromSeconds(kPushPromiseTimeoutSecs))); 36 QuicTime::Delta::FromSeconds(kPushPromiseTimeoutSecs)));
37 } 37 }
38 38
39 void QuicClientPromisedInfo::OnPromiseHeaders(const SpdyHeaderBlock& headers) { 39 void QuicClientPromisedInfo::OnPromiseHeaders(const SpdyHeaderBlock& headers) {
40 // RFC7540, Section 8.2, requests MUST be safe [RFC7231], Section
41 // 4.2.1. GET and HEAD are the methods that are safe and required.
42 SpdyHeaderBlock::const_iterator it = headers.find(":method");
43 DCHECK(it != headers.end());
44 if (!(it->second == "GET" || it->second == "HEAD")) {
45 DVLOG(1) << "Promise for stream " << id_ << " has invalid method "
46 << it->second;
47 Reset(QUIC_INVALID_PROMISE_METHOD);
48 return;
49 }
40 if (!SpdyUtils::UrlIsValid(headers)) { 50 if (!SpdyUtils::UrlIsValid(headers)) {
41 DVLOG(1) << "Promise for stream " << id_ << " has invalid URL " << url_; 51 DVLOG(1) << "Promise for stream " << id_ << " has invalid URL " << url_;
42 Reset(QUIC_INVALID_PROMISE_URL); 52 Reset(QUIC_INVALID_PROMISE_URL);
43 return; 53 return;
44 } 54 }
45 if (!session_->IsAuthorized(SpdyUtils::GetHostNameFromHeaderBlock(headers))) { 55 if (!session_->IsAuthorized(SpdyUtils::GetHostNameFromHeaderBlock(headers))) {
46 Reset(QUIC_UNAUTHORIZED_PROMISE_URL); 56 Reset(QUIC_UNAUTHORIZED_PROMISE_URL);
47 return; 57 return;
48 } 58 }
49 request_headers_.reset(new SpdyHeaderBlock(headers)); 59 request_headers_.reset(new SpdyHeaderBlock(headers));
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 return FinalValidation(); 114 return FinalValidation();
105 } 115 }
106 116
107 void QuicClientPromisedInfo::Cancel() { 117 void QuicClientPromisedInfo::Cancel() {
108 // Don't fire OnRendezvousResult() for client initiated cancel. 118 // Don't fire OnRendezvousResult() for client initiated cancel.
109 client_request_delegate_ = nullptr; 119 client_request_delegate_ = nullptr;
110 Reset(QUIC_STREAM_CANCELLED); 120 Reset(QUIC_STREAM_CANCELLED);
111 } 121 }
112 122
113 } // namespace net 123 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698