summaryrefslogtreecommitdiff
path: root/getabook.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 /getabook.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 'getabook.c')
-rw-r--r--getabook.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/getabook.c b/getabook.c
index db4ca96..5f85143 100644
--- a/getabook.c
+++ b/getabook.c
@@ -15,6 +15,7 @@
" -n download pages from numbers in stdin\n" \
" otherwise, all available pages will be downloaded\n"
+#define USESSL 0
#define URLMAX 1024
#define STRMAX 1024
#define MAXPAGES 9999
@@ -74,7 +75,7 @@ int getpagelist()
snprintf(url, URLMAX, "/gp/search-inside/service-data?method=getBookData&asin=%s", bookid);
- if(!get("www.amazon.com", url, NULL, NULL, &buf, 1))
+ if(!get("www.amazon.com", USESSL, url, NULL, NULL, &buf, 1))
return 1;
/* amazon have a canonical asin, which is needed to get all available pages */
@@ -132,7 +133,7 @@ int getpageurls(int pagenum)
strncpy(url, "/gp/search-inside/service-data", URLMAX);
snprintf(query, URLMAX, "method=goToPage&asin=%s&page=%d", bookid, pagenum);
- if(!post("www.amazon.com", url, NULL, NULL, query, &buf, 1))
+ if(!post("www.amazon.com", USESSL, url, NULL, NULL, query, &buf, 1))
return 1;
fillurls(buf);
@@ -158,7 +159,7 @@ int getpage(Page *page)
return 1;
}
- if(gettofile(host, page->url, NULL, NULL, path, 0)) {
+ if(gettofile(host, USESSL, page->url, NULL, NULL, path, 0)) {
fprintf(stderr, "%d failed\n", page->num);
return 1;
}