]> git.tuebingen.mpg.de Git - paraslash.git/commit
fd: Improve read_pattern(), rename it to read_and_compare().
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 25 Sep 2022 20:01:25 +0000 (22:01 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 7 May 2023 18:45:22 +0000 (20:45 +0200)
commitd1b7b2dbccd20ef72c54b7e06117ef1f92500c04
tree3de82e0868657efb67d9d0674bf2b996bf6edc8d
parent9190cb37a393b6f245a2bc17f9aeb9eb02a8e629
fd: Improve read_pattern(), rename it to read_and_compare().

The old name was a poor choice because the pattern argument actually
is neither a regular expression nor a filename pattern.

More importantly, the function receives a buffer size and tries
to read this many bytes but then compares only the first part of
the received buffer to the expected string. This is a rather weird
calling convention.

The only two callers are the http sender and receiver which both
call the function during the initial handshake where no other data is
available. Thus we can change the function to read only the minimal
amount of data (length of the expected string), and drop the bufsize
parameter.

Remove the unnecessary log message in the error case and streamline
the documentation while at it.
fd.c
fd.h
http_recv.c
http_send.c