Patch for Ruby 1.9 compatibility, backport from upstream SVN. --- ext/fcgi/fcgi.c 2006-06-25 06:06:42.000000000 +0200 +++ ext/fcgi/fcgi.c.r47 2008-12-02 10:37:47.000000000 +0100 @@ -17,6 +17,16 @@ #include "fcgiapp.h" #endif +#ifndef RARRAY_PTR +#define RARRAY_LEN(ary) (RARRAY(ary)->len) +#define RARRAY_PTR(ary) (RARRAY(ary)->ptr) +#endif + +#ifndef RSTRING_PTR +#define RSTRING_LEN(str) (RSTRING(str)->len) +#define RSTRING_PTR(str) (RSTRING(str)->ptr) +#endif + static VALUE cFCGI; static VALUE eFCGIError; static VALUE cFCGIStream; @@ -222,7 +232,7 @@ rb_secure(4); Data_Get_Struct(self, FCGX_Stream, stream); str = rb_obj_as_string(str); - len = FCGX_PutStr(RSTRING(str)->ptr, RSTRING(str)->len, stream); + len = FCGX_PutStr(RSTRING_PTR(str), RSTRING_LEN(str), stream); if (len == EOF) CHECK_STREAM_ERROR(stream); return INT2NUM(len); } @@ -271,8 +281,8 @@ VALUE tmp; int i; - for (i=0; ilen; i++) { - tmp = RARRAY(ary)->ptr[i]; + for (i=0; iptr[RSTRING(line)->len-1] != '\n') { + if (RSTRING_PTR(line)[RSTRING_LEN(line)-1] != '\n') { fcgi_stream_write(out, rb_default_rs); } } @@ -379,7 +389,7 @@ rb_str_cat(str, buff, strlen(buff)); if (strchr(buff, '\n')) break; } - if (RSTRING(str)->len > 0) + if (RSTRING_LEN(str) > 0) return str; else return Qnil; @@ -507,7 +517,8 @@ -void Init_fcgi() { +void Init_fcgi() +{ FCGX_Init(); @@ -517,7 +528,7 @@ rb_define_singleton_method(cFCGI, "each", fcgi_s_each, 0); rb_define_singleton_method(cFCGI, "each_request", fcgi_s_each, 0); rb_define_singleton_method(cFCGI, "is_cgi?", fcgi_s_iscgi, 0); - rb_define_method(cFCGI, "in", fcgi_in, 0); + rb_define_method(cFCGI, "in", fcgi_in, 0); rb_define_method(cFCGI, "out", fcgi_out, 0); rb_define_method(cFCGI, "err", fcgi_err, 0); rb_define_method(cFCGI, "env", fcgi_env, 0);