summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-metalink.c
Commit message (Collapse)AuthorAgeFilesLines
* Update FSF license notices to use URL instead of addressJoseph Marrero2021-12-071-3/+1
|
* libostree: Add support for ETag and Last-Modified headersPhilip Withnall2020-10-221-1/+4
| | | | | | | | | | | | | | Add support in the soup and curl fetchers to send the `If-None-Match` and `If-Modified-Since` request headers, and pass on the `ETag` and `Last-Modified` response headers. This currently introduces no functional changes, but once call sites provide the appropriate integration, this will allow HTTP caching to happen with requests (typically with metadata requests, where the data is not immutable due to being content-addressed). That should reduce bandwidth requirements. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
* lib/repo-pull: Support retrying requests on transient network errorsPhilip Withnall2018-05-301-2/+8
| | | | | | | | | | | | | | | | | | | | Allow network requests to be re-queued if they failed with a transient error, such as a socket timeout. Retry each request up to a limit (default: 5), and only then fail the entire pull and propagate the error to the caller. Add a new ostree_repo_pull_with_options() option, n-network-retries, to control the number of retries (including setting it back to the old default of 0, if the caller wants). Currently, retries are not supported for FetchDeltaSuperData requests, as they are not queued. Once they are queued, adding support for retries should be trivial. A FIXME comment has been left for this. Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #1594 Approved by: jlebon
* Add SPDX-License-Identifier to source filesMarcus Folkesson2018-01-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | SPDX License List is a list of (common) open source licenses that can be referred to by a “short identifier”. It has several advantages compared to the common "license header texts" usually found in source files. Some of the advantages: * It is precise; there is no ambiguity due to variations in license header text * It is language neutral * It is easy to machine process * It is concise * It is simple and can be used without much cost in interpreted environments like java Script, etc. * An SPDX license identifier is immutable. * It provides simple guidance for developers who want to make sure the license for their code is respected See http://spdx.org for further reading. Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com> Closes: #1439 Approved by: cgwalters
* tree-wide: Remove Emacs modelinesColin Walters2017-09-211-2/+1
| | | | | | | | | We added a `.dir-locals.el` in commit: 9a77017d87b74c5e2895cdd64ad098018929403f There's no need to have it per-file, with that people might think to add other editors, which is the wrong direction. Closes: #1206 Approved by: jlebon
* lib/pull: Avoid journaling 404s for optional contentColin Walters2017-07-131-12/+4
| | | | | | | | | | | | | | Currently in Fedora we don't sign summaries, and every use of `rpm-ostree` would emit to the journal an error when we failed to fetch it. Fix this by having `OSTREE_FETCHER_REQUEST_OPTIONAL_CONTENT` tell the fetcher not to journal 404 errors. While fixing this, we had a mix of two booleans vs the flags; fix things so we consistently use the flags in the fetcher and pull code. Closes: #1004 Approved by: mbarnes
* fetcher: Move high level functions into "fetcher-util"Colin Walters2017-01-041-0/+1
| | | | | | | | Conceptually these now lay on top of the core API, and don't reference libsoup. This is preparation for libcurl porting, but it's also just generally better. Closes: #636 Approved by: jlebon
* fetcher: Define an abstraction over SoupURIColin Walters2016-12-071-13/+13
| | | | | | | This is preparatory work for a potential libcurl backend. Closes: #616 Approved by: jlebon
* lib: Remove unused ostree_metalink_get_uri()Colin Walters2016-12-061-6/+0
| | | | | | | While doing something else I noticed it was unused. Closes: #615 Approved by: jlebon
* [ASAN] metalink: Fix leaks of bufferColin Walters2016-11-301-5/+8
| | | | | | | | | | We should be religious about the "only set output variables on success", otherwise it makes leaks more likely. But the real leak was us simply not using autoptr in one place. Closes: #598 Approved by: jlebon
* [ASAN] lib: Squash various leaks in library and commandlineColin Walters2016-11-211-0/+3
| | | | | | | | The pull one is the most likely to affect users. Otherwise mostly just cleaning up `-fsanitize=address`. Closes: #587 Approved by: jlebon
* pull: drop fetching_sync_uriJonathan Lebon2016-08-311-4/+0
| | | | | | | | | | | | | | This made sense back when we used a main loop even when we needed to fetch objects synchronously. Nowadays, we no longer actually update progress before the FETCHING_OBJECTS phase, which is only for async requests. This allows us to get rid of fetch_uri_contents_membuf_sync() and to generalize fetch_uri_contents_utf8_sync() so that it only requires a fetcher. This will be needed later. Closes: #469 Approved by: cgwalters
* small cleanupsJonathan Lebon2016-04-081-2/+2
| | | | | | | | | - Revert 'cannot' --> 'can not' (it's the exception!) - Remove duplicate function - Squelch compiler warnings Closes: #248 Approved by: cgwalters
* pull: Push a temporary main context for sync requestsMatthew Barnes2015-12-141-6/+4
| | | | | | | | | | Given the previous commit, which isolates SoupSession in a separate thread, it should be safe to start pushing a temporary main context for synchronous requests again. This partially reverts 84fe2ff, which partially reverted 9f3d586. Related to https://bugzilla.gnome.org/show_bug.cgi?id=753336
* pull: Go back to using one main contextColin Walters2015-09-011-4/+6
| | | | | | | | | | | | | | | | | xdg-app was hanging for me with v2015.8, but worked with v2015.7. I narrowed things down to the GMainLoop/context commit, in which we started pushing a temporary main context for synchronous requests internally. That's never really going to work with libsoup - there needs to be a single main context which works on the socket. Furthermore, clients couldn't get progress messages that way. For *other* internal uses where we added APIs that talk to the remote repo, we cleanly push a temporary main context. (Note that I kind of snuck in a change here around the GError handling in pulls that isn't strictly related but came up in testing)
* pull: Stop using GMainLoopColin Walters2015-08-131-185/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | First of all, what we were doing with having GMainLoop in the internal APIs is wrong. Synchronous APIs should always create their own main context and not iterate the caller's. Doing the latter creates potential for evil reentrancy issues. Sync API should block, async API is for not blocking. Now that's out of the way, fix the pull code to do the clean ``` while (termination_condition (state)) g_main_context_iteration (mainctx, TRUE); ``` model for looping. This is a lot easier to understand and ultimately more reliable than having other code call `g_main_loop_quit()`, as the loop condition is in exactly one place. We can also remove the idle source which only fired once. Note we have to add a hack here to discard the synchronous session and create a new one which we only use async. https://bugzilla.gnome.org/show_bug.cgi?id=753336
* metalink: Return requested file as a GBytesMatthew Barnes2015-06-261-45/+38
| | | | | | This may not be the best idea for general usage, but the only use case for metalinks currently is fetching a summary file and those are pretty small. Far more convenient to return the file content in a GBytes.
* metalink: Allow NULL for "out" params in metalink requestsMatthew Barnes2015-06-261-3/+7
| | | | | Caller may not be interested in all the outbound params, particularly "fetching_sync_uri".
* metalink: Fix behavior when requested file is not foundMatthew Barnes2015-06-151-5/+15
| | | | | | The state machine's "passthrough_previous" field never got set, so the machine gets put back into the wrong state after a passthrough phase. Couple other minor issues around error handling.
* Remove unnecessary #include "libgsystem.h"Matthew Barnes2015-05-061-1/+0
|
* Use g_autoptr() for GIO object typesMatthew Barnes2015-05-061-1/+1
| | | | | GLib 2.44 supplies all the necessary autocleanup macros for GIO types, and libglnx backports the relevant macros for ostree.
* Use g_autofree instead of gs_freeMatthew Barnes2015-05-061-3/+3
|
* Change OstreeFetcher to be dirfd-relativeColin Walters2015-01-141-27/+46
| | | | | | | | | This is a noticeable cleanup, and fixes another big user of GFile* in performance/security sensitive codepaths. I'm specifically making this change because the static deltas code was leaking temporary files, and cleaning that up nicely would be best if we were fd relative.
* fetcher: Add a priority value to async requestsMatthew Barnes2015-01-111-0/+1
|
* ostree-fetcher: make _ostree_fetcher_stream_uri_sync privateGiuseppe Scrivano2014-11-121-10/+9
| | | | | | | | Rename _ostree_fetcher_contents_membuf_sync to ostree_fetcher_request_uri_to_membuf and drop unused argument user_data. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
* ostree-metalink: use _ostree_fetcher_contents_membuf_syncGiuseppe Scrivano2014-11-121-65/+38
| | | | Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
* metalink: have a single entry to the metalink moduleGiuseppe Scrivano2014-11-121-25/+61
| | | | | | Replace _ostree_metalink_request_async with a synchronous version. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
* Add repository "summary" file and metalink supportColin Walters2014-09-031-0/+710
For Fedora and potentially other distributions which use globally distributed mirrors, metalink is a popular solution to redirect clients to a dynamic set of mirrors. In order to make metalink work though, it needs *one* file which can be checksummed. (Well, potentially we could explode all refs into the metalink.xml, but that would be a lot more invasive, and a bit weird as we'd end up checksumming the checksum file). This commit adds a new command: $ ostree summary -u To regenerate the summary file. Can only be run by one process at a time. After that's done, the metalink can be generated based on it, and the client fetch code will parse and load it. https://bugzilla.gnome.org/show_bug.cgi?id=729585