diff options
author | Andreas Kling <kling@serenityos.org> | 2022-01-26 22:35:50 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-01-27 09:56:24 +0100 |
commit | b7d316d291f56647894fab3b3039cf48b1712843 (patch) | |
tree | ba378db52c71db19a99b7d371805f4293acd0715 /Userland/Services | |
parent | f73eae1245ac733035912643a2c4b221d63f18fa (diff) | |
download | serenity-b7d316d291f56647894fab3b3039cf48b1712843.zip |
RequestServer: Make Request::url() virtual
Let the Request subclass decide how they store the URL instead of
storing it in a Request member.
Diffstat (limited to 'Userland/Services')
-rw-r--r-- | Userland/Services/RequestServer/GeminiRequest.h | 2 | ||||
-rw-r--r-- | Userland/Services/RequestServer/HttpRequest.h | 2 | ||||
-rw-r--r-- | Userland/Services/RequestServer/HttpsRequest.h | 2 | ||||
-rw-r--r-- | Userland/Services/RequestServer/Request.h | 3 |
4 files changed, 7 insertions, 2 deletions
diff --git a/Userland/Services/RequestServer/GeminiRequest.h b/Userland/Services/RequestServer/GeminiRequest.h index c481da653d..0d9ffe4801 100644 --- a/Userland/Services/RequestServer/GeminiRequest.h +++ b/Userland/Services/RequestServer/GeminiRequest.h @@ -20,6 +20,8 @@ public: Gemini::GeminiJob const& job() const { return *m_job; } + virtual URL url() const override { return m_job->url(); } + private: explicit GeminiRequest(ClientConnection&, NonnullRefPtr<Gemini::GeminiJob>, NonnullOwnPtr<OutputFileStream>&&); diff --git a/Userland/Services/RequestServer/HttpRequest.h b/Userland/Services/RequestServer/HttpRequest.h index d2968061c1..3ef9bb206b 100644 --- a/Userland/Services/RequestServer/HttpRequest.h +++ b/Userland/Services/RequestServer/HttpRequest.h @@ -22,6 +22,8 @@ public: HTTP::HttpJob& job() { return m_job; } HTTP::HttpJob const& job() const { return m_job; } + virtual URL url() const override { return m_job->url(); } + private: explicit HttpRequest(ClientConnection&, NonnullRefPtr<HTTP::HttpJob>, NonnullOwnPtr<OutputFileStream>&&); diff --git a/Userland/Services/RequestServer/HttpsRequest.h b/Userland/Services/RequestServer/HttpsRequest.h index 2f26b0d6fe..51187368dd 100644 --- a/Userland/Services/RequestServer/HttpsRequest.h +++ b/Userland/Services/RequestServer/HttpsRequest.h @@ -21,6 +21,8 @@ public: HTTP::HttpsJob& job() { return m_job; } HTTP::HttpsJob const& job() const { return m_job; } + virtual URL url() const override { return m_job->url(); } + private: explicit HttpsRequest(ClientConnection&, NonnullRefPtr<HTTP::HttpsJob>, NonnullOwnPtr<OutputFileStream>&&); diff --git a/Userland/Services/RequestServer/Request.h b/Userland/Services/RequestServer/Request.h index 324f027c93..9e83e047ed 100644 --- a/Userland/Services/RequestServer/Request.h +++ b/Userland/Services/RequestServer/Request.h @@ -21,7 +21,7 @@ public: virtual ~Request(); i32 id() const { return m_id; } - URL url() const { return m_url; } + virtual URL url() const = 0; Optional<u32> status_code() const { return m_status_code; } Optional<u32> total_size() const { return m_total_size; } @@ -50,7 +50,6 @@ private: ClientConnection& m_client; i32 m_id { 0 }; int m_request_fd { -1 }; // Passed to client. - URL m_url; Optional<u32> m_status_code; Optional<u32> m_total_size {}; size_t m_downloaded_size { 0 }; |