summaryrefslogtreecommitdiff
path: root/src/apk_io.h
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2014-10-08 11:13:21 +0300
committerTimo Teräs <timo.teras@iki.fi>2014-10-08 11:13:21 +0300
commit32627939f5c57887b25100dd49aa91839876abed (patch)
treec39918143209386d1509c70d56fe8683878f2b30 /src/apk_io.h
parent555363f056377508040d3a555d198c4b87aff3a3 (diff)
downloadapk-tools-32627939f5c57887b25100dd49aa91839876abed.tar.gz
apk-tools-32627939f5c57887b25100dd49aa91839876abed.tar.bz2
apk-tools-32627939f5c57887b25100dd49aa91839876abed.tar.xz
apk-tools-32627939f5c57887b25100dd49aa91839876abed.zip
io,url,db: support for if-modified-since
Diffstat (limited to 'src/apk_io.h')
-rw-r--r--src/apk_io.h25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/apk_io.h b/src/apk_io.h
index c61fc6e..82102aa 100644
--- a/src/apk_io.h
+++ b/src/apk_io.h
@@ -14,6 +14,7 @@
#include <sys/types.h>
#include <openssl/evp.h>
#include <fcntl.h>
+#include <time.h>
#include "apk_defines.h"
#include "apk_blob.h"
@@ -78,7 +79,7 @@ struct apk_ostream *apk_ostream_counter(off_t *);
struct apk_istream *apk_istream_from_fd_pid(int fd, pid_t pid, int (*translate_status)(int));
struct apk_istream *apk_istream_from_file(int atfd, const char *file);
struct apk_istream *apk_istream_from_file_gz(int atfd, const char *file);
-struct apk_istream *apk_istream_from_fd_url(int atfd, const char *url);
+struct apk_istream *apk_istream_from_fd_url_if_modified(int atfd, const char *url, time_t since);
struct apk_istream *apk_istream_from_url_gz(const char *url);
size_t apk_istream_skip(struct apk_istream *istream, size_t size);
@@ -92,13 +93,21 @@ static inline struct apk_istream *apk_istream_from_fd(int fd)
}
static inline struct apk_istream *apk_istream_from_url(const char *url)
{
- return apk_istream_from_fd_url(AT_FDCWD, url);
+ return apk_istream_from_fd_url_if_modified(AT_FDCWD, url, 0);
+}
+static inline struct apk_istream *apk_istream_from_fd_url(int atfd, const char *url)
+{
+ return apk_istream_from_fd_url_if_modified(atfd, url, 0);
+}
+static inline struct apk_istream *apk_istream_from_url_if_modified(const char *url, time_t since)
+{
+ return apk_istream_from_fd_url_if_modified(AT_FDCWD, url, since);
}
struct apk_bstream *apk_bstream_from_istream(struct apk_istream *istream);
struct apk_bstream *apk_bstream_from_fd_pid(int fd, pid_t pid, int (*translate_status)(int));
struct apk_bstream *apk_bstream_from_file(int atfd, const char *file);
-struct apk_bstream *apk_bstream_from_fd_url(int atfd, const char *url);
+struct apk_bstream *apk_bstream_from_fd_url_if_modified(int atfd, const char *url, time_t since);
struct apk_bstream *apk_bstream_tee(struct apk_bstream *from, int atfd, const char *to,
apk_progress_cb cb, void *cb_ctx);
@@ -109,7 +118,15 @@ static inline struct apk_bstream *apk_bstream_from_fd(int fd)
static inline struct apk_bstream *apk_bstream_from_url(const char *url)
{
- return apk_bstream_from_fd_url(AT_FDCWD, url);
+ return apk_bstream_from_fd_url_if_modified(AT_FDCWD, url, 0);
+}
+static inline struct apk_bstream *apk_bstream_from_fd_url(int fd, const char *url)
+{
+ return apk_bstream_from_fd_url_if_modified(fd, url, 0);
+}
+static inline struct apk_bstream *apk_bstream_from_url_if_modified(const char *url, time_t since)
+{
+ return apk_bstream_from_fd_url_if_modified(AT_FDCWD, url, since);
}
struct apk_ostream *apk_ostream_to_fd(int fd);