tatsuhiro-t/spdylay — pull request #91 by chobits (2013-11-06 07:09:49+00:00)
Title: spdycat: cannot read post data from /dev/stdin

Reproduce:
$ echo hello | spdycat -2 -v -d - https://localhost:443/test_post
...
[ 0.006] send RST_STREAM frame
(stream_id=1, status_code=6)
...

Error occurs when spdycat reads post data from /dev/stdin, in which case
spdycat will send RST_STREAM(status_code=6(internal error)) to server.

Reason:
In spdycat.cc, file_read_callback() use pread() to read post data.
If post data file is /dev/stdin (pipe, socket or FIFO), pread() will
returns -1 and set errno to ESPIPE.
pread() is based on lseek(), but lseek() cannot works with pipe,
socket or FIFO file.