mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:27:35 +00:00
AK: Support fragment in URL
This commit is contained in:
parent
eff27f39d5
commit
21a61b276b
2 changed files with 12 additions and 0 deletions
|
@ -174,6 +174,10 @@ String URL::to_string() const
|
||||||
builder.append('?');
|
builder.append('?');
|
||||||
builder.append(m_query);
|
builder.append(m_query);
|
||||||
}
|
}
|
||||||
|
if (!m_fragment.is_empty()) {
|
||||||
|
builder.append('#');
|
||||||
|
builder.append(m_fragment);
|
||||||
|
}
|
||||||
return builder.to_string();
|
return builder.to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,6 +237,11 @@ void URL::set_query(const String& query)
|
||||||
m_query = query;
|
m_query = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void URL::set_fragment(const String& fragment)
|
||||||
|
{
|
||||||
|
m_fragment = fragment;
|
||||||
|
}
|
||||||
|
|
||||||
bool URL::compute_validity() const
|
bool URL::compute_validity() const
|
||||||
{
|
{
|
||||||
// FIXME: This is by no means complete.
|
// FIXME: This is by no means complete.
|
||||||
|
|
3
AK/URL.h
3
AK/URL.h
|
@ -51,12 +51,14 @@ public:
|
||||||
String host() const { return m_host; }
|
String host() const { return m_host; }
|
||||||
String path() const { return m_path; }
|
String path() const { return m_path; }
|
||||||
String query() const { return m_query; }
|
String query() const { return m_query; }
|
||||||
|
String fragment() const { return m_fragment; }
|
||||||
u16 port() const { return m_port; }
|
u16 port() const { return m_port; }
|
||||||
|
|
||||||
void set_protocol(const String& protocol);
|
void set_protocol(const String& protocol);
|
||||||
void set_host(const String& host);
|
void set_host(const String& host);
|
||||||
void set_path(const String& path);
|
void set_path(const String& path);
|
||||||
void set_query(const String& query);
|
void set_query(const String& query);
|
||||||
|
void set_fragment(const String& fragment);
|
||||||
void set_port(u16 port) { m_port = port; }
|
void set_port(u16 port) { m_port = port; }
|
||||||
|
|
||||||
String to_string() const;
|
String to_string() const;
|
||||||
|
@ -73,6 +75,7 @@ private:
|
||||||
String m_host;
|
String m_host;
|
||||||
String m_path;
|
String m_path;
|
||||||
String m_query;
|
String m_query;
|
||||||
|
String m_fragment;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue