| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_HTTP_JOB_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 14 #include "base/string16.h" |
| 14 #include "net/base/auth.h" | 15 #include "net/base/auth.h" |
| 15 #include "net/base/completion_callback.h" | 16 #include "net/base/completion_callback.h" |
| 16 #include "net/http/http_request_info.h" | 17 #include "net/http/http_request_info.h" |
| 17 #include "net/url_request/url_request_job.h" | 18 #include "net/url_request/url_request_job.h" |
| 18 | 19 |
| 19 namespace net { | 20 namespace net { |
| 20 class HttpResponseInfo; | 21 class HttpResponseInfo; |
| 21 class HttpTransaction; | 22 class HttpTransaction; |
| 22 } | 23 } |
| 23 class URLRequestContext; | 24 class URLRequestContext; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 43 virtual void GetResponseInfo(net::HttpResponseInfo* info); | 44 virtual void GetResponseInfo(net::HttpResponseInfo* info); |
| 44 virtual bool GetResponseCookies(std::vector<std::string>* cookies); | 45 virtual bool GetResponseCookies(std::vector<std::string>* cookies); |
| 45 virtual int GetResponseCode() const; | 46 virtual int GetResponseCode() const; |
| 46 virtual bool GetContentEncodings( | 47 virtual bool GetContentEncodings( |
| 47 std::vector<Filter::FilterType>* encoding_type); | 48 std::vector<Filter::FilterType>* encoding_type); |
| 48 virtual bool IsCachedContent() const { return is_cached_content_; } | 49 virtual bool IsCachedContent() const { return is_cached_content_; } |
| 49 virtual bool IsSdchResponse() const; | 50 virtual bool IsSdchResponse() const; |
| 50 virtual bool IsSafeRedirect(const GURL& location); | 51 virtual bool IsSafeRedirect(const GURL& location); |
| 51 virtual bool NeedsAuth(); | 52 virtual bool NeedsAuth(); |
| 52 virtual void GetAuthChallengeInfo(scoped_refptr<net::AuthChallengeInfo>*); | 53 virtual void GetAuthChallengeInfo(scoped_refptr<net::AuthChallengeInfo>*); |
| 53 virtual void SetAuth(const std::wstring& username, | 54 virtual void SetAuth(const string16& username, |
| 54 const std::wstring& password); | 55 const string16& password); |
| 55 virtual void CancelAuth(); | 56 virtual void CancelAuth(); |
| 56 virtual void ContinueWithCertificate(net::X509Certificate* client_cert); | 57 virtual void ContinueWithCertificate(net::X509Certificate* client_cert); |
| 57 virtual void ContinueDespiteLastError(); | 58 virtual void ContinueDespiteLastError(); |
| 58 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read); | 59 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read); |
| 59 virtual void StopCaching(); | 60 virtual void StopCaching(); |
| 60 | 61 |
| 61 // Shadows URLRequestJob's version of this method so we can grab cookies. | 62 // Shadows URLRequestJob's version of this method so we can grab cookies. |
| 62 void NotifyHeadersComplete(); | 63 void NotifyHeadersComplete(); |
| 63 | 64 |
| 64 void DestroyTransaction(); | 65 void DestroyTransaction(); |
| 65 void StartTransaction(); | 66 void StartTransaction(); |
| 66 void AddExtraHeaders(); | 67 void AddExtraHeaders(); |
| 67 void AddCookieHeaderAndStart(); | 68 void AddCookieHeaderAndStart(); |
| 68 void SaveCookiesAndNotifyHeadersComplete(); | 69 void SaveCookiesAndNotifyHeadersComplete(); |
| 69 void SaveNextCookie(); | 70 void SaveNextCookie(); |
| 70 void FetchResponseCookies(const net::HttpResponseInfo* response_info, | 71 void FetchResponseCookies(const net::HttpResponseInfo* response_info, |
| 71 std::vector<std::string>* cookies); | 72 std::vector<std::string>* cookies); |
| 72 | 73 |
| 73 // Process the Strict-Transport-Security header, if one exists. | 74 // Process the Strict-Transport-Security header, if one exists. |
| 74 void ProcessStrictTransportSecurityHeader(); | 75 void ProcessStrictTransportSecurityHeader(); |
| 75 | 76 |
| 76 void OnCanGetCookiesCompleted(int result); | 77 void OnCanGetCookiesCompleted(int result); |
| 77 void OnCanSetCookieCompleted(int result); | 78 void OnCanSetCookieCompleted(int result); |
| 78 void OnStartCompleted(int result); | 79 void OnStartCompleted(int result); |
| 79 void OnReadCompleted(int result); | 80 void OnReadCompleted(int result); |
| 80 | 81 |
| 81 bool ShouldTreatAsCertificateError(int result); | 82 bool ShouldTreatAsCertificateError(int result); |
| 82 | 83 |
| 83 void RestartTransactionWithAuth(const std::wstring& username, | 84 void RestartTransactionWithAuth(const string16& username, |
| 84 const std::wstring& password); | 85 const string16& password); |
| 85 | 86 |
| 86 // Keep a reference to the url request context to be sure it's not deleted | 87 // Keep a reference to the url request context to be sure it's not deleted |
| 87 // before us. | 88 // before us. |
| 88 scoped_refptr<URLRequestContext> context_; | 89 scoped_refptr<URLRequestContext> context_; |
| 89 | 90 |
| 90 net::HttpRequestInfo request_info_; | 91 net::HttpRequestInfo request_info_; |
| 91 const net::HttpResponseInfo* response_info_; | 92 const net::HttpResponseInfo* response_info_; |
| 92 | 93 |
| 93 std::vector<std::string> response_cookies_; | 94 std::vector<std::string> response_cookies_; |
| 94 size_t response_cookies_save_index_; | 95 size_t response_cookies_save_index_; |
| 95 | 96 |
| 96 // Auth states for proxy and origin server. | 97 // Auth states for proxy and origin server. |
| 97 net::AuthState proxy_auth_state_; | 98 net::AuthState proxy_auth_state_; |
| 98 net::AuthState server_auth_state_; | 99 net::AuthState server_auth_state_; |
| 99 | 100 |
| 100 std::wstring username_; | 101 string16 username_; |
| 101 std::wstring password_; | 102 string16 password_; |
| 102 | 103 |
| 103 net::CompletionCallbackImpl<URLRequestHttpJob> can_get_cookies_callback_; | 104 net::CompletionCallbackImpl<URLRequestHttpJob> can_get_cookies_callback_; |
| 104 net::CompletionCallbackImpl<URLRequestHttpJob> can_set_cookie_callback_; | 105 net::CompletionCallbackImpl<URLRequestHttpJob> can_set_cookie_callback_; |
| 105 net::CompletionCallbackImpl<URLRequestHttpJob> start_callback_; | 106 net::CompletionCallbackImpl<URLRequestHttpJob> start_callback_; |
| 106 net::CompletionCallbackImpl<URLRequestHttpJob> read_callback_; | 107 net::CompletionCallbackImpl<URLRequestHttpJob> read_callback_; |
| 107 | 108 |
| 108 bool read_in_progress_; | 109 bool read_in_progress_; |
| 109 | 110 |
| 110 // An URL for an SDCH dictionary as suggested in a Get-Dictionary HTTP header. | 111 // An URL for an SDCH dictionary as suggested in a Get-Dictionary HTTP header. |
| 111 GURL sdch_dictionary_url_; | 112 GURL sdch_dictionary_url_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 127 // For recording of stats, we need to remember if this is cached content. | 128 // For recording of stats, we need to remember if this is cached content. |
| 128 bool is_cached_content_; | 129 bool is_cached_content_; |
| 129 | 130 |
| 130 private: | 131 private: |
| 131 virtual ~URLRequestHttpJob(); | 132 virtual ~URLRequestHttpJob(); |
| 132 | 133 |
| 133 DISALLOW_COPY_AND_ASSIGN(URLRequestHttpJob); | 134 DISALLOW_COPY_AND_ASSIGN(URLRequestHttpJob); |
| 134 }; | 135 }; |
| 135 | 136 |
| 136 #endif // NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ | 137 #endif // NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ |
| OLD | NEW |