Source release 19.3.0
This commit is contained in:
@@ -1,22 +1,23 @@
|
||||
// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
|
||||
// source code may only be used and distributed under the Widevine License
|
||||
// Agreement.
|
||||
|
||||
#ifndef CDM_TEST_URL_REQUEST_H_
|
||||
#define CDM_TEST_URL_REQUEST_H_
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "disallow_copy_and_assign.h"
|
||||
#include "http_socket.h"
|
||||
#include "wv_class_utils.h"
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
// Provides simple HTTP request and response service.
|
||||
// Only POST request method is implemented.
|
||||
class UrlRequest {
|
||||
public:
|
||||
UrlRequest() = delete;
|
||||
WVCDM_DISALLOW_COPY_AND_MOVE(UrlRequest);
|
||||
|
||||
explicit UrlRequest(const std::string& url);
|
||||
~UrlRequest();
|
||||
|
||||
@@ -29,7 +30,8 @@ class UrlRequest {
|
||||
bool GetResponse(std::string* message);
|
||||
static int GetStatusCode(const std::string& response);
|
||||
// Get the response, and expect the status is OK.
|
||||
void AssertOkResponse(std::string* message);
|
||||
// It will retry if the response code is in the 500 range.
|
||||
void AssertOkResponseWithRetry(std::string* message);
|
||||
|
||||
static bool GetDebugHeaderFields(
|
||||
const std::string& response,
|
||||
@@ -37,13 +39,11 @@ class UrlRequest {
|
||||
|
||||
private:
|
||||
bool PostRequestWithPath(const std::string& path, const std::string& data);
|
||||
bool SendRequestOnce();
|
||||
|
||||
bool is_connected_;
|
||||
HttpSocket socket_;
|
||||
|
||||
CORE_DISALLOW_COPY_AND_ASSIGN(UrlRequest);
|
||||
};
|
||||
|
||||
std::string request_;
|
||||
}; // class UrlRequest
|
||||
} // namespace wvcdm
|
||||
|
||||
#endif // CDM_TEST_URL_REQUEST_H_
|
||||
|
||||
Reference in New Issue
Block a user