| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <unicode/ucnv.h> | 6 #include <unicode/ucnv.h> |
| 7 #include <unicode/uidna.h> | 7 #include <unicode/uidna.h> |
| 8 #include <unicode/ulocdata.h> | 8 #include <unicode/ulocdata.h> |
| 9 #include <unicode/uniset.h> | 9 #include <unicode/uniset.h> |
| 10 #include <unicode/uscript.h> | 10 #include <unicode/uscript.h> |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 // semicolon is supposed to be some kind of separator according to RFC 2396 | 666 // semicolon is supposed to be some kind of separator according to RFC 2396 |
| 667 ReplaceSubstringsAfterOffset(&url_string, 0, | 667 ReplaceSubstringsAfterOffset(&url_string, 0, |
| 668 FILE_PATH_LITERAL(";"), FILE_PATH_LITERAL("%3B")); | 668 FILE_PATH_LITERAL(";"), FILE_PATH_LITERAL("%3B")); |
| 669 | 669 |
| 670 ReplaceSubstringsAfterOffset(&url_string, 0, | 670 ReplaceSubstringsAfterOffset(&url_string, 0, |
| 671 FILE_PATH_LITERAL("#"), FILE_PATH_LITERAL("%23")); | 671 FILE_PATH_LITERAL("#"), FILE_PATH_LITERAL("%23")); |
| 672 | 672 |
| 673 return GURL(url_string); | 673 return GURL(url_string); |
| 674 } | 674 } |
| 675 | 675 |
| 676 GURL FilePathToFileURL(const std::wstring& path_str) { | |
| 677 return FilePathToFileURL(FilePath::FromWStringHack(path_str)); | |
| 678 } | |
| 679 | |
| 680 std::wstring GetSpecificHeader(const std::wstring& headers, | 676 std::wstring GetSpecificHeader(const std::wstring& headers, |
| 681 const std::wstring& name) { | 677 const std::wstring& name) { |
| 682 return GetSpecificHeaderT(headers, name); | 678 return GetSpecificHeaderT(headers, name); |
| 683 } | 679 } |
| 684 | 680 |
| 685 std::string GetSpecificHeader(const std::string& headers, | 681 std::string GetSpecificHeader(const std::string& headers, |
| 686 const std::string& name) { | 682 const std::string& name) { |
| 687 return GetSpecificHeaderT(headers, name); | 683 return GetSpecificHeaderT(headers, name); |
| 688 } | 684 } |
| 689 | 685 |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 unsigned long no_block = 1; | 934 unsigned long no_block = 1; |
| 939 return ioctlsocket(fd, FIONBIO, &no_block); | 935 return ioctlsocket(fd, FIONBIO, &no_block); |
| 940 #elif defined(OS_POSIX) | 936 #elif defined(OS_POSIX) |
| 941 int flags = fcntl(fd, F_GETFL, 0); | 937 int flags = fcntl(fd, F_GETFL, 0); |
| 942 if (-1 == flags) | 938 if (-1 == flags) |
| 943 flags = 0; | 939 flags = 0; |
| 944 return fcntl(fd, F_SETFL, flags | O_NONBLOCK); | 940 return fcntl(fd, F_SETFL, flags | O_NONBLOCK); |
| 945 #endif | 941 #endif |
| 946 } | 942 } |
| 947 | 943 |
| 948 // Deprecated. | |
| 949 bool FileURLToFilePath(const GURL& gurl, std::wstring* file_path) { | |
| 950 FilePath path; | |
| 951 bool rv = FileURLToFilePath(gurl, &path); | |
| 952 *file_path = path.ToWStringHack(); | |
| 953 return rv; | |
| 954 } | |
| 955 | |
| 956 bool GetHostAndPort(std::string::const_iterator host_and_port_begin, | 944 bool GetHostAndPort(std::string::const_iterator host_and_port_begin, |
| 957 std::string::const_iterator host_and_port_end, | 945 std::string::const_iterator host_and_port_end, |
| 958 std::string* host, | 946 std::string* host, |
| 959 int* port) { | 947 int* port) { |
| 960 if (host_and_port_begin >= host_and_port_end) | 948 if (host_and_port_begin >= host_and_port_end) |
| 961 return false; | 949 return false; |
| 962 | 950 |
| 963 // When using url_parse, we use char*. | 951 // When using url_parse, we use char*. |
| 964 const char* auth_begin = &(*host_and_port_begin); | 952 const char* auth_begin = &(*host_and_port_begin); |
| 965 int auth_len = host_and_port_end - host_and_port_begin; | 953 int auth_len = host_and_port_end - host_and_port_begin; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1033 char buffer[256]; | 1021 char buffer[256]; |
| 1034 int result = gethostname(buffer, sizeof(buffer)); | 1022 int result = gethostname(buffer, sizeof(buffer)); |
| 1035 if (result != 0) { | 1023 if (result != 0) { |
| 1036 DLOG(INFO) << "gethostname() failed with " << result; | 1024 DLOG(INFO) << "gethostname() failed with " << result; |
| 1037 buffer[0] = '\0'; | 1025 buffer[0] = '\0'; |
| 1038 } | 1026 } |
| 1039 return std::string(buffer); | 1027 return std::string(buffer); |
| 1040 } | 1028 } |
| 1041 | 1029 |
| 1042 } // namespace net | 1030 } // namespace net |
| OLD | NEW |