diff options
author | Nick White <git@njw.name> | 2020-05-20 14:28:04 +0100 |
---|---|---|
committer | Nick White <git@njw.name> | 2020-05-20 14:28:04 +0100 |
commit | 0e4276a1ac3b6683619179a180fd76ecd20dc54b (patch) | |
tree | 51606575f2602ec926e94ece07aaf918cdcdcb66 /util.c | |
parent | f2265c79b7d7460ec91ebf79a891bbe5c689e7c6 (diff) |
Fix getabook
There were two things that needed to be changed to get getabook to work again:
- HTTPS usage
- Disabling HTTP compression
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -146,8 +146,7 @@ int request(char *host, int ssl, char *request, char *savecookie, char **body, i cur = pos + 2; if(sscanf(headline, "HTTP/%d.%d %d", &i, &i, &p) == 3 && p != 200) { - if(p == 403) - fprintf(stderr, "403 forbidden: your IP address may be temporarily blocked\n"); + fprintf(stderr, "HTTP code %d; your IP address may be temporarily blocked\n", p); free(buf); free(*body); return 0; @@ -178,7 +177,8 @@ int get(char *host, int ssl, char *path, char *sendcookie, char *savecookie, cha if(sendcookie && sendcookie[0]) snprintf(c, COOKIEMAX, "\r\nCookie: %s", sendcookie); snprintf(h, BUFSIZ, "GET %s HTTP/1.0\r\nUser-Agent: getxbook-"VERSION \ - " (not mozilla)\r\nHost: %s%s\r\n\r\n", path, host, c); + " (not mozilla)\r\nAccept-Encoding: gzip;q=0,deflate;q=0\r\n" \ + "Host: %s%s\r\n\r\n", path, host, c); return request(host, ssl, h, savecookie, body, istext); } |