| 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/dhcp_proxy_script_adapter_fetcher_win.h" | 5 #include "net/proxy/dhcp_proxy_script_adapter_fetcher_win.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 // static | 213 // static |
| 214 std::string DhcpProxyScriptAdapterFetcher::GetPacURLFromDhcp( | 214 std::string DhcpProxyScriptAdapterFetcher::GetPacURLFromDhcp( |
| 215 const std::string& adapter_name) { | 215 const std::string& adapter_name) { |
| 216 EnsureDhcpcsvcInit(); | 216 EnsureDhcpcsvcInit(); |
| 217 | 217 |
| 218 std::wstring adapter_name_wide = base::SysMultiByteToWide(adapter_name, | 218 std::wstring adapter_name_wide = base::SysMultiByteToWide(adapter_name, |
| 219 CP_ACP); | 219 CP_ACP); |
| 220 | 220 |
| 221 DHCPCAPI_PARAMS_ARRAY send_params = { 0, NULL }; | 221 DHCPCAPI_PARAMS_ARRAY send_params = { 0, NULL }; |
| 222 | 222 |
| 223 BYTE option_data[] = { 1, 252 }; | |
| 224 DHCPCAPI_PARAMS wpad_params = { 0 }; | 223 DHCPCAPI_PARAMS wpad_params = { 0 }; |
| 225 wpad_params.OptionId = 252; | 224 wpad_params.OptionId = 252; |
| 226 wpad_params.IsVendor = FALSE; // Surprising, but intentional. | 225 wpad_params.IsVendor = FALSE; // Surprising, but intentional. |
| 227 | 226 |
| 228 DHCPCAPI_PARAMS_ARRAY request_params = { 0 }; | 227 DHCPCAPI_PARAMS_ARRAY request_params = { 0 }; |
| 229 request_params.nParams = 1; | 228 request_params.nParams = 1; |
| 230 request_params.Params = &wpad_params; | 229 request_params.Params = &wpad_params; |
| 231 | 230 |
| 232 // The maximum message size is typically 4096 bytes on Windows per | 231 // The maximum message size is typically 4096 bytes on Windows per |
| 233 // http://support.microsoft.com/kb/321592 | 232 // http://support.microsoft.com/kb/321592 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 // first null in case of embedded NULLs; this is the outer | 283 // first null in case of embedded NULLs; this is the outer |
| 285 // constructor that takes the result of c_str() on the inner. If | 284 // constructor that takes the result of c_str() on the inner. If |
| 286 // the server is giving us back a buffer with embedded NULLs, | 285 // the server is giving us back a buffer with embedded NULLs, |
| 287 // something is broken anyway. Finally, trim trailing whitespace. | 286 // something is broken anyway. Finally, trim trailing whitespace. |
| 288 std::string result(std::string(data, count_bytes).c_str()); | 287 std::string result(std::string(data, count_bytes).c_str()); |
| 289 base::TrimWhitespaceASCII(result, base::TRIM_TRAILING, &result); | 288 base::TrimWhitespaceASCII(result, base::TRIM_TRAILING, &result); |
| 290 return result; | 289 return result; |
| 291 } | 290 } |
| 292 | 291 |
| 293 } // namespace net | 292 } // namespace net |
| OLD | NEW |