Shaka Packager SDK
Loading...
Searching...
No Matches
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 (int32_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 set_content_type (const std::string &content_type)
 
void set_extra_headers (const std::vector< std::string > &extra_headers)
 Sets extra HTTP headers, in "Name: value" form, to send with requests.
 

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 27 of file http_key_fetcher.h.

Constructor & Destructor Documentation

◆ HttpKeyFetcher() [1/2]

shaka::media::HttpKeyFetcher::HttpKeyFetcher ( )

Creates a fetcher with no timeout.

Definition at line 33 of file http_key_fetcher.cc.

◆ HttpKeyFetcher() [2/2]

shaka::media::HttpKeyFetcher::HttpKeyFetcher ( int32_t  timeout_in_seconds)

Create a fetcher with timeout.

Parameters
timeout_in_secondsspecifies the timeout in seconds.

Definition at line 35 of file http_key_fetcher.cc.

◆ ~HttpKeyFetcher()

shaka::media::HttpKeyFetcher::~HttpKeyFetcher ( )
override

Definition at line 38 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 40 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 46 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 50 of file http_key_fetcher.cc.

◆ set_content_type()

void shaka::media::HttpKeyFetcher::set_content_type ( const std::string &  content_type)
inline

Sets the request content type. If not set, the content type is derived from the request body (XML for SOAP requests, JSON otherwise).

Definition at line 59 of file http_key_fetcher.h.

◆ set_extra_headers()

void shaka::media::HttpKeyFetcher::set_extra_headers ( const std::vector< std::string > &  extra_headers)
inline

Sets extra HTTP headers, in "Name: value" form, to send with requests.

Definition at line 64 of file http_key_fetcher.h.


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