OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_spdy_server_stream.h" | 5 #include "net/quic/quic_spdy_server_stream.h" |
6 | 6 |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "net/quic/quic_in_memory_cache.h" | 9 #include "net/quic/quic_in_memory_cache.h" |
10 #include "net/quic/quic_session.h" | 10 #include "net/quic/quic_session.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 return; | 69 return; |
70 } | 70 } |
71 | 71 |
72 SendResponse(); | 72 SendResponse(); |
73 } | 73 } |
74 | 74 |
75 // Try parsing the request headers. If successful, sets | 75 // Try parsing the request headers. If successful, sets |
76 // request_headers_received_. If not successful, it can just be tried again once | 76 // request_headers_received_. If not successful, it can just be tried again once |
77 // there's more data. | 77 // there's more data. |
78 void QuicSpdyServerStream::ParseRequestHeaders() { | 78 void QuicSpdyServerStream::ParseRequestHeaders() { |
79 SpdyFramer framer((kDefaultSpdyMajorVersion)); | 79 SpdyFramer framer(kDefaultSpdyMajorVersion); |
80 char* data = read_buf_->StartOfBuffer(); | 80 char* data = read_buf_->StartOfBuffer(); |
81 size_t read_buf_len = static_cast<size_t>(read_buf_->offset()); | 81 size_t read_buf_len = static_cast<size_t>(read_buf_->offset()); |
82 size_t len = framer.ParseHeaderBlockInBuffer(data, read_buf_len, &headers_); | 82 size_t len = framer.ParseHeaderBlockInBuffer(data, read_buf_len, &headers_); |
83 if (len == 0) { | 83 if (len == 0) { |
84 // Not enough data yet, presumably. (If we still don't succeed by the end of | 84 // Not enough data yet, presumably. (If we still don't succeed by the end of |
85 // the stream, then we'll error above.) | 85 // the stream, then we'll error above.) |
86 return; | 86 return; |
87 } | 87 } |
88 | 88 |
89 // Headers received and parsed: extract the request URL. | 89 // Headers received and parsed: extract the request URL. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 &header_block); | 150 &header_block); |
151 | 151 |
152 WriteHeaders(header_block, body.empty(), NULL); | 152 WriteHeaders(header_block, body.empty(), NULL); |
153 | 153 |
154 if (!body.empty()) { | 154 if (!body.empty()) { |
155 WriteOrBufferData(body, true, NULL); | 155 WriteOrBufferData(body, true, NULL); |
156 } | 156 } |
157 } | 157 } |
158 | 158 |
159 } // namespace net | 159 } // namespace net |
OLD | NEW |