nxt_ruby.c (673:9fa79c719a17) nxt_ruby.c (703:2d536dde84d2)
1/*
2 * Copyright (C) Alexander Borisov
3 * Copyright (C) NGINX, Inc.
4 */
5
6#include <ruby/nxt_ruby.h>
7
8

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

576 } else {
577 nxt_log(nxt_ruby_run_ctx.task, NXT_LOG_ERR,
578 "Ruby: Invalid response 'status' format from application");
579
580 return NXT_ERROR;
581 }
582
583 rc = nxt_ruby_write(nxt_ruby_run_ctx.task, nxt_ruby_run_ctx.wmsg,
1/*
2 * Copyright (C) Alexander Borisov
3 * Copyright (C) NGINX, Inc.
4 */
5
6#include <ruby/nxt_ruby.h>
7
8

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

576 } else {
577 nxt_log(nxt_ruby_run_ctx.task, NXT_LOG_ERR,
578 "Ruby: Invalid response 'status' format from application");
579
580 return NXT_ERROR;
581 }
582
583 rc = nxt_ruby_write(nxt_ruby_run_ctx.task, nxt_ruby_run_ctx.wmsg,
584 (u_char *) "Status: ", (sizeof("Status: ") - 1), 0, 0);
584 (u_char *) "Status: ", nxt_length("Status: "), 0, 0);
585 if (nxt_slow_path(rc != NXT_OK)) {
586 return NXT_ERROR;
587 }
588
589 rc = nxt_ruby_write(nxt_ruby_run_ctx.task, nxt_ruby_run_ctx.wmsg,
590 p, len, 0, 0);
591 if (nxt_slow_path(rc != NXT_OK)) {
592 return NXT_ERROR;
593 }
594
595 rc = nxt_ruby_write(nxt_ruby_run_ctx.task, nxt_ruby_run_ctx.wmsg,
585 if (nxt_slow_path(rc != NXT_OK)) {
586 return NXT_ERROR;
587 }
588
589 rc = nxt_ruby_write(nxt_ruby_run_ctx.task, nxt_ruby_run_ctx.wmsg,
590 p, len, 0, 0);
591 if (nxt_slow_path(rc != NXT_OK)) {
592 return NXT_ERROR;
593 }
594
595 rc = nxt_ruby_write(nxt_ruby_run_ctx.task, nxt_ruby_run_ctx.wmsg,
596 (u_char *) "\r\n", (sizeof("\r\n") - 1), 0, 0);
596 (u_char *) "\r\n", nxt_length("\r\n"), 0, 0);
597 if (nxt_slow_path(rc != NXT_OK)) {
598 return NXT_ERROR;
599 }
600
601 return NXT_OK;
602}
603
604

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

638 rc = NXT_OK;
639
640 rb_hash_foreach(headers, nxt_ruby_hash_foreach, (VALUE) (uintptr_t) &rc);
641 if (nxt_slow_path(rc != NXT_OK)) {
642 return NXT_ERROR;
643 }
644
645 rc = nxt_ruby_write(nxt_ruby_run_ctx.task, nxt_ruby_run_ctx.wmsg,
597 if (nxt_slow_path(rc != NXT_OK)) {
598 return NXT_ERROR;
599 }
600
601 return NXT_OK;
602}
603
604

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

638 rc = NXT_OK;
639
640 rb_hash_foreach(headers, nxt_ruby_hash_foreach, (VALUE) (uintptr_t) &rc);
641 if (nxt_slow_path(rc != NXT_OK)) {
642 return NXT_ERROR;
643 }
644
645 rc = nxt_ruby_write(nxt_ruby_run_ctx.task, nxt_ruby_run_ctx.wmsg,
646 (u_char *) "\r\n", (sizeof("\r\n") - 1), 0, 0);
646 (u_char *) "\r\n", nxt_length("\r\n"), 0, 0);
647 if (nxt_slow_path(rc != NXT_OK)) {
648 return NXT_ERROR;
649 }
650
651 return NXT_OK;
652}
653
654

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

724
725 rc = nxt_app_msg_write_raw(nxt_ruby_run_ctx.task, nxt_ruby_run_ctx.wmsg,
726 (u_char *) key, key_size);
727 if (nxt_slow_path(rc != NXT_OK)) {
728 return rc;
729 }
730
731 rc = nxt_app_msg_write_raw(nxt_ruby_run_ctx.task, nxt_ruby_run_ctx.wmsg,
647 if (nxt_slow_path(rc != NXT_OK)) {
648 return NXT_ERROR;
649 }
650
651 return NXT_OK;
652}
653
654

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

724
725 rc = nxt_app_msg_write_raw(nxt_ruby_run_ctx.task, nxt_ruby_run_ctx.wmsg,
726 (u_char *) key, key_size);
727 if (nxt_slow_path(rc != NXT_OK)) {
728 return rc;
729 }
730
731 rc = nxt_app_msg_write_raw(nxt_ruby_run_ctx.task, nxt_ruby_run_ctx.wmsg,
732 (u_char *) ": ", (sizeof(": ") - 1));
732 (u_char *) ": ", nxt_length(": "));
733 if (nxt_slow_path(rc != NXT_OK)) {
734 return rc;
735 }
736
737 rc = nxt_app_msg_write_raw(nxt_ruby_run_ctx.task, nxt_ruby_run_ctx.wmsg,
738 (u_char *) value, value_size);
739 if (nxt_slow_path(rc != NXT_OK)) {
740 return rc;
741 }
742
743 return nxt_app_msg_write_raw(nxt_ruby_run_ctx.task, nxt_ruby_run_ctx.wmsg,
733 if (nxt_slow_path(rc != NXT_OK)) {
734 return rc;
735 }
736
737 rc = nxt_app_msg_write_raw(nxt_ruby_run_ctx.task, nxt_ruby_run_ctx.wmsg,
738 (u_char *) value, value_size);
739 if (nxt_slow_path(rc != NXT_OK)) {
740 return rc;
741 }
742
743 return nxt_app_msg_write_raw(nxt_ruby_run_ctx.task, nxt_ruby_run_ctx.wmsg,
744 (u_char *) "\r\n", (sizeof("\r\n") - 1));
744 (u_char *) "\r\n", nxt_length("\r\n"));
745}
746
747
748static nxt_int_t
749nxt_ruby_rack_result_body(VALUE result)
750{
751 VALUE fn, body;
752 nxt_int_t rc;

--- 167 unchanged lines hidden ---
745}
746
747
748static nxt_int_t
749nxt_ruby_rack_result_body(VALUE result)
750{
751 VALUE fn, body;
752 nxt_int_t rc;

--- 167 unchanged lines hidden ---