Skip to content

Instantly share code, notes, and snippets.

@hfm

hfm/-

Created December 19, 2016 11:48
Show Gist options
  • Save hfm/460a6e6dc1a285803af3cc47d28ef8af to your computer and use it in GitHub Desktop.
Save hfm/460a6e6dc1a285803af3cc47d28ef8af to your computer and use it in GitHub Desktop.
diff --git a/build_config.rb b/build_config.rb
index 4e3e90a..047e393 100644
--- a/build_config.rb
+++ b/build_config.rb
@@ -8,6 +8,10 @@
cc.flags << ENV['NGX_MRUBY_CFLAGS'] if ENV['NGX_MRUBY_CFLAGS']
end
+ conf.linker do |linker|
+ linker.option_library << ' -lstdc++'
+ end
+
#
# Recommended for ngx_mruby
#
@@ -32,6 +36,7 @@
conf.gem './mrbgems/ngx_mruby_mrblib'
conf.gem './mrbgems/rack-based-api'
+ conf.gem :github => 'kjunichi/mruby-mrmagick'
# use memcached
# conf.gem :github => 'matsumotory/mruby-memcached'
diff --git a/src/http/ngx_http_mruby_filter.c b/src/http/ngx_http_mruby_filter.c
index 91e8e00..e90642d 100644
--- a/src/http/ngx_http_mruby_filter.c
+++ b/src/http/ngx_http_mruby_filter.c
@@ -34,7 +34,7 @@ static mrb_value ngx_mrb_set_filter_body(mrb_state *mrb, mrb_value self)
body = mrb_funcall(mrb, body, "to_s", 0, NULL);
}
- ctx->body = (u_char *)mrb_str_to_cstr(mrb, body);
+ ctx->body = (u_char *)RSTRING_PTR(body);
ctx->body_length = RSTRING_LEN(body);
return mrb_fixnum_value(ctx->body_length);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment