[mod_python] ConnectionHandler sigsegv (fwd)

Gregory (Grisha) Trubetskoy grisha at modpython.org
Mon Jun 30 09:42:13 EST 2003

On Mon, 30 Jun 2003, Robert Sanderson wrote:

> Read
>   $f->read(my $buffer, $read_len);
> Reads at most $read_len characters into $buffer. It returns a true value
> as long as it had something to read, and a false value otherwise.

This looks like a filter read, mod_python's behaves in the same way. But
filter semantics are different, because filters aren't called unless there
is something to read.

I know that there is the APR_NONBLOCK_READ flag, but it isn't very useful,
since it would mean that your program would have to read in a loop wasting
cpu time until it has what it needs.

The normal way of dealing with this sort of thing is by calling select()
on a socket which will then call your function when there is anything to
read. I don't know whether APR provides this.

I think your only option is to read a byte at a time, making sure that
when you receivie a complete frame/packet/whatever you stop reading so as
to not block indefinitely.


More information about the Mod_python mailing list