Deleted
Added
nxt_controller.c (67:5bde485f693f) | nxt_controller.c (91:c3192e381294) |
---|---|
1 2/* 3 * Copyright (C) Igor Sysoev 4 * Copyright (C) Valentin V. Bartenev 5 * Copyright (C) NGINX, Inc. 6 */ 7 8#include <nxt_main.h> --- 94 unchanged lines hidden (view full) --- 103 } 104 105 mp = nxt_mp_create(1024, 128, 256, 32); 106 107 if (nxt_slow_path(mp == NULL)) { 108 return NXT_ERROR; 109 } 110 | 1 2/* 3 * Copyright (C) Igor Sysoev 4 * Copyright (C) Valentin V. Bartenev 5 * Copyright (C) NGINX, Inc. 6 */ 7 8#include <nxt_main.h> --- 94 unchanged lines hidden (view full) --- 103 } 104 105 mp = nxt_mp_create(1024, 128, 256, 32); 106 107 if (nxt_slow_path(mp == NULL)) { 108 return NXT_ERROR; 109 } 110 |
111 conf = nxt_conf_json_parse(json.start, json.length, mp); | 111 conf = nxt_conf_json_str_parse(mp, &json); |
112 113 if (conf == NULL) { 114 return NXT_ERROR; 115 } 116 117 nxt_controller_conf.root = conf; 118 nxt_controller_conf.pool = mp; 119 --- 466 unchanged lines hidden (view full) --- 586 587 if (nxt_slow_path(mp == NULL)) { 588 status = 500; 589 goto done; 590 } 591 592 mbuf = &c->read->mem; 593 | 112 113 if (conf == NULL) { 114 return NXT_ERROR; 115 } 116 117 nxt_controller_conf.root = conf; 118 nxt_controller_conf.pool = mp; 119 --- 466 unchanged lines hidden (view full) --- 586 587 if (nxt_slow_path(mp == NULL)) { 588 status = 500; 589 goto done; 590 } 591 592 mbuf = &c->read->mem; 593 |
594 value = nxt_conf_json_parse(mbuf->pos, mbuf->free - mbuf->pos, mp); | 594 value = nxt_conf_json_parse(mp, mbuf->pos, mbuf->free); |
595 596 if (value == NULL) { 597 nxt_mp_destroy(mp); 598 status = 400; 599 goto done; 600 } 601 602 if (path.length != 1) { | 595 596 if (value == NULL) { 597 nxt_mp_destroy(mp); 598 status = 400; 599 goto done; 600 } 601 602 if (path.length != 1) { |
603 rc = nxt_conf_json_op_compile(nxt_controller_conf.root, value, 604 &ops, &path, c->mem_pool); | 603 rc = nxt_conf_json_op_compile(c->mem_pool, &ops, 604 nxt_controller_conf.root, 605 &path, value); |
605 606 if (rc != NXT_OK) { 607 if (rc == NXT_DECLINED) { 608 status = 404; 609 goto done; 610 } 611 612 status = 500; 613 goto done; 614 } 615 | 606 607 if (rc != NXT_OK) { 608 if (rc == NXT_DECLINED) { 609 status = 404; 610 goto done; 611 } 612 613 status = 500; 614 goto done; 615 } 616 |
616 value = nxt_conf_json_clone_value(nxt_controller_conf.root, 617 ops, mp); | 617 value = nxt_conf_json_clone_value(mp, ops, 618 nxt_controller_conf.root); |
618 619 if (nxt_slow_path(value == NULL)) { 620 nxt_mp_destroy(mp); 621 status = 500; 622 goto done; 623 } 624 } 625 --- 13 unchanged lines hidden (view full) --- 639 if (path.length == 1) { 640 mp = nxt_mp_create(1024, 128, 256, 32); 641 642 if (nxt_slow_path(mp == NULL)) { 643 status = 500; 644 goto done; 645 } 646 | 619 620 if (nxt_slow_path(value == NULL)) { 621 nxt_mp_destroy(mp); 622 status = 500; 623 goto done; 624 } 625 } 626 --- 13 unchanged lines hidden (view full) --- 640 if (path.length == 1) { 641 mp = nxt_mp_create(1024, 128, 256, 32); 642 643 if (nxt_slow_path(mp == NULL)) { 644 status = 500; 645 goto done; 646 } 647 |
647 value = nxt_conf_json_parse(empty_obj.start, empty_obj.length, mp); | 648 value = nxt_conf_json_str_parse(mp, &empty_obj); |
648 649 } else { | 649 650 } else { |
650 rc = nxt_conf_json_op_compile(nxt_controller_conf.root, NULL, &ops, 651 &path, c->mem_pool); | 651 rc = nxt_conf_json_op_compile(c->mem_pool, &ops, 652 nxt_controller_conf.root, 653 &path, NULL); |
652 653 if (rc != NXT_OK) { 654 if (rc == NXT_DECLINED) { 655 status = 404; 656 goto done; 657 } 658 659 status = 500; 660 goto done; 661 } 662 663 mp = nxt_mp_create(1024, 128, 256, 32); 664 665 if (nxt_slow_path(mp == NULL)) { 666 status = 500; 667 goto done; 668 } 669 | 654 655 if (rc != NXT_OK) { 656 if (rc == NXT_DECLINED) { 657 status = 404; 658 goto done; 659 } 660 661 status = 500; 662 goto done; 663 } 664 665 mp = nxt_mp_create(1024, 128, 256, 32); 666 667 if (nxt_slow_path(mp == NULL)) { 668 status = 500; 669 goto done; 670 } 671 |
670 value = nxt_conf_json_clone_value(nxt_controller_conf.root, 671 ops, mp); | 672 value = nxt_conf_json_clone_value(mp, ops, 673 nxt_controller_conf.root); |
672 } 673 674 if (nxt_slow_path(value == NULL)) { 675 nxt_mp_destroy(mp); 676 status = 500; 677 goto done; 678 } 679 --- 90 unchanged lines hidden (view full) --- 770 nxt_buf_t *b; 771 nxt_conf_json_value_t *value; 772 nxt_conf_json_pretty_t pretty; 773 774 if (resp->json_value) { 775 value = resp->json_value; 776 777 } else { | 674 } 675 676 if (nxt_slow_path(value == NULL)) { 677 nxt_mp_destroy(mp); 678 status = 500; 679 goto done; 680 } 681 --- 90 unchanged lines hidden (view full) --- 772 nxt_buf_t *b; 773 nxt_conf_json_value_t *value; 774 nxt_conf_json_pretty_t pretty; 775 776 if (resp->json_value) { 777 value = resp->json_value; 778 779 } else { |
778 value = nxt_conf_json_parse(resp->json_string.start, 779 resp->json_string.length, pool); | 780 value = nxt_conf_json_str_parse(pool, &resp->json_string); |
780 781 if (nxt_slow_path(value == NULL)) { 782 return NULL; 783 } 784 } 785 786 nxt_memzero(&pretty, sizeof(nxt_conf_json_pretty_t)); 787 --- 17 unchanged lines hidden --- | 781 782 if (nxt_slow_path(value == NULL)) { 783 return NULL; 784 } 785 } 786 787 nxt_memzero(&pretty, sizeof(nxt_conf_json_pretty_t)); 788 --- 17 unchanged lines hidden --- |