Commit Graph

68 Commits

Author SHA1 Message Date
d99aae586a lib/download.c: fix digestlen assert and add if condition to avoid misuse 2020-02-10 15:03:54 +01:00
0d90534236 libxbps: ABI/API break due to hash function changes 2020-02-10 13:32:17 +01:00
013177cec3 lib/download.c: fix digest for continued downloads 2020-01-18 16:33:58 +01:00
d2bdd9574e lib/download.c: add xbps_fetch_file{_dest,}_digest 2019-10-25 23:38:01 +02:00
2434b90d6e libxbps: use xbps_strlc{at,py} everywhere. 2016-04-17 20:17:37 +02:00
791e683e01 fetch: handle GET with offset == length.
While xbps_fetch_file() creates the .part file and for whatever reason
it did not finish properly to rename the file, it could request the server
to restart the download with offset set to file size, resulting in HTTP 416
return code.

Handle this case by checking if the server returns 416 and then checking
if the returned file size matches the requested offset and just rename
the file.

Thanks to @beefcurtains for the test case.
2015-06-28 04:28:55 +02:00
87ca42f399 Remove xdelta support: it never worked and wasn't fully implemented. 2014-10-24 11:04:51 +02:00
3a77ab0847 lib/download.c: CID 62691 (dereference NULL check) 2014-10-06 08:23:34 +02:00
2212a05f89 lib/download.c: CID 62696 (dead code) 2014-10-05 12:13:34 +02:00
b67d4ec975 lib/download.c: debug: print url info only if it's available. 2014-09-07 09:45:47 +02:00
fbf4ed4d2a lib/download.c: unconstify to fix a warning. 2014-08-13 22:11:25 +02:00
431674d733 lib/download.c: style twerks. 2014-08-13 21:49:44 +02:00
b0c090c39e lib/download.c: delete vcdiffs after applying; cleanups. 2014-08-11 20:00:20 +02:00
6a8f5d6235 lib/download.c: debug output for binary diffs 2014-08-11 19:24:02 +02:00
f0f8534273 lib/download.c: use tempfile while decoding new file from binary diff.
this prevents corrupted files when filename == basefile.
2014-08-11 19:05:23 +02:00
040e114ad4 lib/download.c: add basic support for vcdiffs 2014-08-11 18:40:44 +02:00
59ee6b6733 Adding xbps_fetch_file_dest().
This function is similiar to xbps_fetch_file(). In contrast to xbps_fetch_file()
xbps_fetch_file_dest has an extra paramenter which allow to define an output file
for the request.
2014-03-04 14:19:52 +01:00
f74bf1c1c8 New custom configuration file format that does not need confuse. 2014-02-25 16:42:52 +01:00
5a7eb2255d Revert "lib/download.c: xbps_fetch_file: remove unnecesary memset() calls."
This reverts commit 74970f2e92.
2013-11-26 10:31:16 +01:00
74970f2e92 lib/download.c: xbps_fetch_file: remove unnecesary memset() calls. 2013-11-18 18:20:41 +01:00
42274f939c Set _BSD_SOURCE before including string.h to get strlc{at,py} with musl. 2013-03-03 08:21:00 +01:00
ae7b76e245 xbps_fetch_file: don't fsync(3) before closing fd; slowdowns considerably slow storage. 2013-02-20 10:46:21 +01:00
bdcdb9f1a0 xbps_fetch_file: don't check for file truncation if server answers with invalid info. 2013-02-01 13:40:27 +01:00
e75fcdd567 xbps_fetch_file: avoid copying from a NULL pointer. 2013-01-15 15:55:18 +01:00
336897d964 xbps_fetch_file: simplify and use libfetch support for If-Modified-Since. 2013-01-13 16:27:59 +01:00
4095290189 xbps_fetch_file: use O_CLOEXEC. 2012-12-15 09:50:37 +01:00
d92c87dbf3 xbps_fetch_file: don't error out if restart and tempfile doesn't exist. 2012-11-19 16:40:27 +01:00
a77727887d Improvements for xbps_fetch_file and xbps_repository_sync_index.
xbps_fetch_file:
	- A temp file is created with .part extension to improve resuming.
	- Files are downloaded in cwd.
	- Switch to futimens(2) and fsync(2).

