comparison src/http/ngx_http_request.c @ 362:7650aea1816f

nginx-0.0.7-2004-06-21-19:59:32 import
author Igor Sysoev <igor@sysoev.ru>
date Mon, 21 Jun 2004 15:59:32 +0000
parents 446782c909b3
children ceec87d1c2b3
comparison
equal deleted inserted replaced
361:446782c909b3 362:7650aea1816f
1048 ngx_http_core_loc_conf_t *clcf; 1048 ngx_http_core_loc_conf_t *clcf;
1049 1049
1050 wev = r->connection->write; 1050 wev = r->connection->write;
1051 wev->event_handler = ngx_http_writer; 1051 wev->event_handler = ngx_http_writer;
1052 1052
1053 if (wev->ready && r->delayed) { 1053 if (wev->ready && wev->delayed) {
1054 return; 1054 return;
1055 } 1055 }
1056 1056
1057 clcf = ngx_http_get_module_loc_conf(r->main ? r->main : r, 1057 clcf = ngx_http_get_module_loc_conf(r->main ? r->main : r,
1058 ngx_http_core_module); 1058 ngx_http_core_module);
1059 if (!r->delayed) { 1059 if (!wev->delayed) {
1060 ngx_add_timer(wev, clcf->send_timeout); 1060 ngx_add_timer(wev, clcf->send_timeout);
1061 } 1061 }
1062 1062
1063 wev->available = clcf->send_lowat; 1063 wev->available = clcf->send_lowat;
1064 if (ngx_handle_write_event(wev, NGX_LOWAT_EVENT) == NGX_ERROR) { 1064 if (ngx_handle_write_event(wev, NGX_LOWAT_EVENT) == NGX_ERROR) {
1081 1081
1082 c = wev->data; 1082 c = wev->data;
1083 r = c->data; 1083 r = c->data;
1084 1084
1085 if (wev->timedout) { 1085 if (wev->timedout) {
1086 if (!r->delayed) { 1086 if (!wev->delayed) {
1087 ngx_http_client_error(r, 0, NGX_HTTP_REQUEST_TIME_OUT); 1087 ngx_http_client_error(r, 0, NGX_HTTP_REQUEST_TIME_OUT);
1088 return; 1088 return;
1089 } 1089 }
1090 1090
1091 wev->timedout = 0; 1091 wev->timedout = 0;
1092 r->delayed = 0; 1092 wev->delayed = 0;
1093 1093
1094 if (!wev->ready) { 1094 if (!wev->ready) {
1095 clcf = ngx_http_get_module_loc_conf(r->main ? r->main : r, 1095 clcf = ngx_http_get_module_loc_conf(r->main ? r->main : r,
1096 ngx_http_core_module); 1096 ngx_http_core_module);
1097 ngx_add_timer(wev, clcf->send_timeout); 1097 ngx_add_timer(wev, clcf->send_timeout);
1105 1105
1106 return; 1106 return;
1107 } 1107 }
1108 1108
1109 } else { 1109 } else {
1110 if (r->delayed) { 1110 if (wev->delayed) {
1111 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, wev->log, 0, 1111 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, wev->log, 0,
1112 "http writer delayed"); 1112 "http writer delayed");
1113
1114 clcf = ngx_http_get_module_loc_conf(r->main ? r->main : r,
1115 ngx_http_core_module);
1116 wev->available = clcf->send_lowat;
1117
1118 if (ngx_handle_write_event(wev, NGX_LOWAT_EVENT) == NGX_ERROR) {
1119 ngx_http_close_request(r, 0);
1120 ngx_http_close_connection(r->connection);
1121 }
1122
1113 return; 1123 return;
1114 } 1124 }
1115 } 1125 }
1116 1126
1117 rc = ngx_http_output_filter(r, NULL); 1127 rc = ngx_http_output_filter(r, NULL);
1120 "http writer output filter: %d", rc); 1130 "http writer output filter: %d", rc);
1121 1131
1122 if (rc == NGX_AGAIN) { 1132 if (rc == NGX_AGAIN) {
1123 clcf = ngx_http_get_module_loc_conf(r->main ? r->main : r, 1133 clcf = ngx_http_get_module_loc_conf(r->main ? r->main : r,
1124 ngx_http_core_module); 1134 ngx_http_core_module);
1125 if (!wev->ready && !r->delayed) { 1135 if (!wev->ready && !wev->delayed) {
1126 ngx_add_timer(wev, clcf->send_timeout); 1136 ngx_add_timer(wev, clcf->send_timeout);
1127 } 1137 }
1128 1138
1129 wev->available = clcf->send_lowat; 1139 wev->available = clcf->send_lowat;
1130 1140