Bug: 8790775 Merge of https://widevine-internal-review.googlesource.com/#/c/5381/ from the Widevine CDM repository. Change-Id: I749303eee8162f37982f6dd5d83b6cf254b96847
41 lines
1.0 KiB
C++
41 lines
1.0 KiB
C++
// Copyright 2013 Google Inc. All Rights Reserved.
|
|
|
|
#ifndef CDM_TEST_URL_REQUEST_H_
|
|
#define CDM_TEST_URL_REQUEST_H_
|
|
|
|
#include <string>
|
|
#include "http_socket.h"
|
|
#include "wv_cdm_types.h"
|
|
|
|
namespace wvcdm {
|
|
|
|
// Provides simple HTTP request and response service.
|
|
// Only POST request method is implemented.
|
|
class UrlRequest {
|
|
public:
|
|
UrlRequest(const std::string& url, const std::string& port);
|
|
~UrlRequest();
|
|
|
|
void AppendChunkToUpload(const std::string& data);
|
|
int GetResponse(std::string& response);
|
|
int GetStatusCode(const std::string& response);
|
|
bool is_connected() const { return is_connected_; }
|
|
bool PostRequest(const std::string& data);
|
|
bool PostCertRequestInQueryString(const std::string& data);
|
|
|
|
private:
|
|
static const unsigned int kHttpBufferSize = 4096;
|
|
char buffer_[kHttpBufferSize];
|
|
bool is_connected_;
|
|
std::string port_;
|
|
std::string request_;
|
|
HttpSocket socket_;
|
|
std::string server_url_;
|
|
|
|
CORE_DISALLOW_COPY_AND_ASSIGN(UrlRequest);
|
|
};
|
|
|
|
}; // namespace wvcdm
|
|
|
|
#endif // CDM_TEST_URL_REQUEST_H_
|