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

Side by Side Diff: net/http/http_stream_parser.h

Issue 2253653002: Only allow HTTP/0.9 support on default ports. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unrelated changes to random file (Where did they come from???) Created 4 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
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_HTTP_HTTP_STREAM_PARSER_H_ 5 #ifndef NET_HTTP_HTTP_STREAM_PARSER_H_
6 #define NET_HTTP_HTTP_STREAM_PARSER_H_ 6 #define NET_HTTP_HTTP_STREAM_PARSER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // and any data left over after parsing the stream will be put into 43 // and any data left over after parsing the stream will be put into
44 // |read_buffer|. The left over data will start at offset 0 and the 44 // |read_buffer|. The left over data will start at offset 0 and the
45 // buffer's offset will be set to the first free byte. |read_buffer| may 45 // buffer's offset will be set to the first free byte. |read_buffer| may
46 // have its capacity changed. 46 // have its capacity changed.
47 HttpStreamParser(ClientSocketHandle* connection, 47 HttpStreamParser(ClientSocketHandle* connection,
48 const HttpRequestInfo* request, 48 const HttpRequestInfo* request,
49 GrowableIOBuffer* read_buffer, 49 GrowableIOBuffer* read_buffer,
50 const BoundNetLog& net_log); 50 const BoundNetLog& net_log);
51 virtual ~HttpStreamParser(); 51 virtual ~HttpStreamParser();
52 52
53 // By default, HTTP/0.9 is only allowed on default ports. This enables it
54 // everwhere.
55 void set_http_09_on_non_default_ports_enabled() {
eroman 2016/08/29 22:11:55 I think this would be clearer if it took a boolean
mmenke 2016/08/30 17:50:47 Done. I didn't make it take a bool to emphasize i
56 http_09_on_non_default_ports_enabled_ = true;
57 }
58
53 // These functions implement the interface described in HttpStream with 59 // These functions implement the interface described in HttpStream with
54 // some additional functionality 60 // some additional functionality
55 int SendRequest(const std::string& request_line, 61 int SendRequest(const std::string& request_line,
56 const HttpRequestHeaders& headers, 62 const HttpRequestHeaders& headers,
57 HttpResponseInfo* response, 63 HttpResponseInfo* response,
58 const CompletionCallback& callback); 64 const CompletionCallback& callback);
59 65
60 int ReadResponseHeaders(const CompletionCallback& callback); 66 int ReadResponseHeaders(const CompletionCallback& callback);
61 67
62 int ReadResponseBody(IOBuffer* buf, int buf_len, 68 int ReadResponseBody(IOBuffer* buf, int buf_len,
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 // The request to send. 208 // The request to send.
203 const HttpRequestInfo* request_; 209 const HttpRequestInfo* request_;
204 210
205 // The request header data. May include a merged request body. 211 // The request header data. May include a merged request body.
206 scoped_refptr<DrainableIOBuffer> request_headers_; 212 scoped_refptr<DrainableIOBuffer> request_headers_;
207 213
208 // Size of just the request headers. May be less than the length of 214 // Size of just the request headers. May be less than the length of
209 // |request_headers_| if the body was merged with the headers. 215 // |request_headers_| if the body was merged with the headers.
210 int request_headers_length_; 216 int request_headers_length_;
211 217
218 // True if HTTP/0.9 should be permitted on non-default ports.
219 bool http_09_on_non_default_ports_enabled_;
220
212 // Temporary buffer for reading. 221 // Temporary buffer for reading.
213 scoped_refptr<GrowableIOBuffer> read_buf_; 222 scoped_refptr<GrowableIOBuffer> read_buf_;
214 223
215 // Offset of the first unused byte in |read_buf_|. May be nonzero due to 224 // Offset of the first unused byte in |read_buf_|. May be nonzero due to
216 // body data in the same packet as header data but is zero when reading 225 // body data in the same packet as header data but is zero when reading
217 // headers. 226 // headers.
218 int read_buf_unused_offset_; 227 int read_buf_unused_offset_;
219 228
220 // The amount beyond |read_buf_unused_offset_| where the status line starts; 229 // The amount beyond |read_buf_unused_offset_| where the status line starts;
221 // -1 if not found yet. 230 // -1 if not found yet.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 int upload_error_; 290 int upload_error_;
282 291
283 base::WeakPtrFactory<HttpStreamParser> weak_ptr_factory_; 292 base::WeakPtrFactory<HttpStreamParser> weak_ptr_factory_;
284 293
285 DISALLOW_COPY_AND_ASSIGN(HttpStreamParser); 294 DISALLOW_COPY_AND_ASSIGN(HttpStreamParser);
286 }; 295 };
287 296
288 } // namespace net 297 } // namespace net
289 298
290 #endif // NET_HTTP_HTTP_STREAM_PARSER_H_ 299 #endif // NET_HTTP_HTTP_STREAM_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698