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