| OLD | NEW |
| 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 #include "net/proxy/proxy_script_decider.h" | 5 #include "net/proxy/proxy_script_decider.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // Note: this is only an approximation! It may not always work correctly, | 32 // Note: this is only an approximation! It may not always work correctly, |
| 33 // however it is very likely that legitimate scripts have this exact string, | 33 // however it is very likely that legitimate scripts have this exact string, |
| 34 // since they must minimally define a function of this name. Conversely, a | 34 // since they must minimally define a function of this name. Conversely, a |
| 35 // file not containing the string is not likely to be a PAC script. | 35 // file not containing the string is not likely to be a PAC script. |
| 36 // | 36 // |
| 37 // An exact test would have to load the script in a javascript evaluator. | 37 // An exact test would have to load the script in a javascript evaluator. |
| 38 return script.find(base::ASCIIToUTF16("FindProxyForURL")) != | 38 return script.find(base::ASCIIToUTF16("FindProxyForURL")) != |
| 39 base::string16::npos; | 39 base::string16::npos; |
| 40 } | 40 } |
| 41 | 41 |
| 42 } | 42 } // anonymous namespace |
| 43 | 43 |
| 44 // This is the hard-coded location used by the DNS portion of web proxy | 44 // This is the hard-coded location used by the DNS portion of web proxy |
| 45 // auto-discovery. | 45 // auto-discovery. |
| 46 // | 46 // |
| 47 // Note that we not use DNS devolution to find the WPAD host, since that could | 47 // Note that we not use DNS devolution to find the WPAD host, since that could |
| 48 // be dangerous should our top level domain registry become out of date. | 48 // be dangerous should our top level domain registry become out of date. |
| 49 // | 49 // |
| 50 // Instead we directly resolve "wpad", and let the operating system apply the | 50 // Instead we directly resolve "wpad", and let the operating system apply the |
| 51 // DNS suffix search paths. This is the same approach taken by Firefox, and | 51 // DNS suffix search paths. This is the same approach taken by Firefox, and |
| 52 // compatibility hasn't been an issue. | 52 // compatibility hasn't been an issue. |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 // This is safe to call in any state. | 494 // This is safe to call in any state. |
| 495 if (dhcp_proxy_script_fetcher_) | 495 if (dhcp_proxy_script_fetcher_) |
| 496 dhcp_proxy_script_fetcher_->Cancel(); | 496 dhcp_proxy_script_fetcher_->Cancel(); |
| 497 | 497 |
| 498 DCHECK(!request_); | 498 DCHECK(!request_); |
| 499 | 499 |
| 500 DidComplete(); | 500 DidComplete(); |
| 501 } | 501 } |
| 502 | 502 |
| 503 } // namespace net | 503 } // namespace net |
| OLD | NEW |