summaryrefslogtreecommitdiff
path: root/getgbook.c
diff options
context:
space:
mode:
authorNick White <git@njw.name>2015-07-28 16:20:28 +0100
committerNick White <git@njw.name>2015-07-28 16:20:28 +0100
commit93d17e32d2c64a187bda4e4c7b0162072ab77c9c (patch)
treefca76e0fe070609572a676866f887eca76cd59a0 /getgbook.c
parent0e05096f98d957d90a59eff0b5a081d112fd329f (diff)
Add SSL support using OpenSSL, and enable it for getgbook.
This fixes the problem with getgbook not finding any books, and also obviously adds SSL, which is great!
Diffstat (limited to 'getgbook.c')
-rw-r--r--getgbook.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/getgbook.c b/getgbook.c
index e6e15af..5e36c04 100644
--- a/getgbook.c
+++ b/getgbook.c
@@ -16,6 +16,7 @@
" -n download pages from numbers in stdin\n" \
" otherwise, all available pages will be downloaded\n"
+#define USESSL 1
#define URLMAX 1024
#define STRMAX 1024
#define MAXPAGES 9999
@@ -44,7 +45,7 @@ int getpagelist()
snprintf(url, URLMAX, "/books?id=%s&printsec=frontcover&redir_esc=y", bookid);
- if(!get("books.google.com", url, NULL, NULL, &buf, 1))
+ if(!get("books.google.com", USESSL, url, NULL, NULL, &buf, 1))
return 1;
if((s = strstr(buf, "_OC_Run({\"page\":[")) == NULL)
@@ -83,7 +84,7 @@ int getpageurls(char *pagecode, char *cookie)
snprintf(url, URLMAX, "/books?id=%s&pg=%s&jscmd=click3&q=subject:a&redir_esc=y", bookid, pagecode);
- if(!get("books.google.com", url, cookie, NULL, &buf, 1))
+ if(!get("books.google.com", USESSL, url, cookie, NULL, &buf, 1))
return 1;
c = buf;
@@ -137,7 +138,7 @@ int getpage(Page *page)
return 1;
}
- if(gettofile("books.google.com", page->url, page->cookie, NULL, path, 0)) {
+ if(gettofile("books.google.com", USESSL, page->url, page->cookie, NULL, path, 0)) {
fprintf(stderr, "%s failed\n", page->name);
return 1;
}
@@ -188,7 +189,7 @@ int main(int argc, char *argv[])
/* get cookies */
for(i=0;i<COOKIENUM;i++) {
- if(get("books.google.com", "/", NULL, cookies[i], &tmp, 0))
+ if(get("books.google.com", USESSL, "/", NULL, cookies[i], &tmp, 0))
free(tmp);
}