Lines Matching refs:mrb
46 mrb_value response_init(mrb_state *mrb, mrb_value self) { return self; } in response_init() argument
50 mrb_value response_get_http_version_major(mrb_state *mrb, mrb_value self) { in response_get_http_version_major() argument
51 auto data = static_cast<MRubyAssocData *>(mrb->ud); in response_get_http_version_major()
59 mrb_value response_get_http_version_minor(mrb_state *mrb, mrb_value self) { in response_get_http_version_minor() argument
60 auto data = static_cast<MRubyAssocData *>(mrb->ud); in response_get_http_version_minor()
68 mrb_value response_get_status(mrb_state *mrb, mrb_value self) { in response_get_status() argument
69 auto data = static_cast<MRubyAssocData *>(mrb->ud); in response_get_status()
77 mrb_value response_set_status(mrb_state *mrb, mrb_value self) { in response_set_status() argument
78 auto data = static_cast<MRubyAssocData *>(mrb->ud); in response_set_status()
83 mrb_get_args(mrb, "i", &status); in response_set_status()
86 mrb_raise(mrb, E_RUNTIME_ERROR, in response_set_status()
97 mrb_value response_get_headers(mrb_state *mrb, mrb_value self) { in response_get_headers() argument
98 auto data = static_cast<MRubyAssocData *>(mrb->ud); in response_get_headers()
102 return create_headers_hash(mrb, resp.fs.headers()); in response_get_headers()
107 mrb_value response_mod_header(mrb_state *mrb, mrb_value self, bool repl) { in response_mod_header() argument
108 auto data = static_cast<MRubyAssocData *>(mrb->ud); in response_mod_header()
114 mrb_get_args(mrb, "So", &key, &values); in response_mod_header()
117 mrb_raise(mrb, E_RUNTIME_ERROR, "empty key is not allowed"); in response_mod_header()
120 auto ai = mrb_gc_arena_save(mrb); in response_mod_header()
122 key = mrb_funcall(mrb, key, "downcase", 0); in response_mod_header()
128 mrb_gc_arena_restore(mrb, ai); in response_mod_header()
151 auto value = mrb_ary_ref(mrb, values, i); in response_mod_header()
153 mrb_raise(mrb, E_RUNTIME_ERROR, "value must be string"); in response_mod_header()
171 mrb_raise(mrb, E_RUNTIME_ERROR, "value must be string"); in response_mod_header()
179 mrb_value response_set_header(mrb_state *mrb, mrb_value self) { in response_set_header() argument
180 return response_mod_header(mrb, self, true); in response_set_header()
185 mrb_value response_add_header(mrb_state *mrb, mrb_value self) { in response_add_header() argument
186 return response_mod_header(mrb, self, false); in response_add_header()
191 mrb_value response_clear_headers(mrb_state *mrb, mrb_value self) { in response_clear_headers() argument
192 auto data = static_cast<MRubyAssocData *>(mrb->ud); in response_clear_headers()
203 mrb_value response_return(mrb_state *mrb, mrb_value self) { in response_return() argument
204 auto data = static_cast<MRubyAssocData *>(mrb->ud); in response_return()
213 mrb_raise(mrb, E_RUNTIME_ERROR, "response has already been committed"); in response_return()
218 mrb_get_args(mrb, "|s", &val, &vallen); in response_return()
268 mrb_raise(mrb, E_RUNTIME_ERROR, "could not send response"); in response_return()
280 mrb_value response_send_info(mrb_state *mrb, mrb_value self) { in response_send_info() argument
281 auto data = static_cast<MRubyAssocData *>(mrb->ud); in response_send_info()
287 mrb_raise(mrb, E_RUNTIME_ERROR, "response has already been committed"); in response_send_info()
292 mrb_get_args(mrb, "iH", &http_status, &hash); in response_send_info()
295 mrb_raise(mrb, E_RUNTIME_ERROR, in response_send_info()
301 auto keys = mrb_hash_keys(mrb, hash); in response_send_info()
305 auto key = mrb_ary_ref(mrb, keys, i); in response_send_info()
307 mrb_raise(mrb, E_RUNTIME_ERROR, "key must be string"); in response_send_info()
310 auto values = mrb_hash_get(mrb, hash, key); in response_send_info()
312 auto ai = mrb_gc_arena_save(mrb); in response_send_info()
314 key = mrb_funcall(mrb, key, "downcase", 0); in response_send_info()
320 mrb_gc_arena_restore(mrb, ai); in response_send_info()
327 auto value = mrb_ary_ref(mrb, values, i); in response_send_info()
329 mrb_raise(mrb, E_RUNTIME_ERROR, "value must be string"); in response_send_info()
347 mrb_raise(mrb, E_RUNTIME_ERROR, "value must be string"); in response_send_info()
357 mrb_raise(mrb, E_RUNTIME_ERROR, "could not send non-final response"); in response_send_info()
368 void init_response_class(mrb_state *mrb, RClass *module) { in init_response_class() argument
370 mrb_define_class_under(mrb, module, "Response", mrb->object_class); in init_response_class()
372 mrb_define_method(mrb, response_class, "initialize", response_init, in init_response_class()
374 mrb_define_method(mrb, response_class, "http_version_major", in init_response_class()
376 mrb_define_method(mrb, response_class, "http_version_minor", in init_response_class()
378 mrb_define_method(mrb, response_class, "status", response_get_status, in init_response_class()
380 mrb_define_method(mrb, response_class, "status=", response_set_status, in init_response_class()
382 mrb_define_method(mrb, response_class, "headers", response_get_headers, in init_response_class()
384 mrb_define_method(mrb, response_class, "add_header", response_add_header, in init_response_class()
386 mrb_define_method(mrb, response_class, "set_header", response_set_header, in init_response_class()
388 mrb_define_method(mrb, response_class, "clear_headers", in init_response_class()
390 mrb_define_method(mrb, response_class, "return", response_return, in init_response_class()
392 mrb_define_method(mrb, response_class, "send_info", response_send_info, in init_response_class()