diff options
| author | Nick White <git@njw.me.uk> | 2011-11-30 18:50:24 +0000 | 
|---|---|---|
| committer | Nick White <git@njw.me.uk> | 2011-11-30 18:50:24 +0000 | 
| commit | 83adb758f73ebc6a6c09b7dee82e139317b7ad0a (patch) | |
| tree | 8e5f0f95bc9df3ccc46d985991975bb68d1a72b5 | |
| parent | 3754eaa4326fad5daff9ea14d2dba518adaca2eb (diff) | |
Make http implementation more robust
| -rw-r--r-- | TODO | 2 | ||||
| -rw-r--r-- | util.c | 2 | 
2 files changed, 1 insertions, 3 deletions
@@ -6,8 +6,6 @@ use the correct file extension depending on the image type (for google and amazo  bug in get() & post(): if the \r\n\r\n after http headers is cut off between recv buffers -what happens if we receive not a http header? does recv loop forever, in a memory killing manner? -  package for osx - https://github.com/kennethreitz/osx-gcc-installer  add djvu convert script @@ -92,7 +92,7 @@ int get(char *host, char *path, char *sendcookie, char *savecookie, char **buf)  	}  	*buf = realloc(*buf, sizeof(char *) * (l+BUFSIZ)); -	for(; (res = recv(fd, *buf+l, BUFSIZ, 0)) > 0; l+=res) +	for(; buf != NULL && (res = recv(fd, *buf+l, BUFSIZ, 0)) > 0; l+=res)  		*buf = realloc(*buf, sizeof(char *) * (l+BUFSIZ));  	return l;  | 
