OLD | NEW |
---|---|
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_session.h" | 5 #include "net/spdy/spdy_session.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <map> | 9 #include <map> |
10 #include <utility> | 10 #include <utility> |
(...skipping 2467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2478 headers, response_time, recv_first_byte_time, stream)); | 2478 headers, response_time, recv_first_byte_time, stream)); |
2479 } else { | 2479 } else { |
2480 int rv = stream->OnAdditionalResponseHeadersReceived(headers); | 2480 int rv = stream->OnAdditionalResponseHeadersReceived(headers); |
2481 if (rv < 0) { | 2481 if (rv < 0) { |
2482 DCHECK_NE(rv, ERR_IO_PENDING); | 2482 DCHECK_NE(rv, ERR_IO_PENDING); |
2483 DCHECK(active_streams_.find(stream_id) == active_streams_.end()); | 2483 DCHECK(active_streams_.find(stream_id) == active_streams_.end()); |
2484 } | 2484 } |
2485 } | 2485 } |
2486 } | 2486 } |
2487 | 2487 |
2488 void SpdySession::OnAltSvc( | |
2489 SpdyStreamId stream_id, | |
2490 base::StringPiece origin, | |
2491 const SpdyAltSvcWireFormat::AlternativeServiceVector& altsvc_vector) { | |
2492 if (!is_secure_) | |
2493 return; | |
2494 | |
2495 url::SchemeHostPort scheme_host_port; | |
2496 if (stream_id == 0) { | |
2497 if (origin.empty()) | |
2498 return; | |
Ryan Hamilton
2016/06/03 19:05:18
I'm surprised that this is, in the spec, to be ign
Bence
2016/06/03 20:57:52
Acknowledged.
| |
2499 const GURL gurl(origin); | |
2500 if (!gurl.SchemeIs("https")) | |
2501 return; | |
2502 SSLInfo ssl_info; | |
2503 bool was_npn_negotiated; | |
2504 NextProto protocol_negotiated = kProtoUnknown; | |
2505 if (!GetSSLInfo(&ssl_info, &was_npn_negotiated, &protocol_negotiated)) | |
2506 return; | |
2507 if (!CanPool(transport_security_state_, ssl_info, host_port_pair().host(), | |
2508 gurl.host())) { | |
2509 return; | |
2510 } | |
2511 scheme_host_port = url::SchemeHostPort(gurl); | |
2512 } else { | |
2513 if (!origin.empty()) | |
2514 return; | |
2515 const ActiveStreamMap::iterator it = active_streams_.find(stream_id); | |
2516 if (it == active_streams_.end()) | |
2517 return; | |
2518 const GURL& gurl(it->second.stream->url()); | |
2519 if (!gurl.SchemeIs("https")) | |
2520 return; | |
2521 scheme_host_port = url::SchemeHostPort(gurl); | |
2522 } | |
2523 | |
2524 AlternativeServiceInfoVector alternative_service_info_vector; | |
Ryan Hamilton
2016/06/03 19:05:18
I think there's a constructor you can call to set
Bence
2016/06/03 20:57:52
Didn't find a constructor call, how about std::vec
Ryan Hamilton
2016/06/03 21:26:18
Does this work?
http://en.cppreference.com/w/cpp/
Bence
2016/06/04 02:43:55
It could work, but note that the for loop can skip
| |
2525 const base::Time now(base::Time::Now()); | |
2526 for (const SpdyAltSvcWireFormat::AlternativeService& altsvc : altsvc_vector) { | |
2527 const AlternateProtocol protocol = | |
2528 AlternateProtocolFromString(altsvc.protocol_id); | |
2529 if (protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) | |
2530 continue; | |
2531 const AlternativeService alternative_service(protocol, altsvc.host, | |
2532 altsvc.port); | |
2533 const base::Time expiration = | |
2534 now + base::TimeDelta::FromSeconds(altsvc.max_age); | |
2535 alternative_service_info_vector.push_back( | |
2536 AlternativeServiceInfo(alternative_service, expiration)); | |
2537 } | |
2538 http_server_properties_->SetAlternativeServices( | |
2539 scheme_host_port, alternative_service_info_vector); | |
2540 } | |
2541 | |
2488 bool SpdySession::OnUnknownFrame(SpdyStreamId stream_id, int frame_type) { | 2542 bool SpdySession::OnUnknownFrame(SpdyStreamId stream_id, int frame_type) { |
2489 // Validate stream id. | 2543 // Validate stream id. |
2490 // Was the frame sent on a stream id that has not been used in this session? | 2544 // Was the frame sent on a stream id that has not been used in this session? |
2491 if (stream_id % 2 == 1 && stream_id > stream_hi_water_mark_) | 2545 if (stream_id % 2 == 1 && stream_id > stream_hi_water_mark_) |
2492 return false; | 2546 return false; |
2493 | 2547 |
2494 if (stream_id % 2 == 0 && stream_id > last_accepted_push_stream_id_) | 2548 if (stream_id % 2 == 0 && stream_id > last_accepted_push_stream_id_) |
2495 return false; | 2549 return false; |
2496 | 2550 |
2497 return true; | 2551 return true; |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3336 if (!queue->empty()) { | 3390 if (!queue->empty()) { |
3337 SpdyStreamId stream_id = queue->front(); | 3391 SpdyStreamId stream_id = queue->front(); |
3338 queue->pop_front(); | 3392 queue->pop_front(); |
3339 return stream_id; | 3393 return stream_id; |
3340 } | 3394 } |
3341 } | 3395 } |
3342 return 0; | 3396 return 0; |
3343 } | 3397 } |
3344 | 3398 |
3345 } // namespace net | 3399 } // namespace net |
OLD | NEW |