diff options
author | Linus Groh <mail@linusgroh.de> | 2022-12-04 18:02:33 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-12-06 08:54:33 +0100 |
commit | 6e19ab2bbce0b113b628e6f8e9b5c0640053933e (patch) | |
tree | 372d21b2f5dcff112f5d0089559c6af5798680d4 /Userland/Libraries/LibTLS | |
parent | f74251606d74b504a1379ebb893fdb5529054ea5 (diff) | |
download | serenity-6e19ab2bbce0b113b628e6f8e9b5c0640053933e.zip |
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 :^)
Diffstat (limited to 'Userland/Libraries/LibTLS')
-rw-r--r-- | Userland/Libraries/LibTLS/Certificate.h | 18 | ||||
-rw-r--r-- | Userland/Libraries/LibTLS/HandshakeServer.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibTLS/Socket.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibTLS/TLSv12.h | 12 |
4 files changed, 21 insertions, 21 deletions
diff --git a/Userland/Libraries/LibTLS/Certificate.h b/Userland/Libraries/LibTLS/Certificate.h index 7996dcd2cd..fdab883c27 100644 --- a/Userland/Libraries/LibTLS/Certificate.h +++ b/Userland/Libraries/LibTLS/Certificate.h @@ -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()) { diff --git a/Userland/Libraries/LibTLS/HandshakeServer.cpp b/Userland/Libraries/LibTLS/HandshakeServer.cpp index 8696ece782..f2591bf86a 100644 --- a/Userland/Libraries/LibTLS/HandshakeServer.cpp +++ b/Userland/Libraries/LibTLS/HandshakeServer.cpp @@ -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); diff --git a/Userland/Libraries/LibTLS/Socket.cpp b/Userland/Libraries/LibTLS/Socket.cpp index e8f7c76e0f..1cffd09f04 100644 --- a/Userland/Libraries/LibTLS/Socket.cpp +++ b/Userland/Libraries/LibTLS/Socket.cpp @@ -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)); diff --git a/Userland/Libraries/LibTLS/TLSv12.h b/Userland/Libraries/LibTLS/TLSv12.h index a145d86ed8..c0bfb040ba 100644 --- a/Userland/Libraries/LibTLS/TLSv12.h +++ b/Userland/Libraries/LibTLS/TLSv12.h @@ -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; |