Merge branch 'master' of github.com:awakecoding/FreeRDP

This commit is contained in:
Marc-André Moreau 2012-11-14 09:01:47 -05:00
commit d0c66ce767
2 changed files with 33 additions and 18 deletions

View File

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

View File

@ -85,7 +85,7 @@ BOOL rts_connect(rdpRpc* rpc)
if (http_response->StatusCode != 200) if (http_response->StatusCode != 200)
{ {
printf("rts_connect error!\n"); printf("rts_connect error! Status Code: %d\n", http_response->StatusCode);
http_response_print(http_response); http_response_print(http_response);
http_response_free(http_response) ; http_response_free(http_response) ;
return FALSE; return FALSE;