diff --git a/third_party/crashpad/crashpad/util/net/http_transport.h b/third_party/crashpad/crashpad/util/net/http_transport.h index f91a556..acd4e44 100644 --- a/third_party/crashpad/crashpad/util/net/http_transport.h +++ b/third_party/crashpad/crashpad/util/net/http_transport.h @@ -90,7 +90,7 @@ //! if the response body is not required. //! //! \return Whether or not the request was successful, defined as returning - //! a HTTP status 200 (OK) code. + //! a HTTP status code in the range 200-203 (inclusive). virtual bool ExecuteSynchronously(std::string* response_body) = 0; protected: diff --git a/third_party/crashpad/crashpad/util/net/http_transport_mac.mm b/third_party/crashpad/crashpad/util/net/http_transport_mac.mm index 8d5f78c..a433bb3 100644 --- a/third_party/crashpad/crashpad/util/net/http_transport_mac.mm +++ b/third_party/crashpad/crashpad/util/net/http_transport_mac.mm @@ -293,7 +293,7 @@ return false; } NSInteger http_status = [http_response statusCode]; - if (http_status != 200) { + if (http_status < 200 || http_status > 203) { LOG(ERROR) << base::StringPrintf("HTTP status %ld", implicit_cast(http_status)); return false; diff --git a/third_party/crashpad/crashpad/util/net/http_transport_socket.cc b/third_party/crashpad/crashpad/util/net/http_transport_socket.cc index f0e2dc14a8a4..34d8deeb5c25 100644 --- a/third_party/crashpad/crashpad/util/net/http_transport_socket.cc +++ b/third_party/crashpad/crashpad/util/net/http_transport_socket.cc @@ -457,10 +457,18 @@ bool ReadResponseLine(Stream* stream) { LOG(ERROR) << "ReadLine"; return false; } - static constexpr const char kHttp10[] = "HTTP/1.0 200 "; - static constexpr const char kHttp11[] = "HTTP/1.1 200 "; - return StartsWith(response_line, kHttp10, strlen(kHttp10)) || - StartsWith(response_line, kHttp11, strlen(kHttp11)); + static constexpr const char kHttp10[] = "HTTP/1.0 "; + static constexpr const char kHttp11[] = "HTTP/1.1 "; + if (!(StartsWith(response_line, kHttp10, strlen(kHttp10)) || + StartsWith(response_line, kHttp11, strlen(kHttp11))) || + response_line.size() < strlen(kHttp10) + 3 || + response_line.at(strlen(kHttp10) + 3) != ' ') { + return false; + } + unsigned int http_status = 0; + return base::StringToUint(response_line.substr(strlen(kHttp10), 3), + &http_status) && + http_status >= 200 && http_status <= 203; } bool ReadResponseHeaders(Stream* stream, HTTPHeaders* headers) { diff --git a/third_party/crashpad/crashpad/util/net/http_transport_test.cc b/third_party/crashpad/crashpad/util/net/http_transport_test.cc index 7b5f41d..d73dc99 100644 --- a/third_party/crashpad/crashpad/util/net/http_transport_test.cc +++ b/third_party/crashpad/crashpad/util/net/http_transport_test.cc @@ -137,7 +137,7 @@ std::string response_body; bool success = transport->ExecuteSynchronously(&response_body); - if (response_code_ == 200) { + if (response_code_ >= 200 && response_code_ <= 203) { EXPECT_TRUE(success); std::string expect_response_body = random_string + "\r\n"; EXPECT_EQ(response_body, expect_response_body); diff --git a/third_party/crashpad/crashpad/util/net/http_transport_win.cc b/third_party/crashpad/crashpad/util/net/http_transport_win.cc index 18d343c..2919bc1 100644 --- a/third_party/crashpad/crashpad/util/net/http_transport_win.cc +++ b/third_party/crashpad/crashpad/util/net/http_transport_win.cc @@ -375,7 +375,7 @@ return false; } - if (status_code != 200) { + if (status_code < 200 || status_code > 203) { LOG(ERROR) << base::StringPrintf("HTTP status %lu", status_code); return false; }