diff options
author | Nick White <hg@njw.me.uk> | 2011-08-03 00:42:48 +0100 |
---|---|---|
committer | Nick White <hg@njw.me.uk> | 2011-08-03 00:42:48 +0100 |
commit | db6e6ae080819018bd17760e846fca4e85688cee (patch) | |
tree | 7563bdc2b8cfc647187554092638cdbbda76c40b /util.c | |
parent | bbce84ba6c4b7a208bf872e553abc98ed2ecfa20 (diff) |
Be more careful to fail gracefully if server replies wierdly
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -53,7 +53,7 @@ int get(char *host, char *path, char *sendcookie, char *savecookie, char **buf) fflush(srv); while(h[0] != '\r') { - fgets(h, HEADERMAX, srv); + if(!fgets(h, HEADERMAX, srv)) return 0; if(sscanf(h, "HTTP/%d.%d %d", &i, &i, &p) == 3 && p != 200) return 0; if(savecookie != NULL && sscanf(h, "Set-Cookie: %s;", c)) |