Commit a1e00d40 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

adaptive: do not reinvent net_Gets()

parent f9c35694
...@@ -144,22 +144,14 @@ bool IHTTPConnection::parseReply() ...@@ -144,22 +144,14 @@ bool IHTTPConnection::parseReply()
std::string IHTTPConnection::readLine() std::string IHTTPConnection::readLine()
{ {
std::stringstream ss; std::stringstream ss;
char c[1];
ssize_t size = net_Read(stream, httpSocket, NULL, c, 1, false);
while(size >= 0) char *line = ::net_Gets(stream, httpSocket, NULL);
{ if(line == NULL)
ss << c[0]; return "";
if(c[0] == '\n')
break;
size = net_Read(stream, httpSocket, NULL, c, 1, false);
}
if(size > 0)
return ss.str();
return ""; ss << line << "\r\n";
::free(line);
return ss.str();
} }
std::string IHTTPConnection::buildRequestHeader(const std::string &path) const std::string IHTTPConnection::buildRequestHeader(const std::string &path) const
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment