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

Side by Side Diff: net/quic/quic_stream_factory.h

Issue 1140153003: Disable 0RTT if server and origin have different hosts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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) 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 #ifndef NET_QUIC_QUIC_STREAM_FACTORY_H_ 5 #ifndef NET_QUIC_QUIC_STREAM_FACTORY_H_
6 #define NET_QUIC_QUIC_STREAM_FACTORY_H_ 6 #define NET_QUIC_QUIC_STREAM_FACTORY_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // cancel the request with the factory. 51 // cancel the request with the factory.
52 class NET_EXPORT_PRIVATE QuicStreamRequest { 52 class NET_EXPORT_PRIVATE QuicStreamRequest {
53 public: 53 public:
54 explicit QuicStreamRequest(QuicStreamFactory* factory); 54 explicit QuicStreamRequest(QuicStreamFactory* factory);
55 ~QuicStreamRequest(); 55 ~QuicStreamRequest();
56 56
57 // For http, |is_https| is false. 57 // For http, |is_https| is false.
58 int Request(const HostPortPair& host_port_pair, 58 int Request(const HostPortPair& host_port_pair,
59 bool is_https, 59 bool is_https,
60 PrivacyMode privacy_mode, 60 PrivacyMode privacy_mode,
61 base::StringPiece origin_host,
61 base::StringPiece method, 62 base::StringPiece method,
62 const BoundNetLog& net_log, 63 const BoundNetLog& net_log,
63 const CompletionCallback& callback); 64 const CompletionCallback& callback);
64 65
65 void OnRequestComplete(int rv); 66 void OnRequestComplete(int rv);
66 67
67 scoped_ptr<QuicHttpStream> ReleaseStream(); 68 scoped_ptr<QuicHttpStream> ReleaseStream();
68 69
69 void set_stream(scoped_ptr<QuicHttpStream> stream); 70 void set_stream(scoped_ptr<QuicHttpStream> stream);
70 71
71 const BoundNetLog& net_log() const{ 72 const BoundNetLog& net_log() const{
72 return net_log_; 73 return net_log_;
73 } 74 }
74 75
75 private: 76 private:
76 QuicStreamFactory* factory_; 77 QuicStreamFactory* factory_;
77 HostPortPair host_port_pair_; 78 HostPortPair host_port_pair_;
79 std::string origin_host_;
78 BoundNetLog net_log_; 80 BoundNetLog net_log_;
79 CompletionCallback callback_; 81 CompletionCallback callback_;
80 scoped_ptr<QuicHttpStream> stream_; 82 scoped_ptr<QuicHttpStream> stream_;
81 83
82 DISALLOW_COPY_AND_ASSIGN(QuicStreamRequest); 84 DISALLOW_COPY_AND_ASSIGN(QuicStreamRequest);
83 }; 85 };
84 86
85 // A factory for creating new QuicHttpStreams on top of a pool of 87 // A factory for creating new QuicHttpStreams on top of a pool of
86 // QuicClientSessions. 88 // QuicClientSessions.
87 class NET_EXPORT_PRIVATE QuicStreamFactory 89 class NET_EXPORT_PRIVATE QuicStreamFactory
(...skipping 27 matching lines...) Expand all
115 ~QuicStreamFactory() override; 117 ~QuicStreamFactory() override;
116 118
117 // Creates a new QuicHttpStream to |host_port_pair| which will be 119 // Creates a new QuicHttpStream to |host_port_pair| which will be
118 // owned by |request|. |is_https| specifies if the protocol is https or not. 120 // owned by |request|. |is_https| specifies if the protocol is https or not.
119 // If a matching session already exists, this method will return OK. If no 121 // If a matching session already exists, this method will return OK. If no
120 // matching session exists, this will return ERR_IO_PENDING and will invoke 122 // matching session exists, this will return ERR_IO_PENDING and will invoke
121 // OnRequestComplete asynchronously. 123 // OnRequestComplete asynchronously.
122 int Create(const HostPortPair& host_port_pair, 124 int Create(const HostPortPair& host_port_pair,
123 bool is_https, 125 bool is_https,
124 PrivacyMode privacy_mode, 126 PrivacyMode privacy_mode,
127 bool server_and_origin_have_same_host,
125 base::StringPiece method, 128 base::StringPiece method,
126 const BoundNetLog& net_log, 129 const BoundNetLog& net_log,
127 QuicStreamRequest* request); 130 QuicStreamRequest* request);
128 131
129 // Returns false if |packet_loss_rate| is less than |packet_loss_threshold_| 132 // Returns false if |packet_loss_rate| is less than |packet_loss_threshold_|
130 // otherwise it returns true and closes the session and marks QUIC as recently 133 // otherwise it returns true and closes the session and marks QUIC as recently
131 // broken for the port of the session. Increments 134 // broken for the port of the session. Increments
132 // |number_of_lossy_connections_| by port. 135 // |number_of_lossy_connections_| by port.
133 bool OnHandshakeConfirmed(QuicClientSession* session, float packet_loss_rate); 136 bool OnHandshakeConfirmed(QuicClientSession* session, float packet_loss_rate);
134 137
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 // |crypto_config_| with the information in |server_info|. 270 // |crypto_config_| with the information in |server_info|.
268 void InitializeCachedStateInCryptoConfig( 271 void InitializeCachedStateInCryptoConfig(
269 const QuicServerId& server_id, 272 const QuicServerId& server_id,
270 const scoped_ptr<QuicServerInfo>& server_info); 273 const scoped_ptr<QuicServerInfo>& server_info);
271 274
272 void ProcessGoingAwaySession(QuicClientSession* session, 275 void ProcessGoingAwaySession(QuicClientSession* session,
273 const QuicServerId& server_id, 276 const QuicServerId& server_id,
274 bool was_session_active); 277 bool was_session_active);
275 278
276 bool require_confirmation_; 279 bool require_confirmation_;
280 // True iff server and origin have the same hostname.
Ryan Hamilton 2015/05/18 14:29:52 nit: iff is not very common in comments. I think "
Bence 2015/05/18 15:17:55 I am fine with not using iff if it is not common e
Ryan Hamilton 2015/05/18 16:21:54 Yeah, I totally understand the sentiment. It seems
Bence 2015/05/18 18:12:02 I totally agree. However, it is not clear to me a
281 bool server_and_origin_have_same_host_;
Ryan Hamilton 2015/05/18 14:29:52 Wait, this is surprising. This is a member of the
Bence 2015/05/18 15:17:55 Good catch, sorry about that. Done.
277 HostResolver* host_resolver_; 282 HostResolver* host_resolver_;
278 ClientSocketFactory* client_socket_factory_; 283 ClientSocketFactory* client_socket_factory_;
279 base::WeakPtr<HttpServerProperties> http_server_properties_; 284 base::WeakPtr<HttpServerProperties> http_server_properties_;
280 TransportSecurityState* transport_security_state_; 285 TransportSecurityState* transport_security_state_;
281 QuicServerInfoFactory* quic_server_info_factory_; 286 QuicServerInfoFactory* quic_server_info_factory_;
282 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory_; 287 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory_;
283 QuicRandom* random_generator_; 288 QuicRandom* random_generator_;
284 scoped_ptr<QuicClock> clock_; 289 scoped_ptr<QuicClock> clock_;
285 const size_t max_packet_length_; 290 const size_t max_packet_length_;
286 291
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 base::TaskRunner* task_runner_; 374 base::TaskRunner* task_runner_;
370 375
371 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; 376 base::WeakPtrFactory<QuicStreamFactory> weak_factory_;
372 377
373 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); 378 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory);
374 }; 379 };
375 380
376 } // namespace net 381 } // namespace net
377 382
378 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ 383 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698