From 0e4276a1ac3b6683619179a180fd76ecd20dc54b Mon Sep 17 00:00:00 2001 From: Nick White Date: Wed, 20 May 2020 14:28:04 +0100 Subject: Fix getabook There were two things that needed to be changed to get getabook to work again: - HTTPS usage - Disabling HTTP compression --- util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'util.c') diff --git a/util.c b/util.c index b7b7693..91cb060 100644 --- a/util.c +++ b/util.c @@ -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); } -- cgit v1.2.3