Commit Graph
35 Commits
Author SHA1 Message Date
Julian Smith 4c25e7898e simgear/io/HTTP*: added support for enabling compression when downloading.
Uses underlying curl library's CURLOPT_ACCEPT_ENCODING.
2021-03-06 08:52:11 +00:00
Julian Smith f9ecf455ba simgear/io/: exteded http client support to allow replaying of recordings from a URL.
simgear/io/HTTPClient.cxx
    Support range in HTTPRequest's. Set CURLOPT_MAX_RECV_SPEED_LARGE if request's
    getMaxBytesPerSec() is non-zero.
simgear/io/HTTPFileRequest.cxx
simgear/io/HTTPFileRequest.hxx
    Added 'bool append' to constructor args; if specified we assume that, if
    the output file already exists, it is from an interrupted download, and we
    use an http Range header to append any remaining data.
    Support a std::function callback when new data is available.
    Added setMaxBytesPerSec() to limit download bandwidth; useful for testing.
simgear/io/HTTPRequest.cxx
simgear/io/HTTPRequest.hxx
   Added support for setting Range header.

In both simgear/io/HTTPClient.cxx and simgear/io/HTTPRequest.cxx, if
a range is specified, we treat http results 206 'Partial Content' and
416 'Range Not Satisfiable' as success.
2021-02-18 09:30:56 +00:00
Automatic Release Builder 29d4899f1f TerraSync: retry after socket failures
Assume socket failures are intermittent, up to some maximum count
(currently configured as 16). Add a test case to cover this.
2020-10-29 14:08:47 +00:00
Automatic Release Builder c0323e34a5 TerraSync: tweak warnings around checksum failures
Trying to reduce log spam when there is a server-side failure.
2020-10-29 14:00:22 +00:00
gallaert 7a6f9151a6 General boost cleanup 2020-04-22 14:04:21 +01:00
gallaert 567293c14d Replace boost::function by std::function 2020-04-22 14:04:21 +01:00
James Turner 34b3c52a28 Improve HTTP redirect handling, and add test.
Ensure we get the final status code for the request after redirecting.
2019-02-13 12:34:17 +00:00
James Turner c170f576b6 Ensure <simgear_config.h> is always included.
This is going to become important soon - prep for enabling SIMGEAR_SHARED on Windows.
2017-03-28 09:36:53 +01:00
Richard Senior 6334c30eb6 Allow empty reason string in validation of HTTP response.
HTTP/1.0 and HTTP/1.1 allow the reason string to be empty.
Some servers produce empty reason strings on success,
e.g. "HTTP/1.1 200 ", which throws a "bad HTTP response"
exception.

From the specification:
    "Reason-Phrase  = *<TEXT, excluding CR, LF>"

From notational conventions:
    "*(element) allows any number, including zero"

References:
www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2
www.w3.org/Protocols/HTTP/1.0/spec.html
www.w3.org/Protocols/rfc2616/rfc2616-sec6.html
2017-02-01 10:23:10 +00:00
James Turner a3f1bb546f HTTP request cancellation
- replaces abort() with something more structured.
2016-04-14 09:16:36 +01:00
James Turner 3f9b6d632e HTTP/curl - transfer byte metric work
Should fix the missing download rate feedback on the splash screen
and terra sync dialog.
2016-03-22 21:13:22 +00:00
James Turner 714a6ac47d Disable HTTP pipelining if the connection closes.
Don’t keep attempting to pipeline if the next server sets Close on
its response, since this just generates needless overhead.
2016-03-22 20:06:22 +00:00
James Turner ef7a0dc5a3 Trying to debug HTTP timeouts 2016-01-01 17:17:55 -06:00
James Turner a57e969639 Optional use libCurl as the HTTP client.
Will permit HTTPS for packages in the future, disabled by default
for the moment.
2015-11-22 23:53:46 +00:00
James Turner 23b8c86e78 More whitespace fixes. 2015-11-22 23:53:46 +00:00
Thomas Geymayer f41b18f064 Improve (mostly Canvas event related) documentation. 2014-07-29 23:57:59 +02:00
Thomas Geymayer 0b60643053 HTTPRequest/pkg::Install: do not replace callbacks.
Keep a list of callbacks to allow registering multiple callbacks
to the same event. This is consistent with eg. jQuery.Deferred
and is needed for example to open multiple dialogs showing the
progress of installing a package at the same time.
2014-06-30 18:22:24 +02:00
Thomas Geymayer e302ad092e canvas::Image: abort http requests if image is destroyed. 2014-06-05 17:25:12 +02:00
Thomas Geymayer fd51518d92 CanvasImage: improve fetching from http and add mime detection. 2014-03-20 01:44:31 +01:00
James Turner 04246f0a63 HTTP: tweak response parsing.
Signal a parse failure via an exception, instead of via a status
code, since this is hard to disambiguate from a valid server-side
status code.
2014-01-07 16:22:10 +00:00
James Turner 1bd9a440e8 HTTP: tweak for malformed header handling. 2014-01-07 14:24:01 +00:00
Thomas Geymayer 7076c9a0ff HTTP: finish core request before calling any callback. 2013-10-28 20:34:11 +01:00
Thomas Geymayer f93fead8f2 io: refactor and improve HTTP modules.
- refactor code used multiple times spread over sg/fg into
   one single location.
 - allow aborting requests.
 - Provide two common request types:
  * FileRequest: Save response into file
  * MemoryRequest: Keep resonse in memory (std::string)
 - extend HTTP::Client interface:
  * urlretrieve: Save url to file (shortcut for making a
                 FileRequest)
  * urlload: Get respons into memory (shortcut for making
             a MemoryRequest)
2013-10-27 19:05:49 +01:00
James Turner 17418039e1 HTTP bugfix + enhancement.
Track 'waiting for response' state explicitly, so we don't
falsely report IDLE when waiting for a response.

Expose bytes-per-second download rate as metric.
2013-09-27 18:20:03 +01:00
James Turner f52c0026dd Better reporting when an HTTP request fails. 2013-07-28 21:06:17 +01:00
James Turner 323d0d5ba0 HTTP engine tweaks for SVN support. 2013-06-09 19:19:02 +01:00
James Turner d1af42e9ad Tweak HTTP handling for POST requests.
Tolerate slightly malformed request URLs (no slash following the host specified), and use a better check when POST-ing to decide the request-body data source.
2012-11-17 18:08:38 +00:00
James Turner 71be1a9e28 HTTP enhancements.
Support content-encoding and improve pipelining support.
2012-10-27 18:03:51 +01:00
James Turner 69ef461e6d Merge commit 'refs/merge-requests/22' of git://gitorious.org/fg/simgear into merge-requests/22 2012-04-23 12:21:50 +01:00
James Turner 95ddc04a73 Fix assorted compiler warnings found by Clang 2011-10-28 12:07:35 +01:00
James Turner 7525fd5e3e Update HTTP code to support HTTP/1.0 responses, eg metarproxy 2011-08-07 10:49:13 +01:00
James Turner 115531e944 Further HTTP improvements, correct proxy support, spec compliance, support for chunked encoding. 2011-08-04 18:03:56 +01:00
James Turner a2249becba Further HTTP improvements, wget-alike test program to check it all behaves! 2011-08-01 09:03:12 +01:00
James Turner 19119cc4ae Tweaks to HTTP code, in preparation for using it for metar - especially, test code for proxies 2011-07-30 10:43:49 +01:00
James Turner f06f25532c Tiny HTTP client layer on top of NetChat - and CTest support for some SimGear tests. 2011-07-19 12:55:55 +01:00