nxt_application.c (277:6baa1731cc6f) nxt_application.c (319:e5a65b58101f)
1
2/*
3 * Copyright (C) Max Romanov
4 * Copyright (C) Igor Sysoev
5 * Copyright (C) Valentin V. Bartenev
6 * Copyright (C) NGINX, Inc.
7 */
8

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

767 { nxt_string("Content-Type"), &nxt_app_request_content_type, 0 },
768 { nxt_string("Cookie"), &nxt_app_request_cookie, 0 },
769 { nxt_string("Host"), &nxt_app_request_host, 0 },
770
771 { nxt_null_string, NULL, 0 }
772};
773
774
1
2/*
3 * Copyright (C) Max Romanov
4 * Copyright (C) Igor Sysoev
5 * Copyright (C) Valentin V. Bartenev
6 * Copyright (C) NGINX, Inc.
7 */
8

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

767 { nxt_string("Content-Type"), &nxt_app_request_content_type, 0 },
768 { nxt_string("Cookie"), &nxt_app_request_cookie, 0 },
769 { nxt_string("Host"), &nxt_app_request_host, 0 },
770
771 { nxt_null_string, NULL, 0 }
772};
773
774
775nxt_int_t
776nxt_app_http_req_init(nxt_task_t *task, nxt_app_parse_ctx_t *ctx)
775nxt_app_parse_ctx_t *
776nxt_app_http_req_init(nxt_task_t *task)
777{
777{
778 nxt_int_t rc;
778 nxt_mp_t *mp;
779 nxt_int_t rc;
780 nxt_app_parse_ctx_t *ctx;
779
781
780 ctx->mem_pool = nxt_mp_create(1024, 128, 256, 32);
782 mp = nxt_mp_create(1024, 128, 256, 32);
783 if (nxt_slow_path(mp == NULL)) {
784 return NULL;
785 }
781
786
782 rc = nxt_http_parse_request_init(&ctx->parser, ctx->mem_pool);
787 ctx = nxt_mp_retain(mp, sizeof(nxt_app_parse_ctx_t));
788 if (nxt_slow_path(ctx == NULL)) {
789 nxt_mp_destroy(mp);
790
791 return NULL;
792 }
793
794 nxt_memzero(ctx, sizeof(nxt_app_parse_ctx_t));
795
796 ctx->mem_pool = mp;
797
798 rc = nxt_http_parse_request_init(&ctx->parser, mp);
783 if (nxt_slow_path(rc != NXT_OK)) {
799 if (nxt_slow_path(rc != NXT_OK)) {
784 return rc;
800 nxt_mp_release(mp, ctx);
801
802 return NULL;
785 }
786
787 ctx->parser.fields_hash = nxt_app_request_fields_hash;
788
803 }
804
805 ctx->parser.fields_hash = nxt_app_request_fields_hash;
806
789 return NXT_OK;
807 return ctx;
790}
791
792
793nxt_int_t
794nxt_app_http_req_header_parse(nxt_task_t *task, nxt_app_parse_ctx_t *ctx,
795 nxt_buf_t *buf)
796{
797 nxt_int_t rc;

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

874
875 return b->done == 1 ? NXT_DONE : NXT_AGAIN;
876}
877
878
879nxt_int_t
880nxt_app_http_req_done(nxt_task_t *task, nxt_app_parse_ctx_t *ctx)
881{
808}
809
810
811nxt_int_t
812nxt_app_http_req_header_parse(nxt_task_t *task, nxt_app_parse_ctx_t *ctx,
813 nxt_buf_t *buf)
814{
815 nxt_int_t rc;

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

892
893 return b->done == 1 ? NXT_DONE : NXT_AGAIN;
894}
895
896
897nxt_int_t
898nxt_app_http_req_done(nxt_task_t *task, nxt_app_parse_ctx_t *ctx)
899{
882 nxt_mp_destroy(ctx->mem_pool);
900 nxt_mp_release(ctx->mem_pool, ctx);
883
884 return NXT_OK;
885}
886
887
888nxt_int_t
889nxt_app_msg_flush(nxt_task_t *task, nxt_app_wmsg_t *msg, nxt_bool_t last)
890{

--- 145 unchanged lines hidden ---
901
902 return NXT_OK;
903}
904
905
906nxt_int_t
907nxt_app_msg_flush(nxt_task_t *task, nxt_app_wmsg_t *msg, nxt_bool_t last)
908{

--- 145 unchanged lines hidden ---