5816ccc192
* Update HOMEPAGE. * Add LICENSE. * Remove default value of GEM_BUILD. * Add patch to support both ruby18 and ruby19.
43 lines
1.8 KiB
Text
43 lines
1.8 KiB
Text
$NetBSD: patch-ad,v 1.1 2010/09/10 12:27:34 taca Exp $
|
|
|
|
Use modern API of Ruby.
|
|
|
|
--- ext/http11/http11.c.orig 2010-08-29 08:20:01.000000000 +0000
|
|
+++ ext/http11/http11.c
|
|
@@ -74,7 +74,7 @@ void http_field(void *data, const char *
|
|
f = rb_str_dup(global_http_prefix);
|
|
f = rb_str_buf_cat(f, field, flen);
|
|
|
|
- for(ch = RSTRING(f)->ptr, end = ch + RSTRING(f)->len; ch < end; ch++) {
|
|
+ for(ch = RSTRING_PTR(f), end = ch + RSTRING_LEN(f); ch < end; ch++) {
|
|
if(*ch == '-') {
|
|
*ch = '_';
|
|
} else {
|
|
@@ -169,12 +169,12 @@ void header_done(void *data, const char
|
|
rb_hash_aset(req, global_gateway_interface, global_gateway_interface_value);
|
|
if((temp = rb_hash_aref(req, global_http_host)) != Qnil) {
|
|
/* ruby better close strings off with a '\0' dammit */
|
|
- colon = strchr(RSTRING(temp)->ptr, ':');
|
|
+ colon = strchr(RSTRING_PTR(temp), ':');
|
|
if(colon != NULL) {
|
|
- rb_hash_aset(req, global_server_name, rb_str_substr(temp, 0, colon - RSTRING(temp)->ptr));
|
|
+ rb_hash_aset(req, global_server_name, rb_str_substr(temp, 0, colon - RSTRING_PTR(temp)));
|
|
rb_hash_aset(req, global_server_port,
|
|
- rb_str_substr(temp, colon - RSTRING(temp)->ptr+1,
|
|
- RSTRING(temp)->len));
|
|
+ rb_str_substr(temp, colon - RSTRING_PTR(temp)+1,
|
|
+ RSTRING_LEN(temp)));
|
|
} else {
|
|
rb_hash_aset(req, global_server_name, temp);
|
|
rb_hash_aset(req, global_server_port, global_port_80);
|
|
@@ -295,8 +295,8 @@ VALUE HttpParser_execute(VALUE self, VAL
|
|
DATA_GET(self, http_parser, http);
|
|
|
|
from = FIX2INT(start);
|
|
- dptr = RSTRING(data)->ptr;
|
|
- dlen = RSTRING(data)->len;
|
|
+ dptr = RSTRING_PTR(data);
|
|
+ dlen = RSTRING_LEN(data);
|
|
|
|
if(from >= dlen) {
|
|
rb_raise(eHttpParserError, "Requested start is after data buffer end.");
|