diff options
| author | Stefan Boberg <[email protected]> | 2026-03-04 09:40:49 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-03-04 09:40:49 +0100 |
| commit | eafd4d78378c1a642445ed127fdbe51ac559d4e3 (patch) | |
| tree | d8c132ced0597c45665569cde5c1aa811ffcb593 /src/zenhttp/include | |
| parent | unity build fixes (#802) (diff) | |
| download | zen-eafd4d78378c1a642445ed127fdbe51ac559d4e3.tar.xz zen-eafd4d78378c1a642445ed127fdbe51ac559d4e3.zip | |
HTTP improvements (#803)
- Add GetTotalBytesReceived/GetTotalBytesSent to HttpServer with implementations in ASIO and http.sys backends
- Add ExpectedErrorCodes to HttpClientSettings to suppress warn/info logs for anticipated HTTP error codes
- Also fixes minor issues in `CprHttpClient::Download`
Diffstat (limited to 'src/zenhttp/include')
| -rw-r--r-- | src/zenhttp/include/zenhttp/httpclient.h | 5 | ||||
| -rw-r--r-- | src/zenhttp/include/zenhttp/httpserver.h | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/zenhttp/include/zenhttp/httpclient.h b/src/zenhttp/include/zenhttp/httpclient.h index 53be36b9a..d87082d10 100644 --- a/src/zenhttp/include/zenhttp/httpclient.h +++ b/src/zenhttp/include/zenhttp/httpclient.h @@ -13,6 +13,7 @@ #include <functional> #include <optional> #include <unordered_map> +#include <vector> namespace zen { @@ -58,6 +59,10 @@ struct HttpClientSettings Oid SessionId = Oid::Zero; bool Verbose = false; uint64_t MaximumInMemoryDownloadSize = 1024u * 1024u; + + /// HTTP status codes that are expected and should not be logged as warnings. + /// 404 is always treated as expected regardless of this list. + std::vector<HttpResponseCode> ExpectedErrorCodes; }; class HttpClientError : public std::runtime_error diff --git a/src/zenhttp/include/zenhttp/httpserver.h b/src/zenhttp/include/zenhttp/httpserver.h index fee932daa..62c080a7b 100644 --- a/src/zenhttp/include/zenhttp/httpserver.h +++ b/src/zenhttp/include/zenhttp/httpserver.h @@ -230,6 +230,10 @@ public: */ std::string_view GetExternalHost() const { return m_ExternalHost; } + /** Returns total bytes received and sent across all connections since server start. */ + virtual uint64_t GetTotalBytesReceived() const { return 0; } + virtual uint64_t GetTotalBytesSent() const { return 0; } + private: std::vector<HttpService*> m_KnownServices; int m_EffectivePort = 0; |