/*----------------------------------------------------------------------------*/ int rp_bazaar_install(ngx_http_request_t *r) { rp_bazaar_ctx_t *ctx; ctx = ngx_http_get_module_ctx(r, ngx_http_rp_module); if(ctx == NULL) { fprintf(stderr, "%s: Cannot get request context\n", __FUNCTION__); return NGX_ERROR; } if(r->method & NGX_HTTP_POST) { ngx_int_t rc; ctx->finalize_on_post_handler = 0; rc = ngx_http_read_client_request_body(r, rp_bazaar_post_read); if(rc == NGX_AGAIN) { ctx->finalize_on_post_handler = 1; } else { return rp_module_redirect(r, ctx->redirect); } return rc; } return rp_module_cmd_error(&ctx->json_root, "Unsupported request method.", NULL, r->pool); }
static ngx_int_t ngx_http_graphicsmagick_handler(ngx_http_request_t *r) { ngx_int_t rc; if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_POST))) { return NGX_HTTP_NOT_ALLOWED; } if (r->method & NGX_HTTP_GET) { // handle get request, the convert source file is on local rc = ngx_http_discard_request_body(r); if (rc != NGX_OK) { return rc; } ngx_http_graphicsmagick_command_handler(r); } else { // handle post request, the convert source file is in request body r->request_body_in_file_only = 1; r->request_body_in_persistent_file = 1; r->request_body_in_clean_file = 1; r->request_body_file_group_access = 1; r->request_body_file_log_level = 0; rc = ngx_http_read_client_request_body(r, ngx_http_graphicsmagick_command_handler); if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { return rc; } } return NGX_DONE; }
/* Handler function that processes incoming requests destined for the Mobwrite daemon */ static ngx_int_t ngx_http_mobwrite_handler(ngx_http_request_t *r) { ngx_int_t rc; ngx_http_upstream_t *upstream; ngx_http_mobwrite_loc_conf_t *mobwrite_conf; /* Create an "upstream" object that tells nginx how to call the Mobwrite daemon */ if ((rc = ngx_http_upstream_create(r)) != NGX_OK) { return rc; } upstream = r->upstream; upstream->schema.len = sizeof("mobwrite://") - 1; upstream->schema.data = (u_char *)"mobwrite://"; upstream->output.tag = (ngx_buf_tag_t)&ngx_http_mobwrite_module; mobwrite_conf = (ngx_http_mobwrite_loc_conf_t *)ngx_http_get_module_loc_conf(r, ngx_http_mobwrite_module); upstream->conf = &(mobwrite_conf->upstream); /* These callbacks will do the actual work of sending a request to the Mobwrite daemon and processing the reponse */ upstream->create_request = ngx_http_mobwrite_create_request; upstream->reinit_request = ngx_http_mobwrite_reinit_request; upstream->process_header = ngx_http_mobwrite_process_response_header; upstream->abort_request = ngx_http_mobwrite_abort_request; upstream->finalize_request = ngx_http_mobwrite_finalize_request; /* Ask the nginx core to call our callbacks after the full POST body arrives. */ rc = ngx_http_read_client_request_body(r, ngx_http_upstream_init); if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { return rc; } return NGX_DONE; }
static ngx_int_t ngx_http_limit_access_interface_handler(ngx_http_request_t *r) { ngx_int_t rc; ngx_http_limit_access_request_ctx_t *request_ctx; ngx_http_limit_access_conf_t *lacf; if (r->method != NGX_HTTP_POST) { return NGX_HTTP_NOT_ALLOWED; } request_ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_limit_access_request_ctx_t)); if (request_ctx == NULL) { return NGX_ERROR; } lacf = ngx_http_get_module_loc_conf(r, ngx_http_limit_access_module); request_ctx->status = NGX_HTTP_OK; request_ctx->expire = lacf->default_expire; ngx_http_set_ctx(r, request_ctx, ngx_http_limit_access_module); ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "limit_access_interface_handler"); rc = ngx_http_read_client_request_body(r, ngx_http_limit_access_process_handler); if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { return rc; } return NGX_DONE; }
static ngx_int_t ngx_http_dav_handler(ngx_http_request_t *r) { ngx_int_t rc; ngx_http_dav_loc_conf_t *dlcf; /* TODO: Win32 */ if (r->zero_in_uri) { return NGX_DECLINED; } dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_module); if (!(r->method & dlcf->methods)) { return NGX_DECLINED; } switch (r->method) { case NGX_HTTP_PUT: if (r->uri.data[r->uri.len - 1] == '/') { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "can not PUT to a collection"); return NGX_HTTP_CONFLICT; } r->request_body_in_file_only = 1; r->request_body_in_persistent_file = 1; r->request_body_in_clean_file = 1; r->request_body_file_group_access = 1; r->request_body_file_log_level = 0; rc = ngx_http_read_client_request_body(r, ngx_http_dav_put_handler); if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { return rc; } return NGX_DONE; case NGX_HTTP_DELETE: return ngx_http_dav_delete_handler(r); case NGX_HTTP_MKCOL: return ngx_http_dav_mkcol_handler(r, dlcf); case NGX_HTTP_COPY: return ngx_http_dav_copy_move_handler(r); case NGX_HTTP_MOVE: return ngx_http_dav_copy_move_handler(r); } return NGX_DECLINED; }
static ngx_int_t xml_log(ngx_http_request_t *r) { xml_log_conf_t *cf; ngx_int_t rc; if (!r->method) return NGX_DECLINED; cf = ngx_http_get_module_loc_conf(r, xml_log_module); if(!cf->enable) return NGX_DECLINED; rc = ngx_http_read_client_request_body(r, xml_log_handler); if (rc >= NGX_HTTP_SPECIAL_RESPONSE || rc == NGX_DECLINED || rc ==NGX_AGAIN) { return rc; } #ifdef LOG return NGX_DECLINED; #else ngx_http_finalize_request(r, ngx_http_send_header(r)); return NGX_DONE; #endif }
ngx_int_t ngx_http_echo_exec_echo_read_request_body(ngx_http_request_t *r, ngx_http_echo_ctx_t *ctx) { return ngx_http_read_client_request_body(r, ngx_http_echo_post_read_request_body); }
int ngx_http_php_request_read_body(ngx_http_request_t *r) { ngx_int_t rc; ngx_http_php_ctx_t *ctx = ngx_http_get_module_ctx(r, ngx_http_php_module); if (r->method != NGX_HTTP_POST && r->method != NGX_HTTP_PUT){ //php_error(E_WARNING, "can't read body"); return NGX_OK; } r->request_body_in_single_buf = 1; rc = ngx_http_read_client_request_body(r, ngx_http_php_request_read_body_cb); if (rc == NGX_ERROR || rc >= NGX_HTTP_SPECIAL_RESPONSE){ //php_error(E_WARNING, "ngx_http_read_client_request_body failed"); return rc; } if (rc == NGX_AGAIN){ ctx->request_body_more = 1; return NGX_DONE; } return rc; }
static ngx_int_t ngx_lcb_handler(ngx_http_request_t *r) { ngx_int_t rc; ngx_http_upstream_t *u; ngx_lcb_loc_conf_t *llcf; llcf = ngx_http_get_module_loc_conf(r, ngx_http_couchbase_module); if (ngx_http_upstream_create(r) != NGX_OK) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } u = r->upstream; u->conf = &llcf->upstream; u->schema.len = sizeof("couchbase://") - 1; u->schema.data = (u_char *) "couchbase://"; u->output.tag = (ngx_buf_tag_t) &ngx_http_couchbase_module; u->create_request = ngx_lcb_create_request; u->reinit_request = ngx_lcb_reinit_request; u->process_header = ngx_lcb_process_header; u->abort_request = ngx_lcb_abort_request; u->finalize_request = ngx_lcb_finalize_request; u->input_filter_init = ngx_lcb_input_filter_init; u->input_filter = ngx_lcb_input_filter; u->input_filter_ctx = NULL; rc = ngx_http_read_client_request_body(r, ngx_lcb_upstream_init); if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { ngx_http_finalize_request(r, rc); } return NGX_DONE; }
static ngx_int_t ngx_http_mytest_handler(ngx_http_request_t *r) { // 处理头部 if(!(r->method & (NGX_HTTP_GET | NGX_HTTP_HEAD | NGX_HTTP_POST))) { return NGX_HTTP_NOT_ALLOWED; } ngx_log_error(NGX_LOG_DEBUG, r->connection->log, 0, "HEAD REACH13!\n"); #ifndef HTTP_BODY_ON // 丢弃请求的包体 ngx_int_t rc = ngx_http_discard_request_body(r); if (rc != NGX_OK) { return rc; } #else // 接收包体 ngx_int_t rc = ngx_http_read_client_request_body(r, ngx_http_mytest_body_handler); if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { return rc; } #endif return NGX_DONE; /*构造发送内容*/ // 构造发送头 ngx_str_t type = ngx_string("text/plain"); // 包的种类 ngx_str_t response = ngx_string("hello world!"); // 包的内容 r->headers_out.status = NGX_HTTP_OK; // 状态值 r->headers_out.content_length_n = response.len; // 包中内容的长度 r->headers_out.content_type = type; // 包中内容的种类 rc = ngx_http_send_header(r); // 发送头部 ngx_buf_t *b; b = ngx_create_temp_buf(r->pool, response.len); // 申请发送数据的内存,并初始化 if (b == NULL) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } ngx_memcpy(b->pos, response.data, response.len); // 将要发送的内容复制到内存 b->last = b->pos + response.len; b->last_buf = 1; // 声明这事最后一块缓存区 // 构造发送时的ngx_chain_t结构体 ngx_chain_t out; out.buf = b; // 要发的内容初始化 out.next = NULL; // next为空 ngx_http_output_filter(r, &out); // 发送包体 return NGX_DONE; }
ngx_int_t ngx_http_echo_exec_echo_read_request_body( ngx_http_request_t* r, ngx_http_echo_ctx_t *ctx) { ngx_int_t rc; rc = ngx_http_read_client_request_body(r, ngx_http_echo_post_read_request_body); if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { return rc; } return NGX_DONE; }
/* * The handler for POST requests (that update the RRD database). The * thing here is to remember that when this is called, the body might * not be available. So, you must to register an extra callback that * will be called when the body is available. */ ngx_int_t ngx_http_rrd_update_database(ngx_http_request_t *r) { ngx_log_t *log = r->connection->log; ngx_int_t rc; /* One could think of using ngx_http_test_content_type (I did) but this * is irrelevant as ngx_http_test_content_type works on the response * content type, not the request. On top of that, there is really * no need to go through a hash-table to check ONE value. */ if (r->headers_in.content_type == NULL || r->headers_in.content_type->value.data == NULL || r->headers_in.content_type->value.len != WWW_FORM_URLENCODED.len || ngx_strncasecmp(r->headers_in.content_type->value.data, WWW_FORM_URLENCODED.data, WWW_FORM_URLENCODED.len) != 0) { ngx_log_error(NGX_LOG_ALERT, log, 0, (char *) ERR_BAD_CONTENT_TYPE_MSG.data); ngx_http_complex_value_t cv = {ERR_BAD_CONTENT_TYPE_MSG, NULL, NULL, NULL}; return ngx_http_send_response(r, NGX_HTTP_NOT_ALLOWED, &TEXT_PLAIN, &cv); } ngx_log_debug(NGX_LOG_DEBUG_HTTP, log, 0, "rrd module: Content-type is OK. Proceeding."); ngx_log_debug(NGX_LOG_DEBUG_HTTP, log, 0, "rrd module: start reading client request body"); rc = ngx_http_read_client_request_body(r, ngx_http_rrd_body_received); if (rc == NGX_ERROR || rc >= NGX_HTTP_SPECIAL_RESPONSE) { return rc; } if (rc == NGX_AGAIN) { /* nginx will call the body_received when needed. Returning * NGX_DONE will prevent nginx from calling ngx_http_finalize_request * (which we will call in body_received) */ return NGX_DONE; } if (NGX_OK == rc) { ngx_log_debug(NGX_LOG_DEBUG_HTTP, log, 0, "rrd module: client request body already read"); return rc; } ngx_log_error(NGX_LOG_ALERT, log, 0, "rrd module: unexpected response code from" "ngx_http_read_client_request_body : %u", rc); return NGX_HTTP_INTERNAL_SERVER_ERROR; }
static ngx_int_t ngx_http_dyups_interface_read_body(ngx_http_request_t *r) { ngx_int_t rc; rc = ngx_http_read_client_request_body(r, ngx_http_dyups_body_handler); if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { return rc; } return NGX_DONE; }
static ngx_int_t ngx_http_ahhandler_handler(ngx_http_request_t *r) { /* we response to 'GET' and 'HEAD' requests only */ if (!(r->method & (NGX_HTTP_GET | NGX_HTTP_HEAD | NGX_HTTP_POST))) { return NGX_HTTP_NOT_ALLOWED; } //post request_body if (r->method & NGX_HTTP_POST) { return ngx_http_read_client_request_body(r, ngx_http_ahhandler_post_handler); } return ngx_http_handler_process(r); }
static ngx_int_t ngx_http_kafka_handler(ngx_http_request_t *r) { ngx_int_t rv; if (!(r->method & NGX_HTTP_POST)) { return NGX_HTTP_NOT_ALLOWED; } rv = ngx_http_read_client_request_body(r, ngx_http_kafka_post_callback_handler); if (rv >= NGX_HTTP_SPECIAL_RESPONSE) { return rv; } return NGX_DONE; }
static ngx_int_t ngx_http_tnt_handler(ngx_http_request_t *r) { ngx_int_t rc; ngx_http_upstream_t *u; ngx_http_tnt_loc_conf_t *tlcf; tlcf = ngx_http_get_module_loc_conf(r, ngx_http_tnt_module); if (!(r->method & ngx_http_tnt_allowed_methods) || (r->method & tlcf->http_rest_methods && !tlcf->method.len && r->uri.len <= 1 /* i.e '/' */)) { return NGX_HTTP_NOT_ALLOWED; } if (ngx_http_set_content_type(r) != NGX_OK || ngx_http_upstream_create(r) != NGX_OK) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } u = r->upstream; ngx_str_set(&u->schema, "tnt://"); u->output.tag = (ngx_buf_tag_t) &ngx_http_tnt_module; u->conf = &tlcf->upstream; rc = ngx_http_tnt_init_handlers(r, u, tlcf); if (rc != NGX_OK){ return rc; } u->input_filter_init = ngx_http_tnt_filter_init; u->input_filter = ngx_http_tnt_filter; u->input_filter_ctx = r; u->length = 0; u->state = 0; rc = ngx_http_read_client_request_body(r, ngx_http_upstream_init); if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { return rc; } return NGX_DONE; }
static ngx_int_t ngx_http_xrlt_handler(ngx_http_request_t *r) { ngx_http_xrlt_ctx_t *ctx; ngx_int_t rc; dd("XRLT begin (main: %p)", r->main); ctx = ngx_http_get_module_ctx(r, ngx_http_xrlt_module); if (ctx == NULL) { ctx = ngx_http_xrlt_create_ctx(r, 0); if (ctx == NULL) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } ngx_http_set_ctx(r, ctx, ngx_http_xrlt_module); } r->headers_out.status = NGX_HTTP_OK; rc = ngx_http_xrlt_transform_headers(r, ctx); if (rc == NGX_ERROR) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } if (rc == NGX_DONE) { return NGX_OK; } if (ctx->xctx->bodyData != NULL) { rc = ngx_http_read_client_request_body( r, ngx_http_xrlt_post_request_body ); if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { return rc; } if (ctx->xctx->cur & XRLT_STATUS_DONE) { ngx_http_xrlt_wev_handler(r); return NGX_OK; } } else { r->main->count++; } return NGX_DONE; }
static ngx_int_t ngx_http_push_publisher_handler(ngx_http_request_t * r) { ngx_int_t rc; /* Instruct ngx_http_read_subscriber_request_body to store the request body entirely in a memory buffer or in a file */ r->request_body_in_single_buf = 1; r->request_body_in_persistent_file = 1; r->request_body_in_clean_file = 0; r->request_body_file_log_level = 0; rc = ngx_http_read_client_request_body(r, ngx_http_push_publisher_body_handler); if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { return rc; } return NGX_DONE; }
static ngx_int_t ngx_zmx_handler(ngx_http_request_t *r) { ngx_int_t rc; ngx_http_upstream_t *u; ngx_zmx_ctx_t *ctx; ngx_http_proxy_loc_conf_t *plcf; if (ngx_http_upstream_create(r) != NGX_OK) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } ctx = ngx_pcalloc(r->pool, sizeof(ngx_zmx_ctx_t)); if (ctx == NULL) { return NGX_ERROR; } ngx_http_set_ctx(r, ctx, ngx_zmx_module); /* plcf = ngx_http_get_module_loc_conf(r, ngx_zmx_module); */ u = r->upstream; u->output.tag = (ngx_buf_tag_t) &ngx_zmx_module; u->conf = &plcf->upstream; u->create_request = ngx_http_proxy_create_request; u->reinit_request = ngx_http_proxy_reinit_request; u->process_header = ngx_http_proxy_process_status_line; u->abort_request = ngx_http_proxy_abort_request; u->finalize_request = ngx_http_proxy_finalize_request; r->state = 0; u->buffering = plcf->upstream.buffering; /* u->pipe = ngx_pcalloc(r->pool, sizeof(ngx_event_pipe_t)); */ /* if (u->pipe == NULL) { */ /* return NGX_HTTP_INTERNAL_SERVER_ERROR; */ /* } */ /* u->accel = 1; */ rc = ngx_http_read_client_request_body(r, ngx_http_upstream_init); return NGX_DONE; }
static ngx_int_t __post_read(ngx_bool_t key_in_body, ngx_str_t * backend_uri, ngx_http_request_t *r) { hustdb_ha_ctx_t * ctx = __create_ctx(r); if (!ctx) { return NGX_ERROR; } ctx->base.backend_uri = backend_uri; ctx->key_in_body = key_in_body; ngx_int_t rc = ngx_http_read_client_request_body(r, __post_handler); if ( rc >= NGX_HTTP_SPECIAL_RESPONSE ) { return rc; } return NGX_DONE; }
static ngx_int_t ngx_http_authen_handler(ngx_http_request_t *r) { ngx_int_t rc; if (!(r->method & NGX_HTTP_POST)) { return NGX_HTTP_NOT_ALLOWED; } if (r->headers_in.content_length_n > NGX_HTTP_AUTHEN_REQUEST_BODY_MAX) { return NGX_HTTP_REQUEST_ENTITY_TOO_LARGE; } rc = ngx_http_read_client_request_body(r, ngx_http_authen_post_handler); if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { return rc; } return NGX_DONE; }
ngx_int_t __first_put_handler(ngx_str_t * backend_uri, ngx_http_request_t *r) { ngx_str_t queue = hustmq_ha_get_queue(r); if (!queue.data) { return NGX_ERROR; } hustmq_ha_queue_dict_t * queue_dict = hustmq_ha_get_queue_dict(); if (!queue_dict) { return NGX_ERROR; } if (queue_dict->dict.ref && !hustmq_ha_put_queue_item_check(queue_dict, &queue)) { return ngx_http_send_response_imp(NGX_HTTP_NOT_FOUND, NULL, r); } size_t peer_count = ngx_http_get_backend_count(); if (peer_count < 1) { return NGX_ERROR; } hustmq_ha_put_ctx_t * ctx = ngx_palloc(r->pool, sizeof(hustmq_ha_put_ctx_t)); if (!ctx) { return NGX_ERROR; } memset(ctx, 0, sizeof(hustmq_ha_put_ctx_t)); ngx_http_set_addon_module_ctx(r, ctx); ctx->base.backend_uri = backend_uri; ctx->peer_count = peer_count; ctx->count = 0; ngx_int_t rc = ngx_http_read_client_request_body(r, __post_body_handler); if ( rc >= NGX_HTTP_SPECIAL_RESPONSE ) { return rc; } return NGX_DONE; }
ngx_int_t hustdb_ha_start_post( ngx_bool_t support_post_only, ngx_bool_t key_in_body, ngx_bool_t has_tb, ngx_bool_t check_body_len, ngx_str_t * backend_uri, ngx_http_request_t *r) { ngx_http_hustdb_ha_write_ctx_t * ctx = __create_write_ctx(r); if (!ctx) { return hustdb_ha_send_response(NGX_HTTP_NOT_FOUND, NULL, NULL, r); } ctx->check_body_len = check_body_len; ctx->base.base.backend_uri = backend_uri; if (support_post_only && !(r->method & NGX_HTTP_POST)) { return NGX_HTTP_NOT_ALLOWED; } if (key_in_body) { ctx->key_in_body = true; ctx->has_tb = has_tb; } else { write_ctx_t tmp; if (!__set_write_context(NULL, has_tb, r, &tmp)) { return hustdb_ha_send_response(NGX_HTTP_NOT_FOUND, NULL, NULL, r); } __copy_data(&tmp, ctx); } ngx_int_t rc = ngx_http_read_client_request_body(r, __post_handler); if ( rc >= NGX_HTTP_SPECIAL_RESPONSE ) { return rc; } return NGX_DONE; }
static ngx_int_t ngx_http_flaxton_logger_handler(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data) { if(flaxton_logger.is_active) { ngx_int_t rc; if ((r->method & (NGX_HTTP_POST|NGX_HTTP_PUT)) && flaxton_logger.logging_level == LOG_FULL_REQUEST) { rc = ngx_http_read_client_request_body(r, fx_log_full_request); if (rc == NGX_ERROR || rc >= NGX_HTTP_SPECIAL_RESPONSE) { return rc; } } else { if(flaxton_logger.logging_level != LOG_BODY) { fx_log_headers_request(r); } } } return NGX_OK; }
static ngx_int_t ngx_http_push_stream_publisher_handle_post(ngx_http_push_stream_loc_conf_t *cf, ngx_http_request_t *r, ngx_str_t *id) { ngx_int_t rc; ngx_http_push_stream_channel_t *channel = NULL; // check if channel id isn't equals to ALL or contain wildcard if ((ngx_memn2cmp(id->data, NGX_HTTP_PUSH_STREAM_ALL_CHANNELS_INFO_ID.data, id->len, NGX_HTTP_PUSH_STREAM_ALL_CHANNELS_INFO_ID.len) == 0) || (ngx_strchr(id->data, '*') != NULL)) { return ngx_http_push_stream_send_only_header_response(r, NGX_HTTP_FORBIDDEN, &NGX_HTTP_PUSH_STREAM_NO_CHANNEL_ID_NOT_AUTHORIZED_MESSAGE); } // create the channel if doesn't exist channel = ngx_http_push_stream_get_channel(id, r->connection->log, cf); if (channel == NULL) { ngx_log_error(NGX_LOG_ERR, (r)->connection->log, 0, "push stream module: unable to allocate memory for new channel"); return ngx_http_push_stream_send_only_header_response(r, NGX_HTTP_INTERNAL_SERVER_ERROR, NULL); } if (channel == NGX_HTTP_PUSH_STREAM_NUMBER_OF_CHANNELS_EXCEEDED) { ngx_log_error(NGX_LOG_ERR, (r)->connection->log, 0, "push stream module: number of channels were exceeded"); return ngx_http_push_stream_send_only_header_response(r, NGX_HTTP_FORBIDDEN, &NGX_HTTP_PUSH_STREAM_NUMBER_OF_CHANNELS_EXCEEDED_MESSAGE); } /* * Instruct ngx_http_read_subscriber_request_body to store the request * body entirely in a memory buffer or in a file. */ r->request_body_in_single_buf = 0; r->request_body_in_persistent_file = 1; r->request_body_in_clean_file = 0; r->request_body_file_log_level = 0; // parse the body message and return rc = ngx_http_read_client_request_body(r, ngx_http_push_stream_publisher_body_handler); if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { return rc; } return NGX_DONE; }
static ngx_int_t ngx_http_push_stream_publisher_handle_after_read_body(ngx_http_request_t *r, ngx_http_client_body_handler_pt post_handler) { ngx_int_t rc; /* * Instruct ngx_http_read_subscriber_request_body to store the request * body entirely in a memory buffer or in a file. */ r->request_body_in_single_buf = 0; r->request_body_in_persistent_file = 1; r->request_body_in_clean_file = 0; r->request_body_file_log_level = 0; // parse the body message and return rc = ngx_http_read_client_request_body(r, post_handler); if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { return rc; } return NGX_DONE; }
ngx_int_t ngx_http_yar_read_request_handler(ngx_http_request_t *r){ r->request_body_in_single_buf = 1; r->request_body_in_file_only = 0; ngx_int_t rc; rc = ngx_http_read_client_request_body(r,ngx_http_yar_handler); if(rc == NGX_ERROR || rc >= NGX_HTTP_SPECIAL_RESPONSE) { return rc; } return NGX_DONE; }
static ngx_int_t __start_zwrite(ngx_str_t * backend_uri, ngx_http_request_t *r) { ngx_http_hustdb_ha_write_ctx_t * ctx = __create_zwrite_ctx(r); if (!ctx) { return hustdb_ha_send_response(NGX_HTTP_NOT_FOUND, NULL, NULL, r); } ctx->base.base.backend_uri = backend_uri; write_ctx_t tmp; if (!__parse_args(true, true, r, &tmp)) { return hustdb_ha_send_response(NGX_HTTP_NOT_FOUND, NULL, NULL, r); } __copy_data(&tmp, ctx); ngx_int_t rc = ngx_http_read_client_request_body(r, __post_body_handler); if ( rc >= NGX_HTTP_SPECIAL_RESPONSE ) { return rc; } return NGX_DONE; }
static ngx_int_t ngx_http_groonga_handler(ngx_http_request_t *r) { ngx_int_t rc; switch (r->method) { case NGX_HTTP_GET: case NGX_HTTP_HEAD: rc = ngx_http_groonga_handler_get(r); break; case NGX_HTTP_POST: rc = ngx_http_read_client_request_body(r, ngx_http_groonga_handler_post); if (rc < NGX_HTTP_SPECIAL_RESPONSE) { rc = NGX_DONE; } break; default: rc = NGX_HTTP_NOT_ALLOWED; break; } return rc; }
ngx_int_t ngx_http_psgi_handler(ngx_http_request_t *r) { if (r->headers_in.content_length_n == 0) { ngx_http_psgi_handler_with_body(r); return NGX_OK; } r->request_body_in_single_buf = 1; r->request_body_in_persistent_file = 1; r->request_body_in_clean_file = 1; if (r->request_body_in_file_only) { r->request_body_file_log_level = 0; } ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "Loading body for PSGI request"); ngx_http_read_client_request_body(r, ngx_http_psgi_handler_with_body); return NGX_OK; }