forked from Telodendria/Telodendria
Fix bug in HttpClient where it wouldn't retry on EAGAIN.
This commit is contained in:
parent
20d41d794b
commit
fe32c652cd
1 changed files with 13 additions and 0 deletions
|
@ -29,6 +29,7 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
@ -201,6 +202,18 @@ HttpRequestSend(HttpClientContext * context)
|
||||||
|
|
||||||
lineLen = UtilGetLine(&line, &lineSize, context->stream);
|
lineLen = UtilGetLine(&line, &lineSize, context->stream);
|
||||||
|
|
||||||
|
while (lineLen == -1 && errno == EAGAIN)
|
||||||
|
{
|
||||||
|
StreamClearError(context->stream);
|
||||||
|
lineLen = UtilGetLine(&line, &lineSize, context->stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lineLen == -1)
|
||||||
|
{
|
||||||
|
Log(LOG_ERR, "HttpRequestSend(): %s", strerror(errno));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Line must contain at least "HTTP/x.x xxx" */
|
/* Line must contain at least "HTTP/x.x xxx" */
|
||||||
if (lineLen < 12)
|
if (lineLen < 12)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue