Mercurial > hg > nginx
comparison src/http/ngx_http_request.c @ 361:446782c909b3
nginx-0.0.7-2004-06-20-23:54:15 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 20 Jun 2004 19:54:15 +0000 |
parents | 0a03c921c81d |
children | 7650aea1816f |
comparison
equal
deleted
inserted
replaced
360:239e37d44a34 | 361:446782c909b3 |
---|---|
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->delayed && wev->ready) { | 1053 if (wev->ready && r->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 ngx_add_timer(wev, clcf->send_timeout); | 1059 if (!r->delayed) { |
1060 ngx_add_timer(wev, clcf->send_timeout); | |
1061 } | |
1060 | 1062 |
1061 wev->available = clcf->send_lowat; | 1063 wev->available = clcf->send_lowat; |
1062 if (ngx_handle_write_event(wev, NGX_LOWAT_EVENT) == NGX_ERROR) { | 1064 if (ngx_handle_write_event(wev, NGX_LOWAT_EVENT) == NGX_ERROR) { |
1063 ngx_http_close_request(r, 0); | 1065 ngx_http_close_request(r, 0); |
1064 ngx_http_close_connection(r->connection); | 1066 ngx_http_close_connection(r->connection); |
1078 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, wev->log, 0, "http writer handler"); | 1080 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, wev->log, 0, "http writer handler"); |
1079 | 1081 |
1080 c = wev->data; | 1082 c = wev->data; |
1081 r = c->data; | 1083 r = c->data; |
1082 | 1084 |
1083 #if 0 /* TODO: THINK */ | |
1084 if (wev->delayed) { | |
1085 return; | |
1086 } | |
1087 #endif | |
1088 | |
1089 if (wev->timedout) { | 1085 if (wev->timedout) { |
1090 ngx_http_client_error(r, 0, NGX_HTTP_REQUEST_TIME_OUT); | 1086 if (!r->delayed) { |
1091 return; | 1087 ngx_http_client_error(r, 0, NGX_HTTP_REQUEST_TIME_OUT); |
1092 } | 1088 return; |
1093 | 1089 } |
1094 rc = ngx_http_output_filter(r, NULL); | 1090 |
1095 | 1091 wev->timedout = 0; |
1096 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | 1092 r->delayed = 0; |
1097 "http writer output filter: %d", rc); | 1093 |
1098 | |
1099 if (rc == NGX_AGAIN) { | |
1100 if (!wev->ready) { | 1094 if (!wev->ready) { |
1101 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, |
1102 ngx_http_core_module); | 1096 ngx_http_core_module); |
1103 ngx_add_timer(wev, clcf->send_timeout); | 1097 ngx_add_timer(wev, clcf->send_timeout); |
1104 } | 1098 |
1105 | 1099 wev->available = clcf->send_lowat; |
1106 if (ngx_handle_level_write_event(wev) == NGX_ERROR) { | 1100 |
1101 if (ngx_handle_write_event(wev, NGX_LOWAT_EVENT) == NGX_ERROR) { | |
1102 ngx_http_close_request(r, 0); | |
1103 ngx_http_close_connection(r->connection); | |
1104 } | |
1105 | |
1106 return; | |
1107 } | |
1108 | |
1109 } else { | |
1110 if (r->delayed) { | |
1111 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, wev->log, 0, | |
1112 "http writer delayed"); | |
1113 return; | |
1114 } | |
1115 } | |
1116 | |
1117 rc = ngx_http_output_filter(r, NULL); | |
1118 | |
1119 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
1120 "http writer output filter: %d", rc); | |
1121 | |
1122 if (rc == NGX_AGAIN) { | |
1123 clcf = ngx_http_get_module_loc_conf(r->main ? r->main : r, | |
1124 ngx_http_core_module); | |
1125 if (!wev->ready && !r->delayed) { | |
1126 ngx_add_timer(wev, clcf->send_timeout); | |
1127 } | |
1128 | |
1129 wev->available = clcf->send_lowat; | |
1130 | |
1131 if (ngx_handle_write_event(wev, NGX_LOWAT_EVENT) == NGX_ERROR) { | |
1107 ngx_http_close_request(r, 0); | 1132 ngx_http_close_request(r, 0); |
1108 ngx_http_close_connection(r->connection); | 1133 ngx_http_close_connection(r->connection); |
1109 } | 1134 } |
1110 | 1135 |
1111 return; | 1136 return; |