aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/inputStream_http.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/inputStream_http.c b/src/inputStream_http.c
index 7be2bc38c..5c99a8ec0 100644
--- a/src/inputStream_http.c
+++ b/src/inputStream_http.c
@@ -220,7 +220,7 @@ static int finishHTTPInit(InputStream * inStream) {
return -1;
}
- memset(request, 0, 2048);
+ memset(request, 0, 2049);
snprintf(request, 2048, "GET %s HTTP/1.1\r\n"
"Host: %s\r\n"
"Connection: close\r\n"
@@ -266,6 +266,7 @@ static int getHTTPHello(InputStream * inStream) {
if(ret < 0) {
data->connState = HTTP_CONN_STATE_CLOSED;
close(data->sock);
+ data->buflen = 0;
return -1;
}
@@ -283,6 +284,7 @@ static int getHTTPHello(InputStream * inStream) {
if(readed <= 0) {
data->connState = HTTP_CONN_STATE_CLOSED;
close(data->sock);
+ data->buflen = 0;
return -1;
}
@@ -475,7 +477,7 @@ size_t inputStream_httpRead(InputStream * inStream, void * ptr, size_t size,
data->buflen -= readed;
memmove(data->buffer, data->buffer+readed, data->buflen);
- inStream->offset = readed;
+ inStream->offset+= readed;
return readed;
}