summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-fetcher-util.h
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-0/+10
| | | | | | | | | | | | | | 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/fetcher-util: Use GIOErrorEnum instead of GIOErrorRobert Fairley2019-05-201-1/+1
| | | | | | | | | Use GIOErrorEnum as the return value for _ostree_fetcher_http_status_code_to_io_error(), to avoid an implicit cast from GIOError. Closes: #1857 Approved by: cgwalters
* lib/fetcher: Factor out HTTP status code handling from soup and curlPhilip Withnall2018-05-301-0/+2
| | | | | | | | | | | Use the same G_IO_ERROR_* values for HTTP status codes in both fetchers. The libsoup fetcher still handles a few more internal error codes than the libcurl one; this could be built on in future. Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #1594 Approved by: jlebon
* lib/repo-pull: Support retrying requests on transient network errorsPhilip Withnall2018-05-301-0/+4
| | | | | | | | | | | | | | | | | | | | 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
* lib/fetcher: Add version to USER_AGENT stringColin Walters2018-01-111-0/+6
| | | | | | | | | | This came up in allowing Fedora infrastructure to work around a libcurl bug with HTTP2: https://pagure.io/atomic-wg/issue/405 Closes: https://github.com/ostreedev/ostree/issues/1405 Closes: #1406 Approved by: jlebon
* lib/pull: Change fetcher to return O_TMPFILEColin Walters2017-10-051-7/+16
| | | | | | | | | | | | | | | | | | | | | | | A lot of the libostree code is honestly too complex for its own good (this is mostly my fault). The way we do HTTP writes is still one of those. The way the fetcher writes tempfiles, then reads them back in is definitely one of those. Now that we've dropped the "partial object" bits in: https://github.com/ostreedev/ostree/pull/1176 i.e. commit https://github.com/ostreedev/ostree/commit/0488b4870e80ef575d8b0edf6f2a9e5ad54bf4df we can simplify things a lot more by having the fetcher return an `O_TMPFILE` rather than a filename. For trusted archive mirroring, we need to enable linking in the tmpfiles directly. Otherwise for at least content objects they're compressed, so we couldn't link them in. For metadata, we need to do similar logic to what we have around `mmap()` to only grab a tmpfile if the size is large enough. Closes: #1252 Approved by: jlebon
* 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: Drop partial fetch code from libsoup backendColin Walters2017-09-151-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | Doing this in prep for libglnx tmpdir porting, but I think we should also do this because the partial fetch code IMO was never fully baked; among other things it was never integrated into the scheme we came up with for "boot id sync" that we use for complete/staged objects. There's a lot of complexity here that while we have some coverage for, I think we need to refocus on the core functionality. The libcurl backend doesn't have an equivalent to this today. In particular for small objects, this is simply overly complex. The downside is clearly for large objects like FAH's 61MB initramfs; not being able to resume fetches of those is unfortunate. In practice though, I think most people should be using deltas, and we need to make sure deltas work for large objects anyways. Further ultimately the peer-to-peer work should help a lot for people with truly unreliable connections. Closes: #1176 Approved by: jlebon
* lib/pull: Avoid journaling 404s for optional contentColin Walters2017-07-131-4/+2
| | | | | | | | | | | | | | 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: Log failures into journalColin Walters2017-02-241-0/+6
| | | | | | | | | | | | | | | | | | | | | Particularly when HTTP requests fail, I really want a lot more information. We could theoretically stuff it into the `GError` message field, but that gets ugly *fast*. Using the systemd journal allows us to log things in a structured fashion. Right now e.g. rpm-ostree won't be aware of this additional information, but I think we could teach it to be down the line. In the short term, users can learn to find it from `systemctl status rpm-ostreed` or `journalctl -b -r -u rpm-ostreed`, etc. One thing I'd like to do next is log successful fetches of e.g. commit objects as well with more information about the originating server (things like the final URL if we were redirected, did we use TLS pinning, what was the negotiated TLS version+cipher, etc). Closes: #708 Approved by: jlebon
* fetcher: Move high level functions into "fetcher-util"Colin Walters2017-01-041-0/+49
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