libfreerdp-core: workaround for fragmentation in HTTP header

This commit is contained in:
Marc-André Moreau 2012-11-13 18:57:46 -05:00
parent a55b1ffce1
commit 209bdd85b4

View File

@ -22,6 +22,7 @@
#endif
#include <winpr/crt.h>
#include <winpr/print.h>
#include <freerdp/utils/memory.h>
@ -405,28 +406,39 @@ HttpResponse* http_response_recv(rdpTls* tls)
while (TRUE)
{
status = tls_read(tls, p, length - nbytes);
if (status > 0)
{
nbytes += status;
p = (BYTE*) &buffer[nbytes];
}
else if (status == 0)
{
continue;
}
else
{
http_response_free(http_response);
return NULL;
break;
}
while (nbytes < 5)
{
status = tls_read(tls, p, length - nbytes);
if (status > 0)
{
nbytes += status;
p = (BYTE*) &buffer[nbytes];
}
else if (status == 0)
{
continue;
}
else
{
http_response_free(http_response);
return NULL;
}
}
header_end = strstr((char*) buffer, "\r\n\r\n");
if (header_end)
{
header_end += 2;
}
else
{
printf("http_response_recv: invalid response:\n");
winpr_HexDump(buffer, status);
http_response_free(http_response);
return NULL;
}
if (header_end != NULL)
{