• Timothy B. Terriberry's avatar
    Some http robustness improvements. · f83266d9
    Timothy B. Terriberry authored
    - Increase the maximum response header buffer size up to ~32 kB.
      This also moves it into a heap-allocated buffer instead of the
       stack, as 32 kB is really too much for the stack.
    - Treat LF as CR LF when parsing headers.
      This is necessary when parsing the load-balancer response in
       front of <http://lazaradio.hu:8100/bermuda.opus>.
      The response returned by that server is invalid in lots of ways,
       but with these two changes we can read it.
    - In addition, we now peek ahead at a large chunk of data when
       reading the response instead of reading 2 to 4 bytes at a time.
      This allows a typical response to be read with two syscalls
       (one peek, one read) instead of several hundred.
    - Stop trying to read more data when the connection is closed.