Index: trunk/willow/src/wreadlog/wreadlog.cc |
— | — | @@ -40,6 +40,10 @@ |
41 | 41 | using std::strchr; |
42 | 42 | using std::auto_ptr; |
43 | 43 | |
| 44 | +#ifdef __INTEL_COMPILER |
| 45 | +# pragma warning (disable: 1418 383 981) |
| 46 | +#endif |
| 47 | + |
44 | 48 | #include "acl.h" |
45 | 49 | |
46 | 50 | static FILE *outfile = stdout; |
— | — | @@ -143,7 +147,7 @@ |
144 | 148 | static void |
145 | 149 | doprint_squid(logent &e) |
146 | 150 | { |
147 | | - fprintf(outfile, "%ul.0 0 %s TCP_%s/%d %lu %s %.*s - ", (unsigned long)*e.r_reqtime, |
| 151 | + fprintf(outfile, "%lu.0 0 %s TCP_%s/%d %lu %s %.*s - ", (unsigned long)*e.r_reqtime, |
148 | 152 | resolve(e.r_cliaddr, *e.r_clilen), *e.r_cached ? "HIT" : "MISS", |
149 | 153 | (int)*e.r_status, (unsigned long)*e.r_docsize, |
150 | 154 | reqtypes[*e.r_reqtype], (int)*e.r_pathlen, e.r_path); |
— | — | @@ -156,13 +160,12 @@ |
157 | 161 | wait_event(vector<int> &socks, int maxfd, fd_set &rfds) |
158 | 162 | { |
159 | 163 | vector<int>::iterator it, end; |
160 | | -int i; |
161 | 164 | for (;;) { |
162 | 165 | bzero(&rfds, sizeof(rfds)); |
163 | 166 | FD_ZERO(&rfds); |
164 | 167 | for (it = socks.begin(), end = socks.end(); it != end; ++it) |
165 | 168 | FD_SET(*it, &rfds); |
166 | | - if (select(maxfd + 1, &rfds, NULL, NULL, NULL) <1) { |
| 169 | + if (select(maxfd + 1, &rfds, NULL, NULL, NULL) < 1) { |
167 | 170 | if (errno == EINTR) |
168 | 171 | continue; |
169 | 172 | fprintf(stderr, "select: %s\n", strerror(errno)); |
— | — | @@ -195,8 +198,8 @@ |
196 | 199 | { |
197 | 200 | sockaddr_storage cliaddr; |
198 | 201 | socklen_t clilen; |
199 | | -int n, i, nlen; |
200 | | -char buf[65535], *end = buf + sizeof(buf), *bufp = buf; |
| 202 | +int n; |
| 203 | +char buf[65535], *end, *bufp = buf; |
201 | 204 | const aclnode *an; |
202 | 205 | clilen = sizeof(cliaddr); |
203 | 206 | bufp = buf; |
— | — | @@ -205,6 +208,8 @@ |
206 | 209 | exit(8); |
207 | 210 | } |
208 | 211 | |
| 212 | + end = buf + n; |
| 213 | + |
209 | 214 | if (((an = acl4.match((sockaddr *)&cliaddr)) && (an->action == ACL_BLOCK)) |
210 | 215 | || ((an = acl6.match((sockaddr *)&cliaddr)) && (an->action == ACL_BLOCK))) |
211 | 216 | return; |
— | — | @@ -265,7 +270,6 @@ |
266 | 271 | int i; |
267 | 272 | const char *port = "4445", *host = NULL; |
268 | 273 | char *progname = argv[0]; |
269 | | -struct sockaddr_in servaddr, cliaddr; |
270 | 274 | struct addrinfo hints, *res; |
271 | 275 | bool daemon = false; |
272 | 276 | memset(&hints, 0, sizeof(hints)); |
— | — | @@ -320,7 +324,7 @@ |
321 | 325 | if (strchr(p, '.')) { |
322 | 326 | if (!len) |
323 | 327 | len = 32; |
324 | | - if (acl4.add(p, len, ACL_PASS, ACLFL_NONE) == false) { |
| 328 | + if (acl4.add(p, (uint8_t) len, ACL_PASS, ACLFL_NONE) == false) { |
325 | 329 | fprintf(stderr, "%s: could not parse IP mask: %s\n", argv[0], optarg); |
326 | 330 | return 1; |
327 | 331 | } |
— | — | @@ -329,7 +333,7 @@ |
330 | 334 | else { |
331 | 335 | if (!len) |
332 | 336 | len = 128; |
333 | | - if (acl6.add(p, len, ACL_PASS, ACLFL_NONE) == false) { |
| 337 | + if (acl6.add(p, (uint8_t) len, ACL_PASS, ACLFL_NONE) == false) { |
334 | 338 | fprintf(stderr, "%s: could not parse IP mask: %s\n", argv[0], optarg); |
335 | 339 | return 1; |
336 | 340 | } |
Index: trunk/willow/src/wgetstats/wgetstats.cc |
— | — | @@ -25,15 +25,18 @@ |
26 | 26 | using std::strerror; |
27 | 27 | using std::string; |
28 | 28 | |
| 29 | +#ifdef __INTEL_COMPILER |
| 30 | +# pragma warning (disable: 383 981 1418) |
| 31 | +#endif |
| 32 | + |
29 | 33 | string |
30 | 34 | fstraddr(string const &straddr, sockaddr const *addr, socklen_t len) |
31 | 35 | { |
32 | 36 | char host[NI_MAXHOST]; |
33 | 37 | char port[NI_MAXSERV]; |
34 | 38 | string res; |
35 | | -int i; |
36 | | - if ((i = getnameinfo(addr, len, host, sizeof(host), port, sizeof(port), |
37 | | - NI_NUMERICHOST | NI_NUMERICSERV)) != 0) |
| 39 | + if (getnameinfo(addr, len, host, sizeof(host), port, sizeof(port), |
| 40 | + NI_NUMERICHOST | NI_NUMERICSERV) != 0) |
38 | 41 | return ""; |
39 | 42 | return straddr + '[' + host + "]:" + port; |
40 | 43 | } |
— | — | @@ -155,12 +158,19 @@ |
156 | 159 | reqfails = (uint32_t *) bufp; GET_BYTES(4); |
157 | 160 | respfails = (uint32_t *) bufp; GET_BYTES(3); |
158 | 161 | |
| 162 | + if (*vers != 1) { |
| 163 | + fprintf(stderr, |
| 164 | + "cannot decode this statistics format version (%d, expected 1)\n", |
| 165 | + (int) *vers); |
| 166 | + exit(1); |
| 167 | + } |
| 168 | + |
159 | 169 | fprintf(stderr, "%s (Willow %.*s), report interval %d seconds:\n", host, |
160 | 170 | (int)*wverslen, wvers, (int) *repint); |
161 | 171 | fprintf(stderr, "\tTotal requests served: % 10lu (% 6d/sec) Errors: % 6lu (% 6d/sec)\n", |
162 | | - (unsigned long) *treqok, (int) *reqoks, (unsigned long) *treqfail, *reqfails); |
| 172 | + (unsigned long) *treqok, (int) *reqoks, (unsigned long) *treqfail, (int) *reqfails); |
163 | 173 | fprintf(stderr, "\tBackend requests: % 10lu (% 6d/sec) Invalid: % 6lu (% 6d/sec)\n", |
164 | | - (unsigned long) *trespok, (int) *respoks, (unsigned long) *trespfail, *respfails); |
| 174 | + (unsigned long) *trespok, (int) *respoks, (unsigned long) *trespfail, (int) *respfails); |
165 | 175 | |
166 | 176 | freeaddrinfo(res); |
167 | 177 | } |
Index: trunk/willow/src/willow/flowio.cc |
— | — | @@ -107,8 +107,6 @@ |
108 | 108 | void |
109 | 109 | socket_spigot::_socketcall(wsocket *s, int) { |
110 | 110 | ssize_t read; |
111 | | -sink_result res; |
112 | | -int bufsz; |
113 | 111 | |
114 | 112 | /* |
115 | 113 | * _off is the offset of the start of _savebuf |
Index: trunk/willow/src/willow/whttp_header.cc |
— | — | @@ -42,7 +42,7 @@ |
43 | 43 | H_CONNECTION, |
44 | 44 | H_LOCATION, |
45 | 45 | H_X_WILLOW_BACKEND_GROUP, |
46 | | - H_X_WILLOW_FOLLOW_REDIRECT, |
| 46 | + H_X_WILLOW_FOLLOW_REDIRECT |
47 | 47 | }; |
48 | 48 | |
49 | 49 | #if 0 |
— | — | @@ -132,26 +132,6 @@ |
133 | 133 | } |
134 | 134 | #endif |
135 | 135 | |
136 | | -/* |
137 | | - * A list of headers we should remove from the request and the response |
138 | | - * because we don't like them, or we want to insert our own. |
139 | | - */ |
140 | | -static const struct rmhdr_t { |
141 | | - char *name; |
142 | | - size_t len; |
143 | | -} removable_headers[] = { |
144 | | - { "If-Modified-Since", sizeof("If-Modified-Since") - 1 }, |
145 | | - { "Last-Modified", sizeof("Last-Modified") - 1 }, |
146 | | - { "Keep-Alive", sizeof("Keep-Alive") - 1 }, |
147 | | - { "TE", sizeof("TE") - 1 }, |
148 | | - { "Trailers", sizeof("Trailers") - 1 }, |
149 | | - { "Upgrade", sizeof("Upgrade") - 1 }, |
150 | | - { "Proxy-Authenticate", sizeof("Proxy-Authenticate") - 1 }, |
151 | | - { "Proxy-Authorization", sizeof("Proxy-Authorization") - 1 }, |
152 | | - { "Proxy-Connection", sizeof("Proxy-Connection") - 1 }, |
153 | | - { NULL, 0 } |
154 | | -}; |
155 | | - |
156 | 136 | const char *request_string[] = { |
157 | 137 | "GET ", |
158 | 138 | "POST ", |
— | — | @@ -169,18 +149,6 @@ |
170 | 150 | { NULL, 0, REQTYPE_INVALID } |
171 | 151 | }; |
172 | 152 | |
173 | | -/* |
174 | | - * Check if we should remove this header. |
175 | | - */ |
176 | | -static bool |
177 | | -is_removable(char const *header, size_t hlen) |
178 | | -{ |
179 | | - for (rmhdr_t const *s = removable_headers; s->name; ++s) |
180 | | - if (hlen == s->len && !strncasecmp(header, s->name, hlen)) |
181 | | - return true; |
182 | | - return false; |
183 | | -} |
184 | | - |
185 | 153 | static int |
186 | 154 | find_reqtype(char const *str, int len) |
187 | 155 | { |
— | — | @@ -293,8 +261,6 @@ |
294 | 262 | void |
295 | 263 | header_list::append_last(const char *append, size_t len) |
296 | 264 | { |
297 | | -char const *tmp; |
298 | | -char *n; |
299 | 265 | int curnlen, curvlen; |
300 | 266 | curnlen = strlen(hl_last->hr_name); |
301 | 267 | curvlen = strlen(hl_last->hr_value); |
— | — | @@ -364,7 +330,7 @@ |
365 | 331 | char * |
366 | 332 | header_list::build(void) |
367 | 333 | { |
368 | | -char *buf, *bufp; |
| 334 | +char *buf; |
369 | 335 | size_t bufsz; |
370 | 336 | size_t buflen = 0; |
371 | 337 | |
— | — | @@ -510,7 +476,6 @@ |
511 | 477 | { |
512 | 478 | char const *path, *vers; |
513 | 479 | size_t plen, vlen; |
514 | | -int httpmaj, httpmin; |
515 | 480 | if ((path = (char const *)memchr(buf, ' ', endp - buf)) == NULL) |
516 | 481 | return -1; |
517 | 482 | path++; |
— | — | @@ -602,8 +567,6 @@ |
603 | 568 | void |
604 | 569 | header_parser::sp_uncork(void) |
605 | 570 | { |
606 | | -char *bptr; |
607 | | -int left = _headers.hl_len; |
608 | 571 | if (!_built) { |
609 | 572 | char *s; |
610 | 573 | if (!_is_response) { |
Index: trunk/willow/src/willow/lexer.l |
— | — | @@ -32,7 +32,6 @@ |
33 | 33 | int lineno; |
34 | 34 | } statestack[MAXINCLUDE + 1]; |
35 | 35 | int inclevel; |
36 | | -static int oldpos; |
37 | 36 | static bool in_if; |
38 | 37 | |
39 | 38 | #undef YY_INPUT |
— | — | @@ -58,7 +57,7 @@ |
59 | 58 | |
60 | 59 | ^.* { |
61 | 60 | conf::linebuf.assign(yytext, yyleng); |
62 | | - oldpos = conf::curpos = 0; |
| 61 | + conf::curpos = 0; |
63 | 62 | yyless(0); |
64 | 63 | } |
65 | 64 | <IGNORING>{if} { conf::report_parse_error("%%if may not be nested"); } |
— | — | @@ -133,27 +132,27 @@ |
134 | 133 | yyterminate(); |
135 | 134 | } |
136 | 135 | |
137 | | -\t { oldpos = conf::curpos; conf::curpos += 8; } |
138 | | -{ws} { oldpos = conf::curpos; conf::curpos += yyleng; } |
139 | | -var { oldpos = conf::curpos; conf::curpos += yyleng; return VAR; } |
140 | | -template { oldpos = conf::curpos; conf::curpos += yyleng; return TEMPLATE; } |
141 | | -from { oldpos = conf::curpos; conf::curpos += yyleng; return FROM; } |
142 | | -\.\. { oldpos = conf::curpos; conf::curpos += yyleng; return TWODOTS; } |
| 136 | +\t { conf::curpos += 8; } |
| 137 | +{ws} { conf::curpos += yyleng; } |
| 138 | +var { conf::curpos += yyleng; return VAR; } |
| 139 | +template { conf::curpos += yyleng; return TEMPLATE; } |
| 140 | +from { conf::curpos += yyleng; return FROM; } |
| 141 | +\.\. { conf::curpos += yyleng; return TWODOTS; } |
143 | 142 | |
144 | 143 | {qstring} { |
145 | 144 | yylval.string_ = new string(yytext + 1, yyleng - 2); |
146 | | - oldpos = conf::curpos; conf::curpos += yyleng; |
| 145 | + conf::curpos += yyleng; |
147 | 146 | return QSTRING; |
148 | 147 | } |
149 | 148 | {string} { |
150 | 149 | yylval.string_ = new string(yytext, yyleng); |
151 | | - oldpos = conf::curpos; conf::curpos += yyleng; |
| 150 | + conf::curpos += yyleng; |
152 | 151 | return STRING; |
153 | 152 | } |
154 | 153 | {number} { |
155 | 154 | yylval.number = atoi(yytext); |
156 | | - oldpos = conf::curpos; conf::curpos += yyleng; |
| 155 | + conf::curpos += yyleng; |
157 | 156 | return NUMBER; |
158 | 157 | } |
159 | | -. { oldpos = conf::curpos; conf::curpos++; return yytext[0]; } |
| 158 | +. { conf::curpos++; return yytext[0]; } |
160 | 159 | %% |