Klaus Demo nginx / d3bf7c1
fix bugs introduced in r2204 Igor Sysoev 12 years ago
1 changed file(s) with 19 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
255255 ngx_int_t n;
256256 struct hostent *h;
257257
258 u->family = AF_INET;
259
258260 host = u->url.data;
259261
260262 last = host + u->url.len;
278280 if (port) {
279281 port++;
280282
281 if (last - port == 0) {
283 len = last - port;
284
285 if (len == 0) {
282286 u->err = "invalid port";
283287 return NGX_ERROR;
284288 }
285289
286 u->port_text.len = last - port;
290 n = ngx_atoi(port, len);
291
292 if (n < 1 || n > 65536) {
293 u->err = "invalid port";
294 return NGX_ERROR;
295 }
296
297 u->port = (in_port_t) n;
298
299 u->port_text.len = len;
287300 u->port_text.data = port;
288301
289302 last = port - 1;
330343
331344 u->host.len = len;
332345 u->host.data = host;
346
347 if (u->no_resolve) {
348 return NGX_OK;
349 }
333350
334351 if (len++) {
335352
358375
359376 } else {
360377 u->addr.in_addr = INADDR_ANY;
361 }
362
363 if (u->port_text.len) {
364
365 n = ngx_atoi(u->port_text.data, u->port_text.len);
366
367 if (n < 1 || n > 65536) {
368 u->err = "invalid port";
369 return NGX_ERROR;
370 }
371
372 u->port = (in_port_t) n;
373 }
374
375 u->family = AF_INET;
376
377 if (u->no_resolve) {
378 return NGX_OK;
379378 }
380379
381380 if (u->no_port) {