nxt_http_request.c (1112:18c32043ae2e) nxt_http_request.c (1131:ec7d924d8dfb)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_router.h>
8#include <nxt_http.h>
9
10
11static nxt_int_t nxt_http_validate_host(nxt_str_t *host, nxt_mp_t *mp);
12static void nxt_http_request_start(nxt_task_t *task, void *obj, void *data);
13static void nxt_http_request_pass(nxt_task_t *task, void *obj, void *data);
14static void nxt_http_request_proto_info(nxt_task_t *task,
15 nxt_http_request_t *r);
16static void nxt_http_request_mem_buf_completion(nxt_task_t *task, void *obj,
17 void *data);
18static void nxt_http_request_done(nxt_task_t *task, void *obj, void *data);
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_router.h>
8#include <nxt_http.h>
9
10
11static nxt_int_t nxt_http_validate_host(nxt_str_t *host, nxt_mp_t *mp);
12static void nxt_http_request_start(nxt_task_t *task, void *obj, void *data);
13static void nxt_http_request_pass(nxt_task_t *task, void *obj, void *data);
14static void nxt_http_request_proto_info(nxt_task_t *task,
15 nxt_http_request_t *r);
16static void nxt_http_request_mem_buf_completion(nxt_task_t *task, void *obj,
17 void *data);
18static void nxt_http_request_done(nxt_task_t *task, void *obj, void *data);
19static void nxt_http_request_close_handler(nxt_task_t *task, void *obj,
20 void *data);
21
22static u_char *nxt_http_date(u_char *buf, nxt_realtime_t *now, struct tm *tm,
23 size_t size, const char *format);
24
25
26static const nxt_http_request_state_t nxt_http_request_init_state;
27static const nxt_http_request_state_t nxt_http_request_body_state;
28

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

439
440fail:
441
442 nxt_http_request_error(task, r, NXT_HTTP_INTERNAL_SERVER_ERROR);
443}
444
445
446void
19
20static u_char *nxt_http_date(u_char *buf, nxt_realtime_t *now, struct tm *tm,
21 size_t size, const char *format);
22
23
24static const nxt_http_request_state_t nxt_http_request_init_state;
25static const nxt_http_request_state_t nxt_http_request_body_state;
26

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

437
438fail:
439
440 nxt_http_request_error(task, r, NXT_HTTP_INTERNAL_SERVER_ERROR);
441}
442
443
444void
445nxt_http_request_ws_frame_start(nxt_task_t *task, nxt_http_request_t *r,
446 nxt_buf_t *ws_frame)
447{
448 if (r->proto.any != NULL) {
449 nxt_http_proto[r->protocol].ws_frame_start(task, r, ws_frame);
450 }
451}
452
453
454void
447nxt_http_request_send(nxt_task_t *task, nxt_http_request_t *r, nxt_buf_t *out)
448{
449 if (nxt_fast_path(r->proto.any != NULL)) {
450 nxt_http_proto[r->protocol].send(task, r, out);
451 }
452}
453
454

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

525 r->error = 1;
526
527 if (nxt_fast_path(proto.any != NULL)) {
528 nxt_http_proto[r->protocol].discard(task, r, nxt_http_buf_last(r));
529 }
530}
531
532
455nxt_http_request_send(nxt_task_t *task, nxt_http_request_t *r, nxt_buf_t *out)
456{
457 if (nxt_fast_path(r->proto.any != NULL)) {
458 nxt_http_proto[r->protocol].send(task, r, out);
459 }
460}
461
462

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

533 r->error = 1;
534
535 if (nxt_fast_path(proto.any != NULL)) {
536 nxt_http_proto[r->protocol].discard(task, r, nxt_http_buf_last(r));
537 }
538}
539
540
533static void
541void
534nxt_http_request_close_handler(nxt_task_t *task, void *obj, void *data)
535{
536 nxt_http_proto_t proto;
537 nxt_http_request_t *r;
538 nxt_http_protocol_t protocol;
539 nxt_socket_conf_joint_t *conf;
540 nxt_router_access_log_t *access_log;
541

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

551
552 access_log = conf->socket_conf->router_conf->access_log;
553
554 if (access_log != NULL) {
555 access_log->handler(task, r, access_log);
556 }
557 }
558
542nxt_http_request_close_handler(nxt_task_t *task, void *obj, void *data)
543{
544 nxt_http_proto_t proto;
545 nxt_http_request_t *r;
546 nxt_http_protocol_t protocol;
547 nxt_socket_conf_joint_t *conf;
548 nxt_router_access_log_t *access_log;
549

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

559
560 access_log = conf->socket_conf->router_conf->access_log;
561
562 if (access_log != NULL) {
563 access_log->handler(task, r, access_log);
564 }
565 }
566
559 protocol = r->protocol;
560
561 r->proto.any = NULL;
567 r->proto.any = NULL;
562 nxt_mp_release(r->mem_pool);
563
564 if (nxt_fast_path(proto.any != NULL)) {
568
569 if (nxt_fast_path(proto.any != NULL)) {
570 protocol = r->protocol;
571
572 nxt_mp_release(r->mem_pool);
573
565 nxt_http_proto[protocol].close(task, proto, conf);
566 }
567}
568
569
570static u_char *
571nxt_http_date(u_char *buf, nxt_realtime_t *now, struct tm *tm, size_t size,
572 const char *format)

--- 12 unchanged lines hidden ---
574 nxt_http_proto[protocol].close(task, proto, conf);
575 }
576}
577
578
579static u_char *
580nxt_http_date(u_char *buf, nxt_realtime_t *now, struct tm *tm, size_t size,
581 const char *format)

--- 12 unchanged lines hidden ---