Commit 5e10cc4c authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Use gc save/restore around downcase method

parent 95e6c875
......@@ -224,11 +224,16 @@ mrb_value request_mod_header(mrb_state *mrb, mrb_value self, bool repl) {
mrb_raise(mrb, E_RUNTIME_ERROR, "empty key is not allowed");
}
auto ai = mrb_gc_arena_save(mrb);
key = mrb_funcall(mrb, key, "downcase", 0);
auto keyref =
make_string_ref(balloc, StringRef{RSTRING_PTR(key),
static_cast<size_t>(RSTRING_LEN(key))});
mrb_gc_arena_restore(mrb, ai);
auto token = http2::lookup_token(keyref.byte(), keyref.size());
if (repl) {
......
......@@ -116,11 +116,16 @@ mrb_value response_mod_header(mrb_state *mrb, mrb_value self, bool repl) {
mrb_raise(mrb, E_RUNTIME_ERROR, "empty key is not allowed");
}
auto ai = mrb_gc_arena_save(mrb);
key = mrb_funcall(mrb, key, "downcase", 0);
auto keyref =
make_string_ref(balloc, StringRef{RSTRING_PTR(key),
static_cast<size_t>(RSTRING_LEN(key))});
mrb_gc_arena_restore(mrb, ai);
auto token = http2::lookup_token(keyref.byte(), keyref.size());
if (repl) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment