#endif
#include <winpr/crt.h>
+#include <winpr/print.h>
#include <freerdp/utils/memory.h>
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)
{