summaryrefslogtreecommitdiff
path: root/libfetch
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2023-04-24 16:53:11 +0300
committerTimo Teräs <timo.teras@iki.fi>2023-05-02 13:21:57 +0300
commit595b3745f1091e9e4b5ffeb256c9ba25b2533221 (patch)
tree428e765e40e855c0adc33afc1162770e37c7add6 /libfetch
parent71ea076197410f7f1043762931b67338055a139e (diff)
downloadapk-tools-595b3745f1091e9e4b5ffeb256c9ba25b2533221.tar.gz
apk-tools-595b3745f1091e9e4b5ffeb256c9ba25b2533221.tar.bz2
apk-tools-595b3745f1091e9e4b5ffeb256c9ba25b2533221.tar.xz
apk-tools-595b3745f1091e9e4b5ffeb256c9ba25b2533221.zip
libfetch, apk: display warning for permanent redirects during init
fixes #10776
Diffstat (limited to 'libfetch')
-rw-r--r--libfetch/fetch.c1
-rw-r--r--libfetch/fetch.h4
-rw-r--r--libfetch/http.c2
3 files changed, 7 insertions, 0 deletions
diff --git a/libfetch/fetch.c b/libfetch/fetch.c
index 68d920c..efee05f 100644
--- a/libfetch/fetch.c
+++ b/libfetch/fetch.c
@@ -39,6 +39,7 @@
#include "fetch.h"
#include "common.h"
+fetch_redirect_t fetchRedirectMethod;
auth_t fetchAuthMethod;
int fetchLastErrCode;
char fetchLastErrString[MAXERRSTRING];
diff --git a/libfetch/fetch.h b/libfetch/fetch.h
index 0c07c05..15c60e9 100644
--- a/libfetch/fetch.h
+++ b/libfetch/fetch.h
@@ -164,6 +164,10 @@ char *fetchUnquoteFilename(struct url *);
void fetchConnectionCacheInit(int, int);
void fetchConnectionCacheClose(void);
+/* Redirects */
+typedef void (*fetch_redirect_t)(int, const struct url *, const struct url *);
+extern fetch_redirect_t fetchRedirectMethod;
+
/* Authentication */
typedef int (*auth_t)(struct url *);
extern auth_t fetchAuthMethod;
diff --git a/libfetch/http.c b/libfetch/http.c
index abc3ae6..2f80240 100644
--- a/libfetch/http.c
+++ b/libfetch/http.c
@@ -1061,6 +1061,8 @@ http_request(struct url *URL, const char *op, struct url_stat *us,
}
new->offset = url->offset;
new->length = url->length;
+ if (fetchRedirectMethod)
+ fetchRedirectMethod(conn->err, url, new);
break;
case hdr_transfer_encoding:
/* XXX weak test*/