• Home
  • Raw
  • Download

Lines Matching refs:mrb

46 mrb_value request_init(mrb_state *mrb, mrb_value self) { return self; }  in request_init()  argument
50 mrb_value request_get_http_version_major(mrb_state *mrb, mrb_value self) { in request_get_http_version_major() argument
51 auto data = static_cast<MRubyAssocData *>(mrb->ud); in request_get_http_version_major()
59 mrb_value request_get_http_version_minor(mrb_state *mrb, mrb_value self) { in request_get_http_version_minor() argument
60 auto data = static_cast<MRubyAssocData *>(mrb->ud); in request_get_http_version_minor()
68 mrb_value request_get_method(mrb_state *mrb, mrb_value self) { in request_get_method() argument
69 auto data = static_cast<MRubyAssocData *>(mrb->ud); in request_get_method()
74 return mrb_str_new(mrb, method.c_str(), method.size()); in request_get_method()
79 mrb_value request_set_method(mrb_state *mrb, mrb_value self) { in request_set_method() argument
80 auto data = static_cast<MRubyAssocData *>(mrb->ud); in request_set_method()
84 check_phase(mrb, data->phase, PHASE_REQUEST); in request_set_method()
88 mrb_get_args(mrb, "s", &method, &n); in request_set_method()
90 mrb_raise(mrb, E_RUNTIME_ERROR, "method must not be empty string"); in request_set_method()
95 mrb_raise(mrb, E_RUNTIME_ERROR, "method not supported"); in request_set_method()
105 mrb_value request_get_authority(mrb_state *mrb, mrb_value self) { in request_get_authority() argument
106 auto data = static_cast<MRubyAssocData *>(mrb->ud); in request_get_authority()
110 return mrb_str_new(mrb, req.authority.c_str(), req.authority.size()); in request_get_authority()
115 mrb_value request_set_authority(mrb_state *mrb, mrb_value self) { in request_set_authority() argument
116 auto data = static_cast<MRubyAssocData *>(mrb->ud); in request_set_authority()
122 check_phase(mrb, data->phase, PHASE_REQUEST); in request_set_authority()
126 mrb_get_args(mrb, "s", &authority, &n); in request_set_authority()
128 mrb_raise(mrb, E_RUNTIME_ERROR, "authority must not be empty string"); in request_set_authority()
139 mrb_value request_get_scheme(mrb_state *mrb, mrb_value self) { in request_get_scheme() argument
140 auto data = static_cast<MRubyAssocData *>(mrb->ud); in request_get_scheme()
144 return mrb_str_new(mrb, req.scheme.c_str(), req.scheme.size()); in request_get_scheme()
149 mrb_value request_set_scheme(mrb_state *mrb, mrb_value self) { in request_set_scheme() argument
150 auto data = static_cast<MRubyAssocData *>(mrb->ud); in request_set_scheme()
156 check_phase(mrb, data->phase, PHASE_REQUEST); in request_set_scheme()
160 mrb_get_args(mrb, "s", &scheme, &n); in request_set_scheme()
162 mrb_raise(mrb, E_RUNTIME_ERROR, "scheme must not be empty string"); in request_set_scheme()
173 mrb_value request_get_path(mrb_state *mrb, mrb_value self) { in request_get_path() argument
174 auto data = static_cast<MRubyAssocData *>(mrb->ud); in request_get_path()
178 return mrb_str_new(mrb, req.path.c_str(), req.path.size()); in request_get_path()
183 mrb_value request_set_path(mrb_state *mrb, mrb_value self) { in request_set_path() argument
184 auto data = static_cast<MRubyAssocData *>(mrb->ud); in request_set_path()
190 check_phase(mrb, data->phase, PHASE_REQUEST); in request_set_path()
194 mrb_get_args(mrb, "s", &path, &pathlen); in request_set_path()
204 mrb_value request_get_headers(mrb_state *mrb, mrb_value self) { in request_get_headers() argument
205 auto data = static_cast<MRubyAssocData *>(mrb->ud); in request_get_headers()
208 return create_headers_hash(mrb, req.fs.headers()); in request_get_headers()
213 mrb_value request_mod_header(mrb_state *mrb, mrb_value self, bool repl) { in request_mod_header() argument
214 auto data = static_cast<MRubyAssocData *>(mrb->ud); in request_mod_header()
219 check_phase(mrb, data->phase, PHASE_REQUEST); in request_mod_header()
222 mrb_get_args(mrb, "So", &key, &values); in request_mod_header()
225 mrb_raise(mrb, E_RUNTIME_ERROR, "empty key is not allowed"); in request_mod_header()
228 auto ai = mrb_gc_arena_save(mrb); in request_mod_header()
230 key = mrb_funcall(mrb, key, "downcase", 0); in request_mod_header()
236 mrb_gc_arena_restore(mrb, ai); in request_mod_header()
259 auto value = mrb_ary_ref(mrb, values, i); in request_mod_header()
261 mrb_raise(mrb, E_RUNTIME_ERROR, "value must be string"); in request_mod_header()
279 mrb_raise(mrb, E_RUNTIME_ERROR, "value must be string"); in request_mod_header()
287 mrb_value request_set_header(mrb_state *mrb, mrb_value self) { in request_set_header() argument
288 return request_mod_header(mrb, self, true); in request_set_header()
293 mrb_value request_add_header(mrb_state *mrb, mrb_value self) { in request_add_header() argument
294 return request_mod_header(mrb, self, false); in request_add_header()
299 mrb_value request_clear_headers(mrb_state *mrb, mrb_value self) { in request_clear_headers() argument
300 auto data = static_cast<MRubyAssocData *>(mrb->ud); in request_clear_headers()
304 check_phase(mrb, data->phase, PHASE_REQUEST); in request_clear_headers()
313 mrb_value request_push(mrb_state *mrb, mrb_value self) { in request_push() argument
314 auto data = static_cast<MRubyAssocData *>(mrb->ud); in request_push()
320 mrb_get_args(mrb, "s", &uri, &len); in request_push()
328 void init_request_class(mrb_state *mrb, RClass *module) { in init_request_class() argument
330 mrb_define_class_under(mrb, module, "Request", mrb->object_class); in init_request_class()
332 mrb_define_method(mrb, request_class, "initialize", request_init, in init_request_class()
334 mrb_define_method(mrb, request_class, "http_version_major", in init_request_class()
336 mrb_define_method(mrb, request_class, "http_version_minor", in init_request_class()
338 mrb_define_method(mrb, request_class, "method", request_get_method, in init_request_class()
340 mrb_define_method(mrb, request_class, "method=", request_set_method, in init_request_class()
342 mrb_define_method(mrb, request_class, "authority", request_get_authority, in init_request_class()
344 mrb_define_method(mrb, request_class, "authority=", request_set_authority, in init_request_class()
346 mrb_define_method(mrb, request_class, "scheme", request_get_scheme, in init_request_class()
348 mrb_define_method(mrb, request_class, "scheme=", request_set_scheme, in init_request_class()
350 mrb_define_method(mrb, request_class, "path", request_get_path, in init_request_class()
352 mrb_define_method(mrb, request_class, "path=", request_set_path, in init_request_class()
354 mrb_define_method(mrb, request_class, "headers", request_get_headers, in init_request_class()
356 mrb_define_method(mrb, request_class, "add_header", request_add_header, in init_request_class()
358 mrb_define_method(mrb, request_class, "set_header", request_set_header, in init_request_class()
360 mrb_define_method(mrb, request_class, "clear_headers", request_clear_headers, in init_request_class()
362 mrb_define_method(mrb, request_class, "push", request_push, MRB_ARGS_REQ(1)); in init_request_class()