summaryrefslogtreecommitdiff
path: root/src/ostree/ot-builtin-trivial-httpd.c
Commit message (Collapse)AuthorAgeFilesLines
* Update FSF license notices to use URL instead of addressJoseph Marrero2021-12-071-3/+1
|
* 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
* ostree: move flags into command struct, pass down through builtinsRuixin Bao2017-10-201-1/+1
| | | | | | | | | | | | | | | | | | | | This is a similar approach as https://github.com/projectatomic/rpm-ostree/commit/12c34bb2491a07079c911ef26401fee939e5573c. One thing to note is when we parse the admin related functions, we still keep the old admin related flags, and added a new parameter to represent the command struct. This allows us to identify the caller of the function, making it easier for us to possibly deduplicate the subcommand handling in the future. A similar approach is done in rpm-ostree: https://github.com/projectatomic/rpm-ostree/commit/83aeb018c1012c7a43783c09b74ec71bc9c45826 This also makes it easier for us to change the prototype of the function. If we want to add something new in the future, we won't need to touch every prototype. Closes: #1267 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
* Split trivial-httpd into separate binaryColin Walters2017-01-041-622/+10
| | | | | | | | | | | | | | | | | | Working on the libcurl backend, I hit the issue that the trivial-httpd program depends on libsoup. I briefly considered having two versions, but libcurl is client only, and moreover trivial-httpd is no longer trivial - it has various features which are used by the test suite extensively. Hence, what we'll do is build it as a separate binary which links to libsoup, and use it during the tests. We *also* currently still provide `ostree trivial-httpd` since some things use it like `rpm-ostree-toolbox` and the Cockpit tests. After those are ported to use some other webserver, I plan to add a build-time option to drop it. Closes: #636 Approved by: jlebon
* pull: Add support for `http-headers` optionColin Walters2016-11-161-1/+32
| | | | | | | | | | | | | | | Some deployments may want to gate access to content based on things like OAuth. In this model, the client system would normally compute a token and pass it to the server via an API. We could theoretically support this in the remote config too, but that'd be a bit weird for OAuth as the information is dynamic. Therefore this cleans up the code a little bit to more clearly handle the case that the fetcher is initialized from both remote config data plus pull options. Closes: #574 Approved by: giuseppe
* trivial-httpd: Add support for checking cookiesSjoerd Simons2016-11-051-0/+39
| | | | | | | | Allow passsing a list of cookie key/values to trivial-httpd which should be provided to allow downloads Closes: #531 Approved by: cgwalters
* trivial-httpd: Port mostly to fd-relativeColin Walters2016-10-051-43/+57
| | | | | | | | | | | | | We were seeing some weird potential memory corruption in this code when using it for `rpm-ostree-toolbox installer`, which is almost certainly not its fault, but let's use it as an excuse to port (mostly) to fd-relative and away from GFile. Dropping the last GFile use here is a bit tricky as it does have a nice high level wrapper around inotify. Closes: #512 Approved by: jlebon
* trivial-httpd: prepend timestamp in log fileJonathan Lebon2016-08-311-2/+8
| | | | | | | | I've found this useful when monitoring multiple logs at the same time to test the upcoming content & meta URL splitting. Closes: #469 Approved by: cgwalters
* trivial-httpd: Fix leak of option contextColin Walters2016-07-281-5/+3
| | | | | | | | | | Right now our valgrind runs also end up valgrinding the `trivial-httpd` code, so while it doesn't matter, let's fix this leak anyways. We need to avoid calling `_exit()` since that won't run the cleanup functions. Closes: #410 Approved by: giuseppe
* tests: Add some test coverage of repeated pulls w/HTTP 500sColin Walters2016-07-081-0/+24
| | | | | | | | | Systems like pulp may want to keep retrying in a loop if the server throws a (hopefully transient) 500, and we need test coverage of handling these errors versus our existing 404 and 206 coverage. Closes: #383 Approved by: mbarnes
* trivial-httpd: Add __attribute__((format))Colin Walters2016-05-071-0/+3
| | | | | | | | | I was briefly looking at building with clang mostly since it detects unused variables with cleanup attributes, but then I hit this fatal error. It's a hard compile error with `-Wformat-nonliteral` since clang doesn't know it's a format string.
* trivial-httpd: Add a --log-file optionKrzesimir Nowak2016-04-221-2/+71
| | | | | | | Might be useful to see what files the client wants to fetch. Closes: #271 Approved by: cgwalters
* trivial-httpd: Remove useless codeKrzesimir Nowak2016-04-191-3/+0
| | | | | Closes: #267 Approved by: cgwalters
* libglnx porting: Use glnx_set_error_from_errnoColin Walters2016-03-231-3/+2
| | | | | | | | | :warning: There is a notable spiked pit trap here around `posix_fallocate()` and `errno`. This has bit other projects, see e.g. https://github.com/systemd/systemd/commit/7bb87460e691d30c1a7fd23a1a8240776957e05f Otherwise the port was straightforward.
* trivial-httpd: Avoid SoupBuffer when there's no contentMatthew Barnes2015-11-231-8/+12
| | | | | This was supposed to be merged into the previous commit, but I messed up.
* repo: Never delete .commitmeta filesMatthew Barnes2015-11-231-1/+2
| | | | | | | | Do not delete a .commitmeta file after removing the last metadata entry. This way a client will pull the empty .commitmeta file and overwrite old metadata as expected. https://bugzilla.gnome.org/750459
* trivial-httpd: add option to specify the portGiuseppe Scrivano2015-05-071-2/+4
| | | | | | | | | I use the trivial httpd server locally. Each time I restart the server, I end up modifying manually the config file for other repos so to point to the correct port. In this way I can just re-use the same port. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
* trivial-httpd: fix indentationGiuseppe Scrivano2015-05-071-11/+11
| | | | Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
* Use glnx_unref_object instead of gs_unref_objectMatthew Barnes2015-05-061-1/+1
| | | | | For non-GIO object types, at least until autocleanup support for GObject based types becomes more widespread.
* Use g_autoptr() for GIO object typesMatthew Barnes2015-05-061-4/+4
| | | | | 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-6/+6
|
* Port to libgsystem errno API, hard depend on 2014.3Colin Walters2015-01-041-1/+1
| | | | This is long overdue to make it to libgsystem. Update our dependency.
* trivial-httpd: use PR_SET_PDEATHSIG by defaultColin Walters2014-12-081-1/+18
| | | | | | | If we're not daemonizing, this is a useful way to ensure we go away if our parent does. https://bugzilla.gnome.org/show_bug.cgi?id=741264
* Refactor command-line parsingMatthew Barnes2014-11-241-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor command-line parsing to better utilize GOptionContext. This eliminates most of the manual parsing and global options are now shown in the help output. Here's a sample: $ ostree admin --help Usage: ostree admin [OPTION...] --print-current-dir|COMMAND Builtin "admin" Commands: cleanup config-diff deploy init-fs instutil os-init status switch undeploy upgrade Help Options: -h, --help Show help options Application Options: --sysroot=PATH Create a new OSTree sysroot at PATH -v, --verbose Print debug information during command processing --version Print version information and exit https://bugzilla.gnome.org/show_bug.cgi?id=740295
* http: set the HTTP status on directory listingGiuseppe Scrivano2014-10-071-0/+1
| | | | | | | | | | | | Fix a HTTP response header like the following: HTTP/1.1 0 (null) Server: ostree-httpd libsoup/2.48.0 Date: Tue, 07 Oct 2014 11:19:22 GMT Content-Type: text/html Content-Length: 12533 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
* trivial-httpd: Another followup fix - need to listen on all interfacesColin Walters2014-10-061-1/+1
| | | | This was the intended design, but it regressed when updating.
* trivial-httpd: Further fixes for previous commitColin Walters2014-09-251-3/+4
|
* Followup to SoupServer port deprecationColin Walters2014-09-251-2/+24
| | | | My patch didn't actually work with newer libsoup.
* Work around deprecation of SoupServer's port propertyColin Walters2014-09-091-0/+6
| | | | See https://bugzilla.gnome.org/show_bug.cgi?id=732184
* trivial-httpd: flush after writing the port to stdoutOwen W. Taylor2014-05-051-1/+4
| | | | | | | | | The option --port-file=- is most useful when the stdout of the daemon is programatically redirected and not going to a terminal. The flush-after-a-line behavior of stdout is specific to terminals, so we need an explicit flush. https://bugzilla.gnome.org/show_bug.cgi?id=729609
* Fix warnings about unused variablesTobias Hunger2013-08-301-1/+0
|
* trivial-httpd: Add missing include for shutdown() on eglibcColin Walters2013-08-261-0/+2
|
* trivial-httpd: Close the socket when sending partial filesJeremy Whiting2013-08-261-9/+49
| | | | | | | This will force the client to re-request them, which will be used to test interrupted "ostree pull" requests. https://bugzilla.gnome.org/show_bug.cgi?id=706344
* main: Code cleanup by passing OstreeRepo * directly to builtinsColin Walters2013-08-251-1/+1
| | | | | | | | | | It turns out every builtin (with one special exception) that takes a repo argument did the same thing; let's just centralize it. The special exception was "ostree init --repo=foo" where foo is expected to *not* actually be a repo. In that case, simply skip the ostree_repo_check() invocation. https://bugzilla.gnome.org/show_bug.cgi?id=706762
* trivial-httpd: Handle the autoexit case when the docroot is a symlinkVivek Dasmohapatra2013-08-231-1/+17
|
* trivial-httpd: Close stdout & stdin so $() can capture output when daemonizedVivek Dasmohapatra2013-08-231-0/+3
| | | | Will be used by tests.
* trivial-httpd: Handle -p - as meaning write-port-to-stdoutVivek Dasmohapatra2013-08-231-2/+4
| | | | This is convenient to use from tests.
* Use { 0, } for structure initialization rather than memset()Colin Walters2013-08-181-3/+1
| | | | | | | It's cleaner, safer, and I had a totally wrong idea stuck in my head about why memset() should be used. https://bugzilla.gnome.org/show_bug.cgi?id=705968
* trivial-httpd: Add --force-range-requests option to force range requestsJeremy Whiting2013-08-141-1/+16
| | | | | | | | | | | This will be used to test resuming interrupted downloads for ostree-pull. With this option, if a whole file is asked for, only half of the file is given. Then the client should retry with a range request, and we'll give them the other half. https://bugzilla.gnome.org/show_bug.cgi?id=705925
* Install a shared libraryColin Walters2013-07-261-0/+1
| | | | | This required a fair bit of surgery because previously ostree.h included otutil.h, but that's supposed to be a private library.
* main: Move GCancellable to toplevelColin Walters2013-07-161-2/+1
| | | | | This is just cleaner, and makes the builtins slightly more of a library, which in turn makes it easier to turn them into real API.
* ostree: Some header file cleanupsColin Walters2013-07-091-6/+0
|
* Add "trivial-httpd" builtin, use it in testsColin Walters2013-07-051-0/+348
A simple HTTP server implementation is so few lines of code when one is linking to libsoup anyways, so let's just have one here in ostree that will be used for the test suite. This allows us to run the archive tests that previously required apache even in gnome-ostree.