| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 | 7 |
| 8 #include <set> |
| 8 #include <string> | 9 #include <string> |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
| 12 #include "net/base/auth.h" | 13 #include "net/base/auth.h" |
| 13 #include "net/base/completion_callback.h" | 14 #include "net/base/completion_callback.h" |
| 14 #include "net/http/http_request_info.h" | 15 #include "net/http/http_request_info.h" |
| 15 #include "net/url_request/url_request_job.h" | 16 #include "net/url_request/url_request_job.h" |
| 16 | 17 |
| 17 namespace net { | 18 namespace net { |
| 18 class HttpResponseInfo; | 19 class HttpResponseInfo; |
| 19 class HttpTransaction; | 20 class HttpTransaction; |
| 20 } | 21 } |
| 21 class URLRequestContext; | 22 class URLRequestContext; |
| 22 | 23 |
| 23 // A URLRequestJob subclass that is built on top of HttpTransaction. It | 24 // A URLRequestJob subclass that is built on top of HttpTransaction. It |
| 24 // provides an implementation for both HTTP and HTTPS. | 25 // provides an implementation for both HTTP and HTTPS. |
| 25 class URLRequestHttpJob : public URLRequestJob { | 26 class URLRequestHttpJob : public URLRequestJob { |
| 26 public: | 27 public: |
| 27 static URLRequestJob* Factory(URLRequest* request, const std::string& scheme); | 28 static URLRequestJob* Factory(URLRequest* request, const std::string& scheme); |
| 29 // Specifies a comma separated list of port numbers that should be accepted |
| 30 // despite bans. If the string is invalid no allowed ports are stored. |
| 31 static void SetExplicitlyAllowedPorts(const std::wstring& allowed_ports); |
| 32 static const std::set<int>& explicitly_allowed_ports() { |
| 33 return explicitly_allowed_ports_; |
| 34 } |
| 28 | 35 |
| 29 virtual ~URLRequestHttpJob(); | 36 virtual ~URLRequestHttpJob(); |
| 30 | 37 |
| 31 protected: | 38 protected: |
| 32 explicit URLRequestHttpJob(URLRequest* request); | 39 explicit URLRequestHttpJob(URLRequest* request); |
| 33 | 40 |
| 34 // URLRequestJob methods: | 41 // URLRequestJob methods: |
| 35 virtual void SetUpload(net::UploadData* upload); | 42 virtual void SetUpload(net::UploadData* upload); |
| 36 virtual void SetExtraRequestHeaders(const std::string& headers); | 43 virtual void SetExtraRequestHeaders(const std::string& headers); |
| 37 virtual void Start(); | 44 virtual void Start(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 void ProcessForceTLSHeader(); | 78 void ProcessForceTLSHeader(); |
| 72 | 79 |
| 73 void OnStartCompleted(int result); | 80 void OnStartCompleted(int result); |
| 74 void OnReadCompleted(int result); | 81 void OnReadCompleted(int result); |
| 75 | 82 |
| 76 bool ShouldTreatAsCertificateError(int result); | 83 bool ShouldTreatAsCertificateError(int result); |
| 77 | 84 |
| 78 void RestartTransactionWithAuth(const std::wstring& username, | 85 void RestartTransactionWithAuth(const std::wstring& username, |
| 79 const std::wstring& password); | 86 const std::wstring& password); |
| 80 | 87 |
| 88 // Check if banned |port| has been overriden by an entry in |
| 89 // |explicitly_allowed_ports_|. |
| 90 static bool IsPortAllowedByOverride(int port); |
| 91 |
| 81 // Keep a reference to the url request context to be sure it's not deleted | 92 // Keep a reference to the url request context to be sure it's not deleted |
| 82 // before us. | 93 // before us. |
| 83 scoped_refptr<URLRequestContext> context_; | 94 scoped_refptr<URLRequestContext> context_; |
| 84 | 95 |
| 85 net::HttpRequestInfo request_info_; | 96 net::HttpRequestInfo request_info_; |
| 86 const net::HttpResponseInfo* response_info_; | 97 const net::HttpResponseInfo* response_info_; |
| 87 std::vector<std::string> response_cookies_; | 98 std::vector<std::string> response_cookies_; |
| 88 | 99 |
| 89 // Auth states for proxy and origin server. | 100 // Auth states for proxy and origin server. |
| 90 net::AuthState proxy_auth_state_; | 101 net::AuthState proxy_auth_state_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 108 | 119 |
| 109 // For SDCH latency experiments, when we are able to do SDCH, we may enable | 120 // For SDCH latency experiments, when we are able to do SDCH, we may enable |
| 110 // either an SDCH latency test xor a pass through test. The following bools | 121 // either an SDCH latency test xor a pass through test. The following bools |
| 111 // indicate what we decided on for this instance. | 122 // indicate what we decided on for this instance. |
| 112 bool sdch_test_activated_; // Advertising a dictionary for sdch. | 123 bool sdch_test_activated_; // Advertising a dictionary for sdch. |
| 113 bool sdch_test_control_; // Not even accepting-content sdch. | 124 bool sdch_test_control_; // Not even accepting-content sdch. |
| 114 | 125 |
| 115 // For recording of stats, we need to remember if this is cached content. | 126 // For recording of stats, we need to remember if this is cached content. |
| 116 bool is_cached_content_; | 127 bool is_cached_content_; |
| 117 | 128 |
| 129 private: |
| 130 // Holds a list of ports that should be accepted despite bans. |
| 131 static std::set<int> explicitly_allowed_ports_; |
| 132 |
| 118 DISALLOW_COPY_AND_ASSIGN(URLRequestHttpJob); | 133 DISALLOW_COPY_AND_ASSIGN(URLRequestHttpJob); |
| 119 }; | 134 }; |
| 120 | 135 |
| 121 #endif // NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ | 136 #endif // NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ |
| OLD | NEW |