|
Lines 17-22
Link Here
|
| 17 |
#include "fcgiapp.h" |
17 |
#include "fcgiapp.h" |
| 18 |
#endif |
18 |
#endif |
| 19 |
|
19 |
|
|
|
20 |
#ifdef RUBY_18 |
| 21 |
#define RSTRING_LEN(x) ((x)->len) |
| 22 |
#define RSTRING_PTR(x) ((x)->ptr) |
| 23 |
#define RARRAY_LEN(x) ((x)->len) |
| 24 |
#define RARRAY_PTR(x) ((x)->ptr) |
| 25 |
#endif |
| 26 |
|
| 20 |
static VALUE cFCGI; |
27 |
static VALUE cFCGI; |
| 21 |
static VALUE eFCGIError; |
28 |
static VALUE eFCGIError; |
| 22 |
static VALUE cFCGIStream; |
29 |
static VALUE cFCGIStream; |
|
Lines 222-228
Link Here
|
| 222 |
rb_secure(4); |
229 |
rb_secure(4); |
| 223 |
Data_Get_Struct(self, FCGX_Stream, stream); |
230 |
Data_Get_Struct(self, FCGX_Stream, stream); |
| 224 |
str = rb_obj_as_string(str); |
231 |
str = rb_obj_as_string(str); |
| 225 |
len = FCGX_PutStr(RSTRING(str)->ptr, RSTRING(str)->len, stream); |
232 |
len = FCGX_PutStr(RSTRING_PTR(str), RSTRING_LEN(str), stream); |
| 226 |
if (len == EOF) CHECK_STREAM_ERROR(stream); |
233 |
if (len == EOF) CHECK_STREAM_ERROR(stream); |
| 227 |
return INT2NUM(len); |
234 |
return INT2NUM(len); |
| 228 |
} |
235 |
} |
|
Lines 271-278
Link Here
|
| 271 |
VALUE tmp; |
278 |
VALUE tmp; |
| 272 |
int i; |
279 |
int i; |
| 273 |
|
280 |
|
| 274 |
for (i=0; i<RARRAY(ary)->len; i++) { |
281 |
for (i=0; i<RARRAY_LEN(ary); i++) { |
| 275 |
tmp = RARRAY(ary)->ptr[i]; |
282 |
tmp = RARRAY_PTR(ary)[i]; |
| 276 |
if (rb_inspecting_p(tmp)) { |
283 |
if (rb_inspecting_p(tmp)) { |
| 277 |
tmp = rb_str_new2("[...]"); |
284 |
tmp = rb_str_new2("[...]"); |
| 278 |
} |
285 |
} |
|
Lines 305-311
Link Here
|
| 305 |
} |
312 |
} |
| 306 |
line = rb_obj_as_string(line); |
313 |
line = rb_obj_as_string(line); |
| 307 |
fcgi_stream_write(out, line); |
314 |
fcgi_stream_write(out, line); |
| 308 |
if (RSTRING(line)->ptr[RSTRING(line)->len-1] != '\n') { |
315 |
if (RSTRING_PTR(line)[RSTRING_LEN(line)-1] != '\n') { |
| 309 |
fcgi_stream_write(out, rb_default_rs); |
316 |
fcgi_stream_write(out, rb_default_rs); |
| 310 |
} |
317 |
} |
| 311 |
} |
318 |
} |
|
Lines 379-385
Link Here
|
| 379 |
rb_str_cat(str, buff, strlen(buff)); |
386 |
rb_str_cat(str, buff, strlen(buff)); |
| 380 |
if (strchr(buff, '\n')) break; |
387 |
if (strchr(buff, '\n')) break; |
| 381 |
} |
388 |
} |
| 382 |
if (RSTRING(str)->len > 0) |
389 |
if (RSTRING_LEN(str) > 0) |
| 383 |
return str; |
390 |
return str; |
| 384 |
else |
391 |
else |
| 385 |
return Qnil; |
392 |
return Qnil; |