blob: 3595e791a37be02554b548cb0608c7c38d5fbf07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/String.h>
namespace Web {
class Origin {
public:
Origin() { }
Origin(const String& protocol, const String& host, u16 port)
: m_protocol(protocol)
, m_host(host)
, m_port(port)
{
}
bool is_null() const { return m_protocol.is_null() && m_host.is_null() && !m_port; }
const String& protocol() const { return m_protocol; }
const String& host() const { return m_host; }
u16 port() const { return m_port; }
bool is_same(const Origin& other) const
{
return protocol() == other.protocol()
&& host() == other.host()
&& port() == other.port();
}
private:
String m_protocol;
String m_host;
u16 m_port { 0 };
};
}
|