Loading...
Searching...
No Matches
NetworkRequest.h
Go to the documentation of this file.
1/**************************************************************************************************
2 * This file is a part of Ultralight. *
3 * *
4 * See <https://ultralig.ht> for licensing and more. *
5 * *
6 * (C) 2024 Ultralight, Inc. *
7 **************************************************************************************************/
8#pragma once
10
11namespace ultralight {
12
13///
14/// @brief Interface for Network requests.
15///
17 public:
18 virtual ~NetworkRequest() { }
19
20 ///
21 /// URL of the request.
22 ///
23 virtual String url() const = 0;
24
25 ///
26 /// The host portion of the URL.
27 ///
28 virtual String urlHost() const = 0;
29
30 ///
31 /// The protocol of the URL (eg, "http")
32 ///
33 virtual String urlProtocol() const = 0;
34
35 ///
36 /// The HTTP method (eg, "POST" or "GET")
37 ///
38 virtual String httpMethod() const = 0;
39
40 ///
41 /// The origin of the request.
42 ///
43 virtual String httpOrigin() const = 0;
44
45 ///
46 /// The user-agent of the request.
47 ///
48 virtual String httpUserAgent() const = 0;
49
50 ///
51 /// Enforce additional TLS/SSL certificate validation by verifying the
52 /// server's pinned public key.
53 ///
54 /// The public key string can be any number of base64 encoded sha256 hashes
55 /// preceded by "sha256//" and separated by ";".
56 ///
57 /// For more info see the cURL docs:
58 /// <https://curl.se/libcurl/c/CURLOPT_PINNEDPUBLICKEY.html>
59 ///
60 virtual void EnforcePinnedPublicKey(const String& public_key) = 0;
61};
62
63} // namespace ultralight
#define UExport
Definition Exports.h:25
Interface for Network requests.
Definition NetworkRequest.h:16
virtual String httpMethod() const =0
The HTTP method (eg, "POST" or "GET")
virtual void EnforcePinnedPublicKey(const String &public_key)=0
Enforce additional TLS/SSL certificate validation by verifying the server's pinned public key.
virtual String urlHost() const =0
The host portion of the URL.
virtual String url() const =0
URL of the request.
virtual String httpOrigin() const =0
The origin of the request.
virtual String urlProtocol() const =0
The protocol of the URL (eg, "http")
virtual String httpUserAgent() const =0
The user-agent of the request.
virtual ~NetworkRequest()
Definition NetworkRequest.h:18
Unicode string container with conversions for UTF-8, UTF-16, and UTF-32.
Definition String.h:34
Definition App.h:14