| 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> |
| 11 #include <unicode/uset.h> | 11 #include <unicode/uset.h> |
| 12 | 12 |
| 13 #ifdef OS_WIN | 13 #include "build/build_config.h" |
| 14 |
| 15 #if defined(OS_WIN) |
| 14 #include <windows.h> | 16 #include <windows.h> |
| 17 #include <winsock2.h> |
| 18 #elif defined(OS_POSIX) |
| 19 #include <sys/socket.h> |
| 20 #include <fcntl.h> |
| 15 #endif | 21 #endif |
| 16 | 22 |
| 17 #include "net/base/net_util.h" | 23 #include "net/base/net_util.h" |
| 18 | 24 |
| 19 #include "base/basictypes.h" | 25 #include "base/basictypes.h" |
| 20 #include "base/file_util.h" | 26 #include "base/file_util.h" |
| 21 #include "base/logging.h" | 27 #include "base/logging.h" |
| 22 #include "base/path_service.h" | 28 #include "base/path_service.h" |
| 23 #include "base/scoped_ptr.h" | 29 #include "base/scoped_ptr.h" |
| 24 #include "base/string_escape.h" | 30 #include "base/string_escape.h" |
| (...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 int array_size = arraysize(kAllowedFtpPorts); | 914 int array_size = arraysize(kAllowedFtpPorts); |
| 909 for (int i = 0; i < array_size; i++) { | 915 for (int i = 0; i < array_size; i++) { |
| 910 if (kAllowedFtpPorts[i] == port) { | 916 if (kAllowedFtpPorts[i] == port) { |
| 911 return true; | 917 return true; |
| 912 } | 918 } |
| 913 } | 919 } |
| 914 // Port not explicitly allowed by FTP, so return the default restrictions. | 920 // Port not explicitly allowed by FTP, so return the default restrictions. |
| 915 return IsPortAllowedByDefault(port); | 921 return IsPortAllowedByDefault(port); |
| 916 } | 922 } |
| 917 | 923 |
| 924 int SetNonBlocking(int fd) { |
| 925 #if defined(OS_WIN) |
| 926 unsigned long no_block = 1; |
| 927 return ioctlsocket(fd, FIONBIO, &no_block); |
| 928 #elif defined(OS_POSIX) |
| 929 int flags = fcntl(fd, F_GETFL, 0); |
| 930 if (-1 == flags) |
| 931 flags = 0; |
| 932 return fcntl(fd, F_SETFL, flags | O_NONBLOCK); |
| 933 #endif |
| 934 } |
| 935 |
| 918 } // namespace net | 936 } // namespace net |
| OLD | NEW |