Shaka Packager SDK
Public Member Functions | List of all members
shaka::media::HttpKeyFetcher Class Reference

#include <http_key_fetcher.h>

Inheritance diagram for shaka::media::HttpKeyFetcher:
shaka::media::KeyFetcher

Public Member Functions

 HttpKeyFetcher ()
 Creates a fetcher with no timeout.
 
 HttpKeyFetcher (uint32_t timeout_in_seconds)
 

KeyFetcher implementation overrides.

Status FetchKeys (const std::string &url, const std::string &request, std::string *response) override
 
virtual Status Get (const std::string &url, std::string *response)
 
virtual Status Post (const std::string &url, const std::string &data, std::string *response)
 
void SetClientCertInfo (const std::string &cert_file, const std::string &private_key_file, const std::string &private_key_password)
 
void SetCaFile (const std::string &ca_file)
 

Detailed Description

A KeyFetcher implementation that retrieves keys over HTTP(s). This class is not fully thread safe. It can be used in multi-thread environment once constructed, but it may not be safe to create a HttpKeyFetcher object when any other thread is running due to use of curl_global_init.

Definition at line 26 of file http_key_fetcher.h.

Constructor & Destructor Documentation

◆ HttpKeyFetcher()

shaka::media::HttpKeyFetcher::HttpKeyFetcher ( uint32_t  timeout_in_seconds)

Create a fetcher with timeout.

Parameters
timeout_in_secondsspecifies the timeout in seconds.

Definition at line 133 of file http_key_fetcher.cc.

Member Function Documentation

◆ FetchKeys()

Status shaka::media::HttpKeyFetcher::FetchKeys ( const std::string &  service_address,
const std::string &  request,
std::string *  response 
)
overridevirtual

Fetch Keys from license service. |response| is owned by caller.

Parameters
service_addresslicense service address.
requestJSON formatted request.
responseJSON formatted response. Owned by caller.
Returns
OK on success.

Implements shaka::media::KeyFetcher.

Definition at line 138 of file http_key_fetcher.cc.

◆ Get()

Status shaka::media::HttpKeyFetcher::Get ( const std::string &  url,
std::string *  response 
)
virtual

Fetch content using HTTP GET.

Parameters
urlspecifies the content URL.
[out]responsewill contain the body of the http response on success. It should not be NULL.
Returns
OK on success.

Definition at line 144 of file http_key_fetcher.cc.

◆ Post()

Status shaka::media::HttpKeyFetcher::Post ( const std::string &  url,
const std::string &  data,
std::string *  response 
)
virtual

Fetch content using HTTP POST.

Parameters
urlspecifies the content URL.
[out]responsewill contain the body of the http response on success. It should not be NULL.
Returns
OK on success.

Definition at line 148 of file http_key_fetcher.cc.

◆ SetCaFile()

void shaka::media::HttpKeyFetcher::SetCaFile ( const std::string &  ca_file)
inline

Sets the Certifiate Authority file information for http requests.

Parameters
ca_fileabsolute path to the client certificate

Definition at line 70 of file http_key_fetcher.h.

◆ SetClientCertInfo()

void shaka::media::HttpKeyFetcher::SetClientCertInfo ( const std::string &  cert_file,
const std::string &  private_key_file,
const std::string &  private_key_password 
)
inline

Sets client certificate information for http requests.

Parameters
cert_fileabsolute path to the client certificate.
private_key_fileabsolute path to the client certificate private key file.
private_key_passwordprivate key password.

Definition at line 61 of file http_key_fetcher.h.


The documentation for this class was generated from the following files: