mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:17:35 +00:00
AK: Recompute URL validity after changing protocol/host/path
This allows you to build URLs by calling setters on an empty URL and actually get a valid URL at the end.
This commit is contained in:
parent
827e375297
commit
b1555381ee
2 changed files with 43 additions and 4 deletions
9
AK/URL.h
9
AK/URL.h
|
@ -53,10 +53,10 @@ public:
|
|||
String query() const { return m_query; }
|
||||
u16 port() const { return m_port; }
|
||||
|
||||
void set_protocol(const String& protocol) { m_protocol = protocol; }
|
||||
void set_host(const String& host) { m_host = host; }
|
||||
void set_path(const String& path) { m_path = path; }
|
||||
void set_query(const String& query) { m_query = query; }
|
||||
void set_protocol(const String& protocol);
|
||||
void set_host(const String& host);
|
||||
void set_path(const String& path);
|
||||
void set_query(const String& query);
|
||||
void set_port(u16 port) { m_port = port; }
|
||||
|
||||
String to_string() const;
|
||||
|
@ -65,6 +65,7 @@ public:
|
|||
|
||||
private:
|
||||
bool parse(const StringView&);
|
||||
bool compute_validity() const;
|
||||
|
||||
bool m_valid { false };
|
||||
u16 m_port { 80 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue