Re: PUT и POST module handler
rba
nginx-forum на nginx.us
Ср Окт 14 08:55:05 UTC 2015
Переписал код и уменьшил client_body_buffer_size, в результате мелкие
запросы проходят, но запросы побольше заканчиваются сообщением о epool,
подскажите куда копать?
лог...
client request body is buffered to a temporary
...
...http client request body...
...
2015/10/14 14:45:32 [debug] 15847#0: *1 RBSAMPLE 1. put/post!!!!
2015/10/14 14:45:32 [debug] 15847#0: *1 RBSAMPLE 1.1 put/post chain
140725089748632 addr
2015/10/14 14:45:32 [debug] 15847#0: *1 RBSAMPLE 2. put/post!!!!
2015/10/14 14:45:32 [debug] 15848#0: epoll add event: fd:7 op:1 ev:00002001
И дальше не идёт !!!
Переписал так:
static void
ngx_http_rbsample_debug(ngx_http_request_t *r, u_char *buffer, int nbytes)
{
ngx_log_debug(NGX_LOG_DEBUG_EVENT, r->connection->log, 0, "RBSAMPLE 2.
put/post!!!!");
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, r->connection->log, 0, "RBSAMPLE 3.
put/post: \"%s\"", buffer);
}
static void
ngx_http_rbsample_post_handler(ngx_http_request_t *r)
{
size_t len;
ngx_buf_t *buf;
ngx_chain_t *cl;
if (r->request_body == NULL && r->request_body->temp_file == NULL) {
ngx_log_debug(NGX_LOG_DEBUG_EVENT, r->connection->log, 0, "RBSAMPLE
999. put/post!!!!");
ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
return;
}
ngx_log_debug(NGX_LOG_DEBUG_EVENT, r->connection->log, 0, "RBSAMPLE 1.
put/post!!!!");
cl = r->request_body->bufs;
buf = cl->buf;
len = buf->last - buf->pos;
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, r->connection->log, 0, "RBSAMPLE 1.1
put/post chain %i addr", &cl);
ngx_http_rbsample_debug(r, buf->pos, len);
if(!r->request_body->rest && !cl->next) {
ngx_log_debug(NGX_LOG_DEBUG_EVENT, r->connection->log, 0, "RBSAMPLE
4. put/post finalize!!!!");
ngx_http_finalize_request(r, 0);;
}
if(cl->next){
ngx_log_debug(NGX_LOG_DEBUG_EVENT, r->connection->log, 0, "RBSAMPLE
3.1 put/post free chain!!!!");
ngx_free_chain(r->pool, cl);
}
return;
}
static ngx_int_t
ngx_http_rbsample_handler(ngx_http_request_t *r)
{
ngx_int_t rc;
ngx_log_debug(NGX_LOG_DEBUG_EVENT, r->connection->log, 0, "rbsample 0.
ngx_http_rbsample_handler!");
if(r->method == NGX_HTTP_PUT || r->method == NGX_HTTP_POST) {
rc = ngx_http_read_client_request_body(r,
ngx_http_rbsample_post_handler);
if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
return rc;
}
return NGX_DONE;
}
return ngx_http_rbsample_other_handler(r);
}
Posted at Nginx Forum: http://forum.nginx.org/read.php?21,262136,262193#msg-262193
Подробная информация о списке рассылки nginx-ru