Mercurial > hg > nginx
comparison src/http/modules/proxy/ngx_http_proxy_handler.c @ 257:70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 11 Feb 2004 17:08:49 +0000 |
parents | 0b67be7d4489 |
children | bdd631bf1a1c |
comparison
equal
deleted
inserted
replaced
256:8e39cab6abd5 | 257:70e1c7d2b83d |
---|---|
344 { | 344 { |
345 ngx_connection_t *c; | 345 ngx_connection_t *c; |
346 ngx_http_request_t *r; | 346 ngx_http_request_t *r; |
347 ngx_http_proxy_ctx_t *p; | 347 ngx_http_proxy_ctx_t *p; |
348 | 348 |
349 ngx_log_debug(wev->log, "http proxy check client"); | 349 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, wev->log, 0, "http proxy check client"); |
350 | 350 |
351 c = wev->data; | 351 c = wev->data; |
352 r = c->data; | 352 r = c->data; |
353 p = ngx_http_get_module_ctx(r, ngx_http_proxy_module); | 353 p = ngx_http_get_module_ctx(r, ngx_http_proxy_module); |
354 | 354 |
360 wev->error = 1; | 360 wev->error = 1; |
361 } | 361 } |
362 | 362 |
363 if (!p->cachable && p->upstream->peer.connection) { | 363 if (!p->cachable && p->upstream->peer.connection) { |
364 ngx_log_error(NGX_LOG_INFO, wev->log, wev->kq_errno, | 364 ngx_log_error(NGX_LOG_INFO, wev->log, wev->kq_errno, |
365 "client closed prematurely connection, " | 365 "kevent() reported that client have closed " |
366 "prematurely connection, " | |
366 "so upstream connection is closed too"); | 367 "so upstream connection is closed too"); |
367 ngx_http_proxy_finalize_request(p, NGX_HTTP_CLIENT_CLOSED_REQUEST); | 368 ngx_http_proxy_finalize_request(p, NGX_HTTP_CLIENT_CLOSED_REQUEST); |
368 return; | 369 return; |
369 } | 370 } |
370 | 371 |
371 ngx_log_error(NGX_LOG_INFO, wev->log, wev->kq_errno, | 372 ngx_log_error(NGX_LOG_INFO, wev->log, wev->kq_errno, |
372 "client closed prematurely connection"); | 373 "kevent() reported that client have closed " |
374 "prematurely connection"); | |
373 | 375 |
374 if (p->upstream == NULL || p->upstream->peer.connection == NULL) { | 376 if (p->upstream == NULL || p->upstream->peer.connection == NULL) { |
375 ngx_http_proxy_finalize_request(p, NGX_HTTP_CLIENT_CLOSED_REQUEST); | 377 ngx_http_proxy_finalize_request(p, NGX_HTTP_CLIENT_CLOSED_REQUEST); |
376 } | 378 } |
377 } | 379 } |
383 { | 385 { |
384 ngx_connection_t *c; | 386 ngx_connection_t *c; |
385 ngx_http_request_t *r; | 387 ngx_http_request_t *r; |
386 ngx_http_proxy_ctx_t *p; | 388 ngx_http_proxy_ctx_t *p; |
387 | 389 |
388 ngx_log_debug(rev->log, "busy lock"); | 390 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, rev->log, 0, "http proxy busy lock"); |
389 | 391 |
390 c = rev->data; | 392 c = rev->data; |
391 r = c->data; | 393 r = c->data; |
392 p = ngx_http_get_module_ctx(r, ngx_http_proxy_module); | 394 p = ngx_http_get_module_ctx(r, ngx_http_proxy_module); |
393 p->action = "waiting upstream in busy lock"; | 395 p->action = "waiting upstream in busy lock"; |
410 } | 412 } |
411 | 413 |
412 return; | 414 return; |
413 } | 415 } |
414 | 416 |
415 ngx_log_debug(rev->log, "client sent while busy lock"); | 417 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, rev->log, 0, |
418 "http proxy: client sent while busy lock"); | |
416 | 419 |
417 /* | 420 /* |
418 * TODO: kevent() notify about error, otherwise we need to | 421 * TODO: kevent() notify about error, otherwise we need to |
419 * call ngx_peek(): recv(MSG_PEEK) to get errno. THINK about aio | 422 * call ngx_peek(): recv(MSG_PEEK) to get errno. THINK about aio. |
420 * if there's no error we need to disable event. | 423 * if there's no error we need to disable event. |
421 */ | 424 */ |
422 | 425 |
423 #if 0 | 426 #if 0 |
424 #if (HAVE_KQUEUE) | 427 #if (HAVE_KQUEUE) |
450 { | 453 { |
451 ngx_http_request_t *r; | 454 ngx_http_request_t *r; |
452 | 455 |
453 r = p->request; | 456 r = p->request; |
454 | 457 |
455 ngx_log_debug(r->connection->log, "finalize http proxy request"); | 458 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
459 "finalize http proxy request"); | |
456 | 460 |
457 if (p->upstream && p->upstream->peer.connection) { | 461 if (p->upstream && p->upstream->peer.connection) { |
458 ngx_http_proxy_close_connection(p); | 462 ngx_http_proxy_close_connection(p); |
459 } | 463 } |
460 | 464 |
468 r->connection->log->data = p->saved_ctx; | 472 r->connection->log->data = p->saved_ctx; |
469 r->connection->log->handler = p->saved_handler; | 473 r->connection->log->handler = p->saved_handler; |
470 } | 474 } |
471 | 475 |
472 if (p->upstream && p->upstream->event_pipe) { | 476 if (p->upstream && p->upstream->event_pipe) { |
473 ngx_log_debug(r->connection->log, "TEMP FD: %d" _ | 477 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
474 p->upstream->event_pipe->temp_file->file.fd); | 478 "http proxy temp fd: %d", |
479 p->upstream->event_pipe->temp_file->file.fd); | |
475 } | 480 } |
476 | 481 |
477 if (p->cache) { | 482 if (p->cache) { |
478 ngx_log_debug(r->connection->log, "CACHE FD: %d" _ p->cache->ctx.file.fd); | 483 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
484 "http proxy cache fd: %d", | |
485 p->cache->ctx.file.fd); | |
479 } | 486 } |
480 | 487 |
481 if (p->upstream && p->upstream->event_pipe) { | 488 if (p->upstream && p->upstream->event_pipe) { |
482 r->file.fd = p->upstream->event_pipe->temp_file->file.fd; | 489 r->file.fd = p->upstream->event_pipe->temp_file->file.fd; |
483 | 490 |
502 | 509 |
503 if (p->lcf->busy_lock) { | 510 if (p->lcf->busy_lock) { |
504 p->lcf->busy_lock->busy--; | 511 p->lcf->busy_lock->busy--; |
505 } | 512 } |
506 | 513 |
507 ngx_log_debug(c->log, "proxy close connection: %d" _ c->fd); | 514 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, |
515 "http proxy close connection: %d", c->fd); | |
508 | 516 |
509 if (c->fd == -1) { | 517 if (c->fd == -1) { |
510 #if 0 | 518 #if 0 |
511 ngx_log_error(NGX_LOG_ALERT, c->log, 0, "connection already closed"); | 519 ngx_log_error(NGX_LOG_ALERT, c->log, 0, "connection already closed"); |
512 #endif | 520 #endif |