eventmachine-eventmachine_httpserver 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/eventmachine_httpserver.gemspec +1 -1
- data/ext/rubyhttp.cpp +17 -19
- metadata +1 -1
    
        data/ext/rubyhttp.cpp
    CHANGED
    
    | @@ -170,7 +170,7 @@ void RubyHttpConnection_t::ProcessRequest (const char *request_method, | |
| 170 170 | 
             
            Statics
         | 
| 171 171 | 
             
            *******/
         | 
| 172 172 |  | 
| 173 | 
            -
             | 
| 173 | 
            +
            VALUE Intern_http_conn;
         | 
| 174 174 |  | 
| 175 175 | 
             
            /***********
         | 
| 176 176 | 
             
            t_post_init
         | 
| @@ -182,7 +182,7 @@ static VALUE t_post_init (VALUE self) | |
| 182 182 | 
             
            	if (!hc)
         | 
| 183 183 | 
             
            		throw std::runtime_error ("no http-connection object");
         | 
| 184 184 |  | 
| 185 | 
            -
            	rb_ivar_set (self,  | 
| 185 | 
            +
            	rb_ivar_set (self, Intern_http_conn, LONG2NUM ((long)hc));
         | 
| 186 186 | 
             
            	return Qnil;
         | 
| 187 187 | 
             
            }
         | 
| 188 188 |  | 
| @@ -194,7 +194,7 @@ t_receive_data | |
| 194 194 | 
             
            static VALUE t_receive_data (VALUE self, VALUE data)
         | 
| 195 195 | 
             
            {
         | 
| 196 196 | 
             
            	int length = NUM2INT (rb_funcall (data, rb_intern ("length"), 0));
         | 
| 197 | 
            -
            	RubyHttpConnection_t *hc = (RubyHttpConnection_t*)( | 
| 197 | 
            +
            	RubyHttpConnection_t *hc = (RubyHttpConnection_t*)(NUM2LONG (rb_ivar_get (self, Intern_http_conn)));
         | 
| 198 198 | 
             
            	if (hc)
         | 
| 199 199 | 
             
            		hc->ConsumeData (StringValuePtr (data), length);
         | 
| 200 200 | 
             
            	return Qnil;
         | 
| @@ -216,7 +216,7 @@ t_unbind | |
| 216 216 |  | 
| 217 217 | 
             
            static VALUE t_unbind (VALUE self)
         | 
| 218 218 | 
             
            {
         | 
| 219 | 
            -
            	RubyHttpConnection_t *hc = (RubyHttpConnection_t*)( | 
| 219 | 
            +
            	RubyHttpConnection_t *hc = (RubyHttpConnection_t*)(NUM2LONG (rb_ivar_get (self, Intern_http_conn)));
         | 
| 220 220 | 
             
            	if (hc)
         | 
| 221 221 | 
             
            		delete hc;
         | 
| 222 222 | 
             
            	return Qnil;
         | 
| @@ -240,7 +240,7 @@ t_no_environment_strings | |
| 240 240 |  | 
| 241 241 | 
             
            static VALUE t_no_environment_strings (VALUE self)
         | 
| 242 242 | 
             
            {
         | 
| 243 | 
            -
            	RubyHttpConnection_t *hc = (RubyHttpConnection_t*)( | 
| 243 | 
            +
            	RubyHttpConnection_t *hc = (RubyHttpConnection_t*)(NUM2LONG (rb_ivar_get (self, Intern_http_conn)));
         | 
| 244 244 | 
             
            	if (hc)
         | 
| 245 245 | 
             
            		hc->SetNoEnvironmentStrings();
         | 
| 246 246 | 
             
            	return Qnil;
         | 
| @@ -252,7 +252,7 @@ t_dont_accumulate_post | |
| 252 252 |  | 
| 253 253 | 
             
            static VALUE t_dont_accumulate_post (VALUE self)
         | 
| 254 254 | 
             
            {
         | 
| 255 | 
            -
            	RubyHttpConnection_t *hc = (RubyHttpConnection_t*)( | 
| 255 | 
            +
            	RubyHttpConnection_t *hc = (RubyHttpConnection_t*)(NUM2LONG (rb_ivar_get (self, Intern_http_conn)));
         | 
| 256 256 | 
             
            	if (hc)
         | 
| 257 257 | 
             
            		hc->SetDontAccumulatePost();
         | 
| 258 258 | 
             
            	return Qnil;
         | 
| @@ -265,17 +265,15 @@ Init_eventmachine_httpserver | |
| 265 265 |  | 
| 266 266 | 
             
            extern "C" void Init_eventmachine_httpserver()
         | 
| 267 267 | 
             
            {
         | 
| 268 | 
            -
            	 | 
| 269 | 
            -
             | 
| 270 | 
            -
            	VALUE  | 
| 271 | 
            -
            	VALUE  | 
| 272 | 
            -
            	rb_define_method ( | 
| 273 | 
            -
            	rb_define_method ( | 
| 274 | 
            -
            	rb_define_method ( | 
| 275 | 
            -
            	rb_define_method ( | 
| 276 | 
            -
            	rb_define_method ( | 
| 277 | 
            -
            	rb_define_method ( | 
| 278 | 
            -
            	rb_define_method ( | 
| 268 | 
            +
            	Intern_http_conn = rb_intern ("http_conn");
         | 
| 269 | 
            +
             | 
| 270 | 
            +
            	VALUE EmModule = rb_define_module ("EventMachine");
         | 
| 271 | 
            +
            	VALUE HttpServer = rb_define_module_under (EmModule, "HttpServer");
         | 
| 272 | 
            +
            	rb_define_method (HttpServer, "post_init", (VALUE(*)(...))t_post_init, 0);
         | 
| 273 | 
            +
            	rb_define_method (HttpServer, "receive_data", (VALUE(*)(...))t_receive_data, 1);
         | 
| 274 | 
            +
            	rb_define_method (HttpServer, "receive_post_data", (VALUE(*)(...))t_receive_post_data, 1);
         | 
| 275 | 
            +
            	rb_define_method (HttpServer, "unbind", (VALUE(*)(...))t_unbind, 0);
         | 
| 276 | 
            +
            	rb_define_method (HttpServer, "process_http_request", (VALUE(*)(...))t_process_http_request, 0);
         | 
| 277 | 
            +
            	rb_define_method (HttpServer, "no_environment_strings", (VALUE(*)(...))t_no_environment_strings, 0);
         | 
| 278 | 
            +
            	rb_define_method (HttpServer, "dont_accumulate_post", (VALUE(*)(...))t_dont_accumulate_post, 0);
         | 
| 279 279 | 
             
            }
         | 
| 280 | 
            -
             | 
| 281 | 
            -
             |