okws/okws — pull request #18 by Sidnicious (2014-02-19 20:48:52+00:00)
Title: okd: Don't use peek to route requests since, on Linux, it may not expose all available data

okd used the MSG_PEEK flag to look at the data available on a socket
without consuming it. If it wasn't enough (i.e. the whole URL hadn't
come through yet) it waited and peeked again later.

On FreeBSD, this works properly with both IP (AF_INET) and local
(AF_UNIX) sockets. On Linux, it will only ever return the first unread
message sent to a local socket. When an SSL connection is proxied
through okssld, okd's peeking at a local socket and the difference
becomes a problem: it might only ever get part of a request line.

There's an open bug against the Linux kernel to make it act like FreeBSD
in this case, but POSIX doesn't require it.

https://bugzilla.kernel.org/show_bug.cgi?id=12323

This change makes okd read normally from the socket and use the `scraps`
field to pass the read data to the websrv.