Serenity Operating System
at master 53 lines 1.5 kB view raw
1/* 2 * Copyright (c) 2021, Dex♪ <dexes.ttp@gmail.com> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#pragma once 8 9#include <AK/URL.h> 10#include <AK/Vector.h> 11#include <LibCore/Object.h> 12#include <LibTLS/TLSv12.h> 13#include <LibWebSocket/Message.h> 14 15namespace WebSocket { 16 17class ConnectionInfo final { 18public: 19 ConnectionInfo(URL); 20 21 URL const& url() const { return m_url; } 22 23 DeprecatedString const& origin() const { return m_origin; } 24 void set_origin(DeprecatedString origin) { m_origin = move(origin); } 25 26 Vector<DeprecatedString> const& protocols() const { return m_protocols; } 27 void set_protocols(Vector<DeprecatedString> protocols) { m_protocols = move(protocols); } 28 29 Vector<DeprecatedString> const& extensions() const { return m_extensions; } 30 void set_extensions(Vector<DeprecatedString> extensions) { m_extensions = move(extensions); } 31 32 struct Header { 33 DeprecatedString name; 34 DeprecatedString value; 35 }; 36 Vector<Header> const& headers() const { return m_headers; } 37 void set_headers(Vector<Header> headers) { m_headers = move(headers); } 38 39 // secure flag - defined in RFC 6455 Section 3 40 bool is_secure() const; 41 42 // "resource-name" or "/resource name/" - defined in RFC 6455 Section 3 43 DeprecatedString resource_name() const; 44 45private: 46 URL m_url; 47 DeprecatedString m_origin; 48 Vector<DeprecatedString> m_protocols {}; 49 Vector<DeprecatedString> m_extensions {}; 50 Vector<Header> m_headers {}; 51}; 52 53}