|
@@ -194,6 +194,7 @@ PyObject* pyfcgi_ioin_readline(PyObject *self, PyObject **argv, Py_ssize_t argc)
|
194
|
194
|
((IoIn*)self)->eof = 1;
|
195
|
195
|
ret = "";
|
196
|
196
|
}
|
|
197
|
+//dprintf(2, "readline : '%s'\n", ret);
|
197
|
198
|
return IoIn__FromString(self, ret);
|
198
|
199
|
}
|
199
|
200
|
|
|
@@ -269,6 +270,7 @@ PyObject* pyfcgi_ioin_readlines(PyObject *self, PyObject **argv, Py_ssize_t argc
|
269
|
270
|
|
270
|
271
|
if(buff[sz-1] == '\n')
|
271
|
272
|
{
|
|
273
|
+//dprintf(2, "readlines : '%s'\n", PyUnicode_AsUTF8(cur_str));
|
272
|
274
|
if(PyList_Append(res, cur_str))
|
273
|
275
|
{
|
274
|
276
|
Py_DECREF(cur_str);
|
|
@@ -280,6 +282,7 @@ PyObject* pyfcgi_ioin_readlines(PyObject *self, PyObject **argv, Py_ssize_t argc
|
280
|
282
|
}
|
281
|
283
|
if(cur_str)
|
282
|
284
|
{
|
|
285
|
+//dprintf(2, "readlines(post) : '%s'\n", PyUnicode_AsUTF8(cur_str));
|
283
|
286
|
if(PyList_Append(res, cur_str))
|
284
|
287
|
{
|
285
|
288
|
Py_DECREF(cur_str);
|
|
@@ -293,9 +296,9 @@ PyObject* pyfcgi_ioin_readlines(PyObject *self, PyObject **argv, Py_ssize_t argc
|
293
|
296
|
|
294
|
297
|
PyObject* pyfcgi_ioin_read(PyObject *self, PyObject **argv, Py_ssize_t argc)
|
295
|
298
|
{
|
296
|
|
- size_t left, sz, max;
|
|
299
|
+ size_t left, max;
|
297
|
300
|
long l;
|
298
|
|
- int read_n, toread, ret;
|
|
301
|
+ int read_n, toread, sz;
|
299
|
302
|
PyObject *res, *read_str;
|
300
|
303
|
char *buff;
|
301
|
304
|
|
|
@@ -337,11 +340,10 @@ PyObject* pyfcgi_ioin_read(PyObject *self, PyObject **argv, Py_ssize_t argc)
|
337
|
340
|
while((max && left) || !max)
|
338
|
341
|
{
|
339
|
342
|
toread = (max&&((size_t)read_n > left))?(int)left:read_n;
|
340
|
|
- ret = FCGX_GetStr(buff, toread, *((IoIn*)self)->in_stream);
|
341
|
|
-
|
342
|
|
- sz = strlen(buff);
|
|
343
|
+ sz = FCGX_GetStr(buff, toread, *((IoIn*)self)->in_stream);
|
343
|
344
|
if(sz)
|
344
|
345
|
{
|
|
346
|
+ if(sz == toread) { buff[sz] = '\0'; }
|
345
|
347
|
left -= sz;
|
346
|
348
|
if(!(read_str = IoIn__FromBuff(self)))
|
347
|
349
|
{
|
|
@@ -355,7 +357,7 @@ PyObject* pyfcgi_ioin_read(PyObject *self, PyObject **argv, Py_ssize_t argc)
|
355
|
357
|
Py_INCREF(res);
|
356
|
358
|
}
|
357
|
359
|
|
358
|
|
- if( ret < toread)
|
|
360
|
+ if( sz < toread)
|
359
|
361
|
{
|
360
|
362
|
((IoIn*)self)->eof = 1;
|
361
|
363
|
break;
|
|
@@ -375,6 +377,7 @@ PyObject* pyfcgi_ioin_readall(PyObject *self, PyObject **argv, Py_ssize_t argc)
|
375
|
377
|
argc);
|
376
|
378
|
Py_RETURN_NONE;
|
377
|
379
|
}
|
|
380
|
+dprintf(2, "readall calling read : ");
|
378
|
381
|
return pyfcgi_ioin_read(self, NULL, 0);
|
379
|
382
|
}
|
380
|
383
|
|
|
@@ -418,6 +421,8 @@ PyObject* pyfcgi_ioin_readinto(PyObject *self, PyObject **argv, Py_ssize_t argc)
|
418
|
421
|
left -= ret;
|
419
|
422
|
|
420
|
423
|
}
|
|
424
|
+//dprintf(2, "readinto chr buff : '%s'\n", buff);
|
|
425
|
+//dprintf(2, "readinto bytes repr : '%s'\n", PyByteArray_AsString(b));
|
421
|
426
|
return b;
|
422
|
427
|
}
|
423
|
428
|
|