nghttpx: Use gc save/restore around downcase method
This commit is contained in:
parent
95e6c875f0
commit
5e10cc4cad
|
@ -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");
|
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);
|
key = mrb_funcall(mrb, key, "downcase", 0);
|
||||||
|
|
||||||
auto keyref =
|
auto keyref =
|
||||||
make_string_ref(balloc, StringRef{RSTRING_PTR(key),
|
make_string_ref(balloc, StringRef{RSTRING_PTR(key),
|
||||||
static_cast<size_t>(RSTRING_LEN(key))});
|
static_cast<size_t>(RSTRING_LEN(key))});
|
||||||
|
|
||||||
|
mrb_gc_arena_restore(mrb, ai);
|
||||||
|
|
||||||
auto token = http2::lookup_token(keyref.byte(), keyref.size());
|
auto token = http2::lookup_token(keyref.byte(), keyref.size());
|
||||||
|
|
||||||
if (repl) {
|
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");
|
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);
|
key = mrb_funcall(mrb, key, "downcase", 0);
|
||||||
|
|
||||||
auto keyref =
|
auto keyref =
|
||||||
make_string_ref(balloc, StringRef{RSTRING_PTR(key),
|
make_string_ref(balloc, StringRef{RSTRING_PTR(key),
|
||||||
static_cast<size_t>(RSTRING_LEN(key))});
|
static_cast<size_t>(RSTRING_LEN(key))});
|
||||||
|
|
||||||
|
mrb_gc_arena_restore(mrb, ai);
|
||||||
|
|
||||||
auto token = http2::lookup_token(keyref.byte(), keyref.size());
|
auto token = http2::lookup_token(keyref.byte(), keyref.size());
|
||||||
|
|
||||||
if (repl) {
|
if (repl) {
|
||||||
|
|
Loading…
Reference in New Issue