6 Commits

Author SHA1 Message Date
Alexander Larsson
0e51264788 tests: Use regular HTTPServer, not ThreadingHTTPServer
The later requires python 3.7
2019-10-09 14:25:44 +02:00
Alexander Larsson
227cde12ba tests: Redo httpd server setup
Rather than this weird shell loop with a timeout and polling we
move the httpd spawning entirely into the python code, and use
a pipe to synchronize the spawning. This way we can also use
the shell job control to properly clean up any running processes
from the test suite.

Additionally, this adds some (lame) support for token handling in the
test webserver, where you for any file foo can create a foo.need_token
containing a token that is needed for that file.
2019-10-09 14:25:44 +02:00
Alexander Larsson
2b6641575d tests: Convert all tests to python3
Python2 is pretty much dead, lets make us only use python3.
2019-10-07 11:38:24 +02:00
Simon McVittie
3224e26b0a Make test scripts bilingual Python 2/Python 3
Signed-off-by: Simon McVittie <smcv@debian.org>
Forwarded: https://github.com/flatpak/flatpak/pull/1990

Closes: #1990
Approved by: alexlarsson
2018-08-27 10:36:28 +00:00
Owen W. Taylor
c4c06b7be4 Allow using a compressed cache for HTTP downloads
Add a new flag for flatpak_cache_http_uri() that adds Accept-Encoding: gzip
to the request, and if the result is returned compressed, stores the data
compressed. If the data result is return uncompressed, it's compressed.

Closes: #1910
Approved by: alexlarsson
2018-08-09 12:49:35 +00:00
Owen W. Taylor
951aed561a Add flatpak_cache_http_uri: cache downloads based on HTTP headers
Add a new function, flatpak_cache_http_uri() that when passed an URL and
a local destination location, either a) downloads the content and stores
it at the destination location, storing HTTP cache header information
like Last-Modified, Etag into user xattrs (if available) or a separate
file or b) if the downloaded content is already present, checks the
header information to decide whether the downloaded content can be used
or needs to be revalidated witha conditional request.

Tests are added that use a special case test server that adds HTTP caching
headers and reacts to them based on query parameters. A small test binary
'httpcache' is added for the tests to use.

Closes: #1910
Approved by: alexlarsson
2018-08-09 12:49:35 +00:00