Mercurial > hg > nginx
comparison src/os/win32/ngx_errno.c @ 461:a88a3e4e158f release-0.1.5
nginx-0.1.5-RELEASE import
*) Bugfix: on Solaris and Linux there may be too many "recvmsg()
returned not enough data" alerts.
*) Bugfix: there were the "writev() failed (22: Invalid argument)"
errors on Solaris in proxy mode without sendfile. On other platforms
that do not support sendfile at all the process got caught in an
endless loop.
*) Bugfix: segmentation fault on Solaris in proxy mode and using
sendfile.
*) Bugfix: segmentation fault on Solaris.
*) Bugfix: on-line upgrade did not work on Linux.
*) Bugfix: the ngx_http_autoindex_module module did not escape the
spaces, the quotes, and the percent signs in the directory listing.
*) Change: the decrease of the copy operations.
*) Feature: the userid_p3p directive.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 11 Nov 2004 14:07:14 +0000 |
parents | 42d11f017717 |
children | 8e8f3af115b5 |
comparison
equal
deleted
inserted
replaced
460:5f8319142dfc | 461:a88a3e4e158f |
---|---|
13 #include <ngx_config.h> | 13 #include <ngx_config.h> |
14 #include <ngx_core.h> | 14 #include <ngx_core.h> |
15 | 15 |
16 | 16 |
17 static ngx_str_t wsa_errors[] = { | 17 static ngx_str_t wsa_errors[] = { |
18 ngx_string("Invalid argument"), /* 10022 */ | 18 ngx_string("An invalid argument was supplied"), /* WSAEINVAL 10022 */ |
19 ngx_null_string, /* 10023 */ | 19 ngx_string("Too many open sockets"), /* WSAEMFILE 10023 */ |
20 ngx_null_string, /* 10024 */ | 20 |
21 ngx_null_string, /* 10025 */ | 21 ngx_null_string, /* 10024 */ |
22 ngx_null_string, /* 10026 */ | 22 ngx_null_string, /* 10025 */ |
23 ngx_null_string, /* 10027 */ | 23 ngx_null_string, /* 10026 */ |
24 ngx_null_string, /* 10028 */ | 24 ngx_null_string, /* 10027 */ |
25 ngx_null_string, /* 10029 */ | 25 ngx_null_string, /* 10028 */ |
26 ngx_null_string, /* 10030 */ | 26 ngx_null_string, /* 10029 */ |
27 ngx_null_string, /* 10031 */ | 27 ngx_null_string, /* 10030 */ |
28 ngx_null_string, /* 10032 */ | 28 ngx_null_string, /* 10031 */ |
29 ngx_null_string, /* 10033 */ | 29 ngx_null_string, /* 10032 */ |
30 ngx_null_string, /* 10034 */ | 30 ngx_null_string, /* 10033 */ |
31 ngx_string("Resource temporarily unavailable"), /* 10035 */ | 31 ngx_null_string, /* 10034 */ |
32 ngx_null_string, /* 10036 */ | 32 |
33 ngx_null_string, /* 10037 */ | 33 /* WSAEWOULDBLOCK 10035 */ |
34 ngx_null_string, /* 10038 */ | 34 ngx_string("A non-blocking socket operation could not be completed " |
35 ngx_null_string, /* 10039 */ | 35 "immediately"), |
36 ngx_null_string, /* 10040 */ | 36 |
37 ngx_null_string, /* 10041 */ | 37 ngx_null_string, /* 10036 */ |
38 ngx_null_string, /* 10042 */ | 38 ngx_null_string, /* 10037 */ |
39 ngx_null_string, /* 10043 */ | 39 |
40 ngx_null_string, /* 10044 */ | 40 /* WSAENOTSOCK 10038 */ |
41 ngx_null_string, /* 10045 */ | 41 ngx_string("An operation was attempted on something that is not a socket"), |
42 ngx_null_string, /* 10046 */ | 42 |
43 ngx_null_string, /* 10047 */ | 43 ngx_null_string, /* 10039 */ |
44 ngx_null_string, /* 10048 */ | 44 ngx_null_string, /* 10040 */ |
45 ngx_null_string, /* 10049 */ | 45 ngx_null_string, /* 10041 */ |
46 ngx_null_string, /* 10050 */ | 46 ngx_null_string, /* 10042 */ |
47 ngx_null_string, /* 10051 */ | 47 ngx_null_string, /* 10043 */ |
48 ngx_null_string, /* 10052 */ | 48 ngx_null_string, /* 10044 */ |
49 ngx_null_string, /* 10053 */ | 49 ngx_null_string, /* 10045 */ |
50 ngx_null_string, /* 10054 */ | 50 ngx_null_string, /* 10046 */ |
51 ngx_null_string, /* 10055 */ | 51 ngx_null_string, /* 10047 */ |
52 ngx_null_string, /* 10056 */ | 52 ngx_null_string, /* 10048 */ |
53 ngx_string("Socket is not connected") /* 10057 */ | 53 ngx_null_string, /* 10049 */ |
54 ngx_null_string, /* 10050 */ | |
55 ngx_null_string, /* 10051 */ | |
56 ngx_null_string, /* 10052 */ | |
57 ngx_null_string, /* 10053 */ | |
58 | |
59 /* WSAECONNRESET 10054 */ | |
60 ngx_string("An existing connection was forcibly closed by the remote host"), | |
61 | |
62 /* WSAENOBUFS 10055 */ | |
63 ngx_string("An operation on a socket could not be performed because " | |
64 "the system lacked sufficient buffer space or " | |
65 "because a queue was full"), | |
66 | |
67 /* WSAEISCONN 10056 */ | |
68 ngx_string("A connect request was made on an already connected socket"), | |
69 | |
70 /* WSAENOTCONN 10057 */ | |
71 ngx_string("A request to send or receive data was disallowed because" | |
72 "the socket is not connected and (when sending on a datagram " | |
73 "socket using a sendto call) no address was supplied"), | |
74 | |
75 ngx_null_string, /* 10058 */ | |
76 ngx_null_string, /* 10059 */ | |
77 | |
78 /* WSAETIMEDOUT 10060 */ | |
79 ngx_string("A connection attempt failed because the connected party " | |
80 "did not properly respond after a period of time, " | |
81 "or established connection failed because connected host " | |
82 "has failed to respond"), | |
83 | |
84 /* WSAECONNREFUSED 10061 */ | |
85 ngx_string("No connection could be made because the target machine " | |
86 "actively refused it") | |
54 }; | 87 }; |
55 | 88 |
56 | 89 |
57 int ngx_strerror_r(ngx_err_t err, char *errstr, size_t size) | 90 u_char *ngx_strerror_r(ngx_err_t err, u_char *errstr, size_t size) |
58 { | 91 { |
59 int n; | 92 int n; |
60 u_int len; | 93 u_int len; |
61 ngx_err_t format_error; | 94 ngx_err_t format_error; |
62 | 95 |
96 if (size == 0) { | |
97 return errstr; | |
98 } | |
99 | |
63 len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | 100 len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
64 |FORMAT_MESSAGE_IGNORE_INSERTS, | 101 |FORMAT_MESSAGE_IGNORE_INSERTS, |
65 NULL, err, | 102 NULL, err, |
66 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), | 103 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), |
67 errstr, size, NULL); | 104 (char *) errstr, size, NULL); |
68 | 105 |
69 if (len == 0) { | 106 if (len == 0) { |
70 format_error = GetLastError(); | 107 format_error = GetLastError(); |
71 | 108 |
72 if (format_error == ERROR_MR_MID_NOT_FOUND) { | 109 if (format_error == ERROR_MR_MID_NOT_FOUND) { |
73 n = err - WSABASEERR - 22; | 110 n = err - WSAEINVAL; |
74 | 111 |
75 if (n >= 0 && n <= 35) { | 112 if (n >= 0 && n <= WSAECONNREFUSED - WSAEINVAL) { |
76 len = wsa_errors[n].len; | 113 len = wsa_errors[n].len; |
77 | 114 |
78 if (len) { | 115 if (len) { |
79 if (len > size) { | 116 if (len > size) { |
80 len = size; | 117 len = size; |
81 } | 118 } |
82 | 119 |
83 ngx_memcpy(errstr, wsa_errors[n].data, len); | 120 ngx_memcpy(errstr, wsa_errors[n].data, len); |
84 return len; | 121 |
122 return errstr + len; | |
85 } | 123 } |
86 } | 124 } |
87 } | 125 } |
88 | 126 |
89 len = ngx_snprintf(errstr, size, | 127 return ngx_snprintf(errstr, size, |
90 "FormatMessage() error:(%d)", format_error); | 128 "FormatMessage() error:(%d)", format_error); |
91 return len; | |
92 | |
93 } | 129 } |
94 | 130 |
95 /* remove ".\r\n\0" */ | 131 /* remove ".\r\n\0" */ |
96 while (errstr[len] == '\0' || errstr[len] == CR | 132 while (errstr[len] == '\0' || errstr[len] == CR |
97 || errstr[len] == LF || errstr[len] == '.') | 133 || errstr[len] == LF || errstr[len] == '.') |
134 { | |
98 --len; | 135 --len; |
136 } | |
99 | 137 |
100 return ++len; | 138 return &errstr[++len]; |
101 } | 139 } |