diff options
author | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-31 06:55:28 +0000 |
---|---|---|
committer | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-31 06:55:28 +0000 |
commit | 7f7bd7a6ecc23972b1c116afbfe8b9f86b02b77b (patch) | |
tree | 5ac69d0c8c335c4773d4d7292f27e42cd8793ecd /net/quic | |
parent | 9d60bda32310ebcebe6583c2c1303255e8607442 (diff) | |
download | chromium_src-7f7bd7a6ecc23972b1c116afbfe8b9f86b02b77b.zip chromium_src-7f7bd7a6ecc23972b1c116afbfe8b9f86b02b77b.tar.gz chromium_src-7f7bd7a6ecc23972b1c116afbfe8b9f86b02b77b.tar.bz2 |
Remove padding in the base64 encoding of a ChannelID because
base::Base64Encode always does padding.
Qualify 'string' with the std:: in a header file.
R=agl@chromium.org,rtenneti@chromium.org
BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/20656006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214601 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/quic')
-rw-r--r-- | net/quic/quic_crypto_server_stream.cc | 11 | ||||
-rw-r--r-- | net/quic/quic_crypto_server_stream.h | 4 |
2 files changed, 13 insertions, 2 deletions
diff --git a/net/quic/quic_crypto_server_stream.cc b/net/quic/quic_crypto_server_stream.cc index 6b74cc2..6f49864 100644 --- a/net/quic/quic_crypto_server_stream.cc +++ b/net/quic/quic_crypto_server_stream.cc @@ -109,6 +109,17 @@ bool QuicCryptoServerStream::GetBase64SHA256ClientChannelID( base::Base64Encode(string( reinterpret_cast<const char*>(digest), sizeof(digest)), output); + // Remove padding. + size_t len = output->size(); + if (len >= 2) { + if ((*output)[len - 1] == '=') { + len--; + if ((*output)[len - 1] == '=') { + len--; + } + output->resize(len); + } + } return true; } diff --git a/net/quic/quic_crypto_server_stream.h b/net/quic/quic_crypto_server_stream.h index e4a5a6e..f1e30cb 100644 --- a/net/quic/quic_crypto_server_stream.h +++ b/net/quic/quic_crypto_server_stream.h @@ -35,13 +35,13 @@ class NET_EXPORT_PRIVATE QuicCryptoServerStream : public QuicCryptoStream { // GetBase64SHA256ClientChannelID sets |*output| to the base64 encoded, // SHA-256 hash of the client's ChannelID key and returns true, if the client // presented a ChannelID. Otherwise it returns false. - bool GetBase64SHA256ClientChannelID(string* output) const; + bool GetBase64SHA256ClientChannelID(std::string* output) const; protected: virtual QuicErrorCode ProcessClientHello( const CryptoHandshakeMessage& message, CryptoHandshakeMessage* reply, - string* error_details); + std::string* error_details); const QuicCryptoServerConfig* crypto_config() { return &crypto_config_; } |