diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2013-10-11 13:21:01 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2013-11-30 12:38:26 +0100 |
commit | 93a99dac870584ed4ea78f1c2f262db8b5460962 (patch) | |
tree | 2ef0a5ce40127e424855b841bc09a168b5f97d27 /test/interactive-helper/aptwebserver.cc | |
parent | ad5051ef9da4e1f384237ecf1260e0cad95e0ea7 (diff) |
webserver: spurious newline after data confuses curl
Webserver wrongly sends an additional newline after the data which
causes curl to believe that the next request on this socket has no
header data and so includes all headers in the data output.
Git-Dch: Ignore
Diffstat (limited to 'test/interactive-helper/aptwebserver.cc')
-rw-r--r-- | test/interactive-helper/aptwebserver.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 4dae342dd..6c5634de6 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -137,21 +137,21 @@ bool sendFile(int const client, FileFd &data) /*{{{*/ { if (actual == 0) break; - if (Success == true) - Success &= FileFd::Write(client, buffer, actual); + Success &= FileFd::Write(client, buffer, actual); } - if (Success == true) - Success &= FileFd::Write(client, "\r\n", 2); + if (Success == false) + std::cerr << "SENDFILE: READ/WRITE ERROR to " << client << std::endl; return Success; } /*}}}*/ bool sendData(int const client, std::string const &data) /*{{{*/ { - bool Success = true; - Success &= FileFd::Write(client, data.c_str(), data.size()); - if (Success == true) - Success &= FileFd::Write(client, "\r\n", 2); - return Success; + if (FileFd::Write(client, data.c_str(), data.size()) == false) + { + std::cerr << "SENDDATA: WRITE ERROR to " << client << std::endl; + return false; + } + return true; } /*}}}*/ void sendError(int const client, int const httpcode, std::string const &request,/*{{{*/ |