xbps_repository_sync_index:
	- Do not create local repodir in metadir if it already exists.
	- Simplify the code thanks to new xbps_fetch_file().
2012-11-11 11:29:49 +01:00
d6735d5685 xbps_xasprintf: do not return NULL anymore; remove checks for this. 2012-11-11 09:37:27 +01:00
0ab60b24c5 xbps_fetch_file: enable fetchRestartCalls. 2012-11-08 09:49:03 +01:00
3e9e87fc2a libxbps: require a pointer to xbps_handle in functions that need it.
This removes 2 global vars from lib/initend.c and easier to know
what functions require access to xbps_handle.
2012-06-14 08:22:11 +02:00
0356afba6d Bump copyright year for latest changes. 2012-01-05 16:17:37 +01:00
c83a77c1b5 Fixed issue 19 "xbps-src cannot fetch source with unknown Content-Length". 2012-01-05 12:26:57 +01:00
b0ceeaa58e New configuration file via confuse: xbps.conf. 2011-12-15 11:19:20 +01:00
8be527cbdf xbps_fetch_file: set bytes downloaded correctly for the fetch client cb. 2011-12-01 12:21:13 +01:00
3ccfec7054 Improved callback/states support to make libxbps std{err,out} printf free.
This is a major API/ABI change, documentation has been updated accordingly.
2011-11-24 11:23:08 +01:00
756234e9c3 libxbps: xbps_fetch_error_string: return NULL on libfetch success. 2011-11-11 00:30:01 +01:00
508f119bc9 Moved install transaction code to libxbps, see NEWS file. 2011-07-27 17:13:54 +02:00
5847a11570 xbps_fetch_file: remove local file if bigger than remote and refetch. 2011-06-23 00:06:50 +02:00
fbfa9c5960 New option in conffile to set libfetch's limit (seconds) in timed out connections. 2011-06-22 09:53:44 +02:00
9673c4bd09 XBPS major changes in June 2011.
- A configuration file "xbps-conf.plist" replaces the (un)register target
  in xbps-repo(8) and (un)set-prop in xbps-bin(8). For now, you can set
  the repositories and prefered virtual packages.

- New package pattern matching code from NetBSD. Supports more ways of
  matching patterns in packages.

- Multiple bugs fixed in virtual packages related matching code.

--HG--
rename : LICENSE => COPYING
2011-06-04 13:37:53 +02:00
afe0f3e2f0 Make the xbps_handle struct const internally. 2011-02-21 14:03:08 +01:00
22ae7aa2e8 Introduce struct xbps_handle and use it for xbps_init().
This structure sets up function callbacks for fetching files and
unpacking binary packages, as well as setting the debug boolean.

This way the affected functions (xbps_fetch_file() and
xbps_unpack_binary_pkg()) do not need to accept the fn cb pointers
and data as arguments.

Bump XBPS_RELVER.
2011-02-21 13:38:44 +01:00
35aa4b9951 xbps_fetch_file: memset the stat(2) struct before using it. 2011-01-25 17:49:24 +01:00
008573e1eb Sprinkle a couple of assert(3)ions. 2011-01-25 04:14:33 +01:00
0cc4ba224e Update API documentation for recent changes.
--HG--
branch : progress_callback
2011-01-22 14:24:51 +01:00
984eae1578 Make xbps_fetch_file accept a callback to update its progress.
This also makes xbps_unpack_binary_pkg follow this convention by avoiding
static variables.

--HG--
branch : progress_callback
rename : bin/xbps-repo/util.c => bin/xbps-bin/util.c
2011-01-22 12:40:19 +01:00
992e8c6a14 libxbps::xbps_humanize_number(): use common values and hide implementation details from API.
So now its prototype is the following:

int xbps_humanize_number(char *buf, int64_t bytes)

It is a wrapper around NetBSD's humanize_number(3) which uses 6 digits for max
length, HN_AUTOSCALE and HN_NOSPACE|HN_DECIMAL. All users have been updated.
2011-01-18 23:10:07 +01:00
6051eb29ab Added another bunch of compiler warnings and fix code. 2011-01-15 11:59:44 +01:00
bc28aa77d8 xbps_fetch_file: set a 30seconds timeout. 2010-12-18 10:19:09 +01:00