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

Side by Side Diff: net/url_request/url_request.h

Issue 1732493002: Prevent URLFetcher::AppendChunkedData from dereferencing NULL pointers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 9 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_URL_REQUEST_URL_REQUEST_H_ 5 #ifndef NET_URL_REQUEST_URL_REQUEST_H_
6 #define NET_URL_REQUEST_URL_REQUEST_H_ 6 #define NET_URL_REQUEST_URL_REQUEST_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 28 matching lines...) Expand all
39 namespace base { 39 namespace base {
40 class Value; 40 class Value;
41 41
42 namespace debug { 42 namespace debug {
43 class StackTrace; 43 class StackTrace;
44 } // namespace debug 44 } // namespace debug
45 } // namespace base 45 } // namespace base
46 46
47 namespace net { 47 namespace net {
48 48
49 class ChunkedUploadDataStream;
50 class CookieOptions; 49 class CookieOptions;
51 class HostPortPair; 50 class HostPortPair;
52 class IOBuffer; 51 class IOBuffer;
53 struct LoadTimingInfo; 52 struct LoadTimingInfo;
54 struct RedirectInfo; 53 struct RedirectInfo;
55 class SSLCertRequestInfo; 54 class SSLCertRequestInfo;
56 class SSLInfo; 55 class SSLInfo;
57 class SSLPrivateKey; 56 class SSLPrivateKey;
58 class UploadDataStream; 57 class UploadDataStream;
59 class URLRequestContext; 58 class URLRequestContext;
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 // The referrer policy to apply when updating the referrer during redirects. 323 // The referrer policy to apply when updating the referrer during redirects.
325 // The referrer policy may only be changed before Start() is called. 324 // The referrer policy may only be changed before Start() is called.
326 ReferrerPolicy referrer_policy() const { return referrer_policy_; } 325 ReferrerPolicy referrer_policy() const { return referrer_policy_; }
327 void set_referrer_policy(ReferrerPolicy referrer_policy); 326 void set_referrer_policy(ReferrerPolicy referrer_policy);
328 327
329 // Sets the delegate of the request. This is only to allow creating a request 328 // Sets the delegate of the request. This is only to allow creating a request
330 // before creating its delegate. |delegate| must be non-NULL and the request 329 // before creating its delegate. |delegate| must be non-NULL and the request
331 // must not yet have a Delegate set. 330 // must not yet have a Delegate set.
332 void set_delegate(Delegate* delegate); 331 void set_delegate(Delegate* delegate);
333 332
334 // Indicates that the request body should be sent using chunked transfer
335 // encoding. This method may only be called before Start() is called.
336 void EnableChunkedUpload();
337
338 // Appends the given bytes to the request's upload data to be sent
339 // immediately via chunked transfer encoding. When all data has been added,
340 // set |is_last_chunk| to true to indicate the end of upload data. All chunks
341 // but the last must have |bytes_len| > 0.
342 //
343 // This method may be called only after calling EnableChunkedUpload().
344 //
345 // Despite the name of this method, over-the-wire chunk boundaries will most
346 // likely not match the "chunks" appended with this function.
347 void AppendChunkToUpload(const char* bytes,
348 int bytes_len,
349 bool is_last_chunk);
350
351 // Sets the upload data. 333 // Sets the upload data.
352 void set_upload(scoped_ptr<UploadDataStream> upload); 334 void set_upload(scoped_ptr<UploadDataStream> upload);
353 335
354 // Gets the upload data. 336 // Gets the upload data.
355 const UploadDataStream* get_upload() const; 337 const UploadDataStream* get_upload() const;
356 338
357 // Returns true if the request has a non-empty message body to upload. 339 // Returns true if the request has a non-empty message body to upload.
358 bool has_upload() const; 340 bool has_upload() const;
359 341
360 // Set or remove a extra request header. These methods may only be called 342 // Set or remove a extra request header. These methods may only be called
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 // cookie store, socket pool, etc.) 758 // cookie store, socket pool, etc.)
777 const URLRequestContext* context_; 759 const URLRequestContext* context_;
778 760
779 NetworkDelegate* network_delegate_; 761 NetworkDelegate* network_delegate_;
780 762
781 // Tracks the time spent in various load states throughout this request. 763 // Tracks the time spent in various load states throughout this request.
782 BoundNetLog net_log_; 764 BoundNetLog net_log_;
783 765
784 scoped_ptr<URLRequestJob> job_; 766 scoped_ptr<URLRequestJob> job_;
785 scoped_ptr<UploadDataStream> upload_data_stream_; 767 scoped_ptr<UploadDataStream> upload_data_stream_;
786 // TODO(mmenke): Make whether or not an upload is chunked transparent to the
787 // URLRequest.
788 ChunkedUploadDataStream* upload_chunked_data_stream_;
789 768
790 std::vector<GURL> url_chain_; 769 std::vector<GURL> url_chain_;
791 GURL first_party_for_cookies_; 770 GURL first_party_for_cookies_;
792 url::Origin initiator_; 771 url::Origin initiator_;
793 GURL delegate_redirect_url_; 772 GURL delegate_redirect_url_;
794 std::string method_; // "GET", "POST", etc. Should be all uppercase. 773 std::string method_; // "GET", "POST", etc. Should be all uppercase.
795 std::string referrer_; 774 std::string referrer_;
796 ReferrerPolicy referrer_policy_; 775 ReferrerPolicy referrer_policy_;
797 FirstPartyURLPolicy first_party_url_policy_; 776 FirstPartyURLPolicy first_party_url_policy_;
798 HttpRequestHeaders extra_request_headers_; 777 HttpRequestHeaders extra_request_headers_;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 HostPortPair proxy_server_; 864 HostPortPair proxy_server_;
886 865
887 scoped_ptr<const base::debug::StackTrace> stack_trace_; 866 scoped_ptr<const base::debug::StackTrace> stack_trace_;
888 867
889 DISALLOW_COPY_AND_ASSIGN(URLRequest); 868 DISALLOW_COPY_AND_ASSIGN(URLRequest);
890 }; 869 };
891 870
892 } // namespace net 871 } // namespace net
893 872
894 #endif // NET_URL_REQUEST_URL_REQUEST_H_ 873 #endif // NET_URL_REQUEST_URL_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698