Welcome! Log In Create A New Profile

Advanced

Re: PUT и POST module handler

rba
October 14, 2015 04:55AM
Переписал код и уменьшил 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);
}
Subject Author Posted

PUT и POST module handler

rba October 13, 2015 02:13AM

Re: PUT и POST module handler

rba October 14, 2015 03:34AM

Re: PUT и POST module handler

rba October 14, 2015 04:55AM

Re: PUT и POST module handler

Maxim Dounin October 14, 2015 09:00AM

Re: PUT и POST module handler

rba October 19, 2015 03:19AM

Re: PUT и POST module handler

Maxim Dounin October 19, 2015 11:14AM

Re: PUT и POST module handler

rba December 29, 2015 02:57AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 109
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready