mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:47:44 +00:00
AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
This commit is contained in:
parent
f74251606d
commit
6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions
|
@ -38,16 +38,16 @@ public:
|
|||
Crypto::PK::RSAPublicKey<Crypto::UnsignedBigInteger> public_key {};
|
||||
Crypto::PK::RSAPrivateKey<Crypto::UnsignedBigInteger> private_key {};
|
||||
struct Name {
|
||||
String country;
|
||||
String state;
|
||||
String location;
|
||||
String entity;
|
||||
String subject;
|
||||
String unit;
|
||||
DeprecatedString country;
|
||||
DeprecatedString state;
|
||||
DeprecatedString location;
|
||||
DeprecatedString entity;
|
||||
DeprecatedString subject;
|
||||
DeprecatedString unit;
|
||||
} issuer, subject;
|
||||
Core::DateTime not_before;
|
||||
Core::DateTime not_after;
|
||||
Vector<String> SAN;
|
||||
Vector<DeprecatedString> SAN;
|
||||
u8* ocsp { nullptr };
|
||||
Crypto::UnsignedBigInteger serial_number;
|
||||
ByteBuffer sign_key {};
|
||||
|
@ -65,7 +65,7 @@ public:
|
|||
|
||||
bool is_valid() const;
|
||||
|
||||
String subject_identifier_string() const
|
||||
DeprecatedString subject_identifier_string() const
|
||||
{
|
||||
StringBuilder cert_name;
|
||||
if (!subject.country.is_empty()) {
|
||||
|
@ -95,7 +95,7 @@ public:
|
|||
return cert_name.build();
|
||||
}
|
||||
|
||||
String issuer_identifier_string() const
|
||||
DeprecatedString issuer_identifier_string() const
|
||||
{
|
||||
StringBuilder cert_name;
|
||||
if (!issuer.country.is_empty()) {
|
||||
|
|
|
@ -145,7 +145,7 @@ ssize_t TLSv12::handle_server_hello(ReadonlyBytes buffer, WritePacketStage& writ
|
|||
// Read out the host_name
|
||||
if (buffer.size() - res < sni_name_length)
|
||||
return (i8)Error::NeedMoreData;
|
||||
m_context.extensions.SNI = String { (char const*)buffer.offset_pointer(res), sni_name_length };
|
||||
m_context.extensions.SNI = DeprecatedString { (char const*)buffer.offset_pointer(res), sni_name_length };
|
||||
res += sni_name_length;
|
||||
dbgln("SNI host_name: {}", m_context.extensions.SNI);
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ ssize_t TLSv12::handle_server_hello(ReadonlyBytes buffer, WritePacketStage& writ
|
|||
u8 alpn_size = alpn[alpn_position++];
|
||||
if (alpn_size + alpn_position >= extension_length)
|
||||
break;
|
||||
String alpn_str { (char const*)alpn + alpn_position, alpn_length };
|
||||
DeprecatedString alpn_str { (char const*)alpn + alpn_position, alpn_length };
|
||||
if (alpn_size && m_context.alpn.contains_slow(alpn_str)) {
|
||||
m_context.negotiated_alpn = alpn_str;
|
||||
dbgln("negotiated alpn: {}", alpn_str);
|
||||
|
|
|
@ -32,7 +32,7 @@ ErrorOr<Bytes> TLSv12::read(Bytes bytes)
|
|||
return Bytes { bytes.data(), size_to_read };
|
||||
}
|
||||
|
||||
String TLSv12::read_line(size_t max_size)
|
||||
DeprecatedString TLSv12::read_line(size_t max_size)
|
||||
{
|
||||
if (!can_read_line())
|
||||
return {};
|
||||
|
@ -46,7 +46,7 @@ String TLSv12::read_line(size_t max_size)
|
|||
if (offset > max_size)
|
||||
return {};
|
||||
|
||||
String line { bit_cast<char const*>(start), offset, Chomp };
|
||||
DeprecatedString line { bit_cast<char const*>(start), offset, Chomp };
|
||||
// FIXME: Propagate errors.
|
||||
m_context.application_buffer = MUST(m_context.application_buffer.slice(offset + 1, m_context.application_buffer.size() - offset - 1));
|
||||
|
||||
|
@ -72,7 +72,7 @@ ErrorOr<size_t> TLSv12::write(ReadonlyBytes bytes)
|
|||
return bytes.size();
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<TLSv12>> TLSv12::connect(String const& host, u16 port, Options options)
|
||||
ErrorOr<NonnullOwnPtr<TLSv12>> TLSv12::connect(DeprecatedString const& host, u16 port, Options options)
|
||||
{
|
||||
Core::EventLoop loop;
|
||||
OwnPtr<Core::Stream::Socket> tcp_socket = TRY(Core::Stream::TCPSocket::connect(host, port));
|
||||
|
@ -94,7 +94,7 @@ ErrorOr<NonnullOwnPtr<TLSv12>> TLSv12::connect(String const& host, u16 port, Opt
|
|||
return AK::Error::from_string_view(alert_name(static_cast<AlertDescription>(256 - result)));
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<TLSv12>> TLSv12::connect(String const& host, Core::Stream::Socket& underlying_stream, Options options)
|
||||
ErrorOr<NonnullOwnPtr<TLSv12>> TLSv12::connect(DeprecatedString const& host, Core::Stream::Socket& underlying_stream, Options options)
|
||||
{
|
||||
TRY(underlying_stream.set_blocking(false));
|
||||
auto tls_socket = make<TLSv12>(&underlying_stream, move(options));
|
||||
|
|
|
@ -310,7 +310,7 @@ struct Context {
|
|||
|
||||
struct {
|
||||
// Server Name Indicator
|
||||
String SNI; // I hate your existence
|
||||
DeprecatedString SNI; // I hate your existence
|
||||
} extensions;
|
||||
|
||||
u8 request_client_certificate { 0 };
|
||||
|
@ -326,9 +326,9 @@ struct Context {
|
|||
// message flags
|
||||
u8 handshake_messages[11] { 0 };
|
||||
ByteBuffer user_data;
|
||||
HashMap<String, Certificate> root_certificates;
|
||||
HashMap<DeprecatedString, Certificate> root_certificates;
|
||||
|
||||
Vector<String> alpn;
|
||||
Vector<DeprecatedString> alpn;
|
||||
StringView negotiated_alpn;
|
||||
|
||||
size_t send_retries { 0 };
|
||||
|
@ -386,8 +386,8 @@ public:
|
|||
|
||||
virtual void set_notifications_enabled(bool enabled) override { underlying_stream().set_notifications_enabled(enabled); }
|
||||
|
||||
static ErrorOr<NonnullOwnPtr<TLSv12>> connect(String const& host, u16 port, Options = {});
|
||||
static ErrorOr<NonnullOwnPtr<TLSv12>> connect(String const& host, Core::Stream::Socket& underlying_stream, Options = {});
|
||||
static ErrorOr<NonnullOwnPtr<TLSv12>> connect(DeprecatedString const& host, u16 port, Options = {});
|
||||
static ErrorOr<NonnullOwnPtr<TLSv12>> connect(DeprecatedString const& host, Core::Stream::Socket& underlying_stream, Options = {});
|
||||
|
||||
using StreamVariantType = Variant<OwnPtr<Core::Stream::Socket>, Core::Stream::Socket*>;
|
||||
explicit TLSv12(StreamVariantType, Options);
|
||||
|
@ -438,7 +438,7 @@ public:
|
|||
|
||||
bool can_read_line() const { return m_context.application_buffer.size() && memchr(m_context.application_buffer.data(), '\n', m_context.application_buffer.size()); }
|
||||
bool can_read() const { return m_context.application_buffer.size() > 0; }
|
||||
String read_line(size_t max_size);
|
||||
DeprecatedString read_line(size_t max_size);
|
||||
|
||||
Function<void(AlertDescription)> on_tls_error;
|
||||
Function<void()> on_tls_finished;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue