| Index: net/websockets/websocket_basic_handshake_stream.cc
|
| diff --git a/net/websockets/websocket_basic_handshake_stream.cc b/net/websockets/websocket_basic_handshake_stream.cc
|
| index 6c5e849996a36a85725f47ed09e437a40b8c8e70..470ccdc52967e4fc90abb26c42462dc763d7946e 100644
|
| --- a/net/websockets/websocket_basic_handshake_stream.cc
|
| +++ b/net/websockets/websocket_basic_handshake_stream.cc
|
| @@ -69,10 +69,8 @@ std::string MissingHeaderMessage(const std::string& header_name) {
|
| }
|
|
|
| std::string MultipleHeaderValuesMessage(const std::string& header_name) {
|
| - return
|
| - std::string("'") +
|
| - header_name +
|
| - "' header must not appear more than once in a response";
|
| + return std::string("'") + header_name +
|
| + "' header must not appear more than once in a response";
|
| }
|
|
|
| std::string GenerateHandshakeChallenge() {
|
| @@ -125,15 +123,13 @@ bool ValidateUpgrade(const HttpResponseHeaders* headers,
|
| std::string value;
|
| GetHeaderResult result =
|
| GetSingleHeaderValue(headers, websockets::kUpgrade, &value);
|
| - if (!ValidateHeaderHasSingleValue(result,
|
| - websockets::kUpgrade,
|
| - failure_message)) {
|
| + if (!ValidateHeaderHasSingleValue(
|
| + result, websockets::kUpgrade, failure_message)) {
|
| return false;
|
| }
|
|
|
| if (!LowerCaseEqualsASCII(value, websockets::kWebSocketLowercase)) {
|
| - *failure_message =
|
| - "'Upgrade' header value is not 'WebSocket': " + value;
|
| + *failure_message = "'Upgrade' header value is not 'WebSocket': " + value;
|
| return false;
|
| }
|
| return true;
|
| @@ -145,9 +141,8 @@ bool ValidateSecWebSocketAccept(const HttpResponseHeaders* headers,
|
| std::string actual;
|
| GetHeaderResult result =
|
| GetSingleHeaderValue(headers, websockets::kSecWebSocketAccept, &actual);
|
| - if (!ValidateHeaderHasSingleValue(result,
|
| - websockets::kSecWebSocketAccept,
|
| - failure_message)) {
|
| + if (!ValidateHeaderHasSingleValue(
|
| + result, websockets::kSecWebSocketAccept, failure_message)) {
|
| return false;
|
| }
|
|
|
| @@ -203,16 +198,14 @@ bool ValidateSubProtocol(
|
| MultipleHeaderValuesMessage(websockets::kSecWebSocketProtocol);
|
| return false;
|
| } else if (count > 0 && requested_sub_protocols.size() == 0) {
|
| - *failure_message =
|
| - std::string("Response must not include 'Sec-WebSocket-Protocol' "
|
| - "header if not present in request: ")
|
| - + value;
|
| + *failure_message = std::string(
|
| + "Response must not include 'Sec-WebSocket-Protocol' "
|
| + "header if not present in request: ") +
|
| + value;
|
| return false;
|
| } else if (has_invalid_protocol) {
|
| - *failure_message =
|
| - "'Sec-WebSocket-Protocol' header value '" +
|
| - value +
|
| - "' in response does not match any of sent values";
|
| + *failure_message = "'Sec-WebSocket-Protocol' header value '" + value +
|
| + "' in response does not match any of sent values";
|
| return false;
|
| } else if (requested_sub_protocols.size() > 0 && count == 0) {
|
| *failure_message =
|
| @@ -246,7 +239,8 @@ bool ValidatePerMessageDeflateExtension(const WebSocketExtension& extension,
|
| const ParameterVector& parameters = extension.parameters();
|
| std::set<std::string> seen_names;
|
| for (ParameterVector::const_iterator it = parameters.begin();
|
| - it != parameters.end(); ++it) {
|
| + it != parameters.end();
|
| + ++it) {
|
| const std::string& name = it->name();
|
| if (seen_names.count(name) != 0) {
|
| return DeflateError(
|
| @@ -303,7 +297,7 @@ bool ValidateExtensions(const HttpResponseHeaders* headers,
|
| // code.
|
| bool seen_permessage_deflate = false;
|
| while (headers->EnumerateHeader(
|
| - &state, websockets::kSecWebSocketExtensions, &value)) {
|
| + &state, websockets::kSecWebSocketExtensions, &value)) {
|
| WebSocketExtensionParser parser;
|
| parser.Parse(value);
|
| if (parser.has_error()) {
|
| @@ -324,10 +318,9 @@ bool ValidateExtensions(const HttpResponseHeaders* headers,
|
| parser.extension(), failure_message, params))
|
| return false;
|
| } else {
|
| - *failure_message =
|
| - "Found an unsupported extension '" +
|
| - parser.extension().name() +
|
| - "' in 'Sec-WebSocket-Extensions' header";
|
| + *failure_message = "Found an unsupported extension '" +
|
| + parser.extension().name() +
|
| + "' in 'Sec-WebSocket-Extensions' header";
|
| return false;
|
| }
|
| accepted_extensions.push_back(value);
|
| @@ -348,9 +341,11 @@ WebSocketBasicHandshakeStream::WebSocketBasicHandshakeStream(
|
| connect_delegate_(connect_delegate),
|
| http_response_info_(NULL),
|
| requested_sub_protocols_(requested_sub_protocols),
|
| - requested_extensions_(requested_extensions) {}
|
| + requested_extensions_(requested_extensions) {
|
| +}
|
|
|
| -WebSocketBasicHandshakeStream::~WebSocketBasicHandshakeStream() {}
|
| +WebSocketBasicHandshakeStream::~WebSocketBasicHandshakeStream() {
|
| +}
|
|
|
| int WebSocketBasicHandshakeStream::InitializeStream(
|
| const HttpRequestInfo* request_info,
|
| @@ -482,7 +477,9 @@ void WebSocketBasicHandshakeStream::GetSSLCertRequestInfo(
|
| parser()->GetSSLCertRequestInfo(cert_request_info);
|
| }
|
|
|
| -bool WebSocketBasicHandshakeStream::IsSpdyHttpStream() const { return false; }
|
| +bool WebSocketBasicHandshakeStream::IsSpdyHttpStream() const {
|
| + return false;
|
| +}
|
|
|
| void WebSocketBasicHandshakeStream::Drain(HttpNetworkSession* session) {
|
| HttpResponseBodyDrainer* drainer = new HttpResponseBodyDrainer(this);
|
| @@ -603,9 +600,8 @@ int WebSocketBasicHandshakeStream::ValidateUpgradeResponse(
|
| const HttpResponseHeaders* headers) {
|
| extension_params_.reset(new WebSocketExtensionParams);
|
| if (ValidateUpgrade(headers, &failure_message_) &&
|
| - ValidateSecWebSocketAccept(headers,
|
| - handshake_challenge_response_,
|
| - &failure_message_) &&
|
| + ValidateSecWebSocketAccept(
|
| + headers, handshake_challenge_response_, &failure_message_) &&
|
| ValidateConnection(headers, &failure_message_) &&
|
| ValidateSubProtocol(headers,
|
| requested_sub_protocols_,
|
|
|