Permalink
Browse files

Fixed to crash

  • Loading branch information...
1 parent 57311df commit c4c2d12814f3e26610bd736ca132df2caa9f36e3 @masuidrive masuidrive committed Mar 30, 2013
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/mrb_http.c
View
@@ -320,15 +320,17 @@ mrb_http_parser_parse_url(mrb_state *mrb, mrb_value self)
mrb_value c;
mrb_value arg_data;
struct http_parser_url handle = {0};
- struct RClass* _class_http_url;
+ struct RClass* _class_http, *_class_http_url;
mrb_get_args(mrb, "S", &arg_data);
if (http_parser_parse_url(RSTRING_PTR(arg_data), RSTRING_LEN(arg_data), FALSE, &handle)) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "invalid URL");
}
- _class_http_url = mrb_class_get(mrb, "HTTP");
+ _class_http = mrb_class_get(mrb, "HTTP");
+ _class_http_url = mrb_class_ptr(mrb_const_get(mrb, mrb_obj_value(_class_http), mrb_intern(mrb, "URL")));
+
c = mrb_class_new_instance(mrb, 0, NULL, _class_http_url);
if (handle.field_set & (1<<UF_SCHEMA)) {

0 comments on commit c4c2d12

Please sign in to comment.