comparison src/http/modules/proxy/ngx_http_proxy_handler.c @ 305:4b1a3a4acc60

nginx-0.0.3-2004-04-02-19:13:20 import
author Igor Sysoev <igor@sysoev.ru>
date Fri, 02 Apr 2004 15:13:20 +0000
parents bcbe876f4262
children 6b91bfbc4123
comparison
equal deleted inserted replaced
304:bcbe876f4262 305:4b1a3a4acc60
379 c = ev->data; 379 c = ev->data;
380 r = c->data; 380 r = c->data;
381 p = ngx_http_get_module_ctx(r, ngx_http_proxy_module); 381 p = ngx_http_get_module_ctx(r, ngx_http_proxy_module);
382 382
383 #if (HAVE_KQUEUE) 383 #if (HAVE_KQUEUE)
384
385 /* TODO: KEVENT_EVENT */
386
384 if (ev->kq_eof) { 387 if (ev->kq_eof) {
385 ev->eof = 1; 388 ev->eof = 1;
386 389
387 if (ev->kq_errno) { 390 if (ev->kq_errno) {
388 ev->error = 1; 391 ev->error = 1;
403 406
404 if (p->upstream == NULL || p->upstream->peer.connection == NULL) { 407 if (p->upstream == NULL || p->upstream->peer.connection == NULL) {
405 ngx_http_proxy_finalize_request(p, NGX_HTTP_CLIENT_CLOSED_REQUEST); 408 ngx_http_proxy_finalize_request(p, NGX_HTTP_CLIENT_CLOSED_REQUEST);
406 } 409 }
407 } 410 }
411
412 #else
413
414 n = recv(c->fd, buf, 1, MSG_PEEK);
415
416 if (n > 0) {
417 /* TODO: delete level */
418 return;
419 }
420
421 if (n == -1) {
422 err = ngx_socket_errno;
423 if (err == NGX_EAGAIN) {
424 return;
425 }
426
427 ev->error = 1;
428
429 } else if (n == 0) {
430 err = 0;
431 ev->eof = 1;
432 }
433
434 if (!p->cachable && p->upstream->peer.connection) {
435 ngx_log_error(NGX_LOG_INFO, ev->log, err,
436 "client have closed prematurely connection, "
437 "so upstream connection is closed too");
438 ngx_http_proxy_finalize_request(p, NGX_HTTP_CLIENT_CLOSED_REQUEST);
439 return;
440 }
441
442 ngx_log_error(NGX_LOG_INFO, ev->log, ev->err,
443 "client have closed prematurely connection");
444
445 if (p->upstream == NULL || p->upstream->peer.connection == NULL) {
446 ngx_http_proxy_finalize_request(p, NGX_HTTP_CLIENT_CLOSED_REQUEST);
447 }
448
408 #endif 449 #endif
409 } 450 }
410 451
411 452
412 void ngx_http_proxy_busy_lock_handler(ngx_event_t *rev) 453 void ngx_http_proxy_busy_lock_handler(ngx_event_t *rev)