Deleted
Added
nxt_ruby.c (1011:0c41674ec79c) | nxt_ruby.c (1258:f396f2421319) |
---|---|
1/* 2 * Copyright (C) Alexander Borisov 3 * Copyright (C) NGINX, Inc. 4 */ 5 6#include <ruby/nxt_ruby.h> 7 8#include <nxt_unit.h> --- 71 unchanged lines hidden (view full) --- 80 nxt_ruby_init, 81}; 82 83 84static nxt_int_t 85nxt_ruby_init(nxt_task_t *task, nxt_common_app_conf_t *conf) 86{ 87 int state, rc; | 1/* 2 * Copyright (C) Alexander Borisov 3 * Copyright (C) NGINX, Inc. 4 */ 5 6#include <ruby/nxt_ruby.h> 7 8#include <nxt_unit.h> --- 71 unchanged lines hidden (view full) --- 80 nxt_ruby_init, 81}; 82 83 84static nxt_int_t 85nxt_ruby_init(nxt_task_t *task, nxt_common_app_conf_t *conf) 86{ 87 int state, rc; |
88 VALUE dummy, res; | 88 VALUE res; |
89 nxt_unit_ctx_t *unit_ctx; 90 nxt_unit_init_t ruby_unit_init; 91 nxt_ruby_rack_init_t rack_init; 92 | 89 nxt_unit_ctx_t *unit_ctx; 90 nxt_unit_init_t ruby_unit_init; 91 nxt_ruby_rack_init_t rack_init; 92 |
93 static char *argv[2] = { (char *) "NGINX_Unit", (char *) "-e0" }; 94 95 RUBY_INIT_STACK |
|
93 ruby_init(); | 96 ruby_init(); |
94 Init_stack(&dummy); 95 ruby_init_loadpath(); | 97 ruby_options(2, argv); |
96 ruby_script("NGINX_Unit"); 97 98 rack_init.task = task; 99 rack_init.script = &conf->u.ruby.script; 100 101 res = rb_protect(nxt_ruby_init_basic, 102 (VALUE) (uintptr_t) &rack_init, &state); 103 if (nxt_slow_path(res == Qnil || state != 0)) { --- 598 unchanged lines hidden (view full) --- 702 } 703 704 rc = nxt_ruby_rack_result_body_file_write(fn); 705 if (nxt_slow_path(rc != NXT_UNIT_OK)) { 706 return rc; 707 } 708 709 } else if (rb_respond_to(body, rb_intern("each"))) { | 98 ruby_script("NGINX_Unit"); 99 100 rack_init.task = task; 101 rack_init.script = &conf->u.ruby.script; 102 103 res = rb_protect(nxt_ruby_init_basic, 104 (VALUE) (uintptr_t) &rack_init, &state); 105 if (nxt_slow_path(res == Qnil || state != 0)) { --- 598 unchanged lines hidden (view full) --- 704 } 705 706 rc = nxt_ruby_rack_result_body_file_write(fn); 707 if (nxt_slow_path(rc != NXT_UNIT_OK)) { 708 return rc; 709 } 710 711 } else if (rb_respond_to(body, rb_intern("each"))) { |
710 rb_iterate(rb_each, body, nxt_ruby_rack_result_body_each, 0); | 712 rb_block_call(body, rb_intern("each"), 0, 0, 713 nxt_ruby_rack_result_body_each, 0); |
711 712 } else { 713 nxt_unit_req_error(nxt_ruby_run_ctx.req, 714 "Ruby: Invalid response 'body' format " 715 "from application"); 716 717 return NXT_UNIT_ERROR; 718 } --- 173 unchanged lines hidden --- | 714 715 } else { 716 nxt_unit_req_error(nxt_ruby_run_ctx.req, 717 "Ruby: Invalid response 'body' format " 718 "from application"); 719 720 return NXT_UNIT_ERROR; 721 } --- 173 unchanged lines hidden --- |