nxt_http_request.c (1270:9efa309be18b) nxt_http_request.c (1401:c88f739aac1c)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_router.h>
8#include <nxt_http.h>

--- 172 unchanged lines hidden (view full) ---

181 return NXT_OK;
182}
183
184
185nxt_int_t
186nxt_http_request_content_length(void *ctx, nxt_http_field_t *field,
187 uintptr_t data)
188{
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_router.h>
8#include <nxt_http.h>

--- 172 unchanged lines hidden (view full) ---

181 return NXT_OK;
182}
183
184
185nxt_int_t
186nxt_http_request_content_length(void *ctx, nxt_http_field_t *field,
187 uintptr_t data)
188{
189 nxt_off_t n;
189 nxt_off_t n, max_body_size;
190 nxt_http_request_t *r;
191
192 r = ctx;
193
194 if (nxt_fast_path(r->content_length == NULL)) {
195 r->content_length = field;
196
197 n = nxt_off_t_parse(field->value, field->value_length);
198
199 if (nxt_fast_path(n >= 0)) {
200 r->content_length_n = n;
190 nxt_http_request_t *r;
191
192 r = ctx;
193
194 if (nxt_fast_path(r->content_length == NULL)) {
195 r->content_length = field;
196
197 n = nxt_off_t_parse(field->value, field->value_length);
198
199 if (nxt_fast_path(n >= 0)) {
200 r->content_length_n = n;
201
202 max_body_size = r->conf->socket_conf->max_body_size;
203
204 if (nxt_slow_path(n > max_body_size)) {
205 return NXT_HTTP_PAYLOAD_TOO_LARGE;
206 }
207
201 return NXT_OK;
202 }
203 }
204
205 return NXT_HTTP_BAD_REQUEST;
206}
207
208

--- 382 unchanged lines hidden ---
208 return NXT_OK;
209 }
210 }
211
212 return NXT_HTTP_BAD_REQUEST;
213}
214
215

--- 382 unchanged lines hidden ---