Shaka Packager SDK
http_key_fetcher.h
1 // Copyright 2014 Google LLC. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #ifndef PACKAGER_MEDIA_BASE_HTTP_KEY_FETCHER_H_
8 #define PACKAGER_MEDIA_BASE_HTTP_KEY_FETCHER_H_
9 
10 #include <string>
11 
12 #include <packager/file/http_file.h>
13 #include <packager/macros/classes.h>
14 #include <packager/media/base/key_fetcher.h>
15 #include <packager/status.h>
16 
17 namespace shaka {
18 namespace media {
19 
25 class HttpKeyFetcher : public KeyFetcher {
26  public:
31  HttpKeyFetcher(int32_t timeout_in_seconds);
32  ~HttpKeyFetcher() override;
33 
35  Status FetchKeys(const std::string& url,
36  const std::string& request,
37  std::string* response) override;
38 
44  virtual Status Get(const std::string& url, std::string* response);
45 
51  virtual Status Post(const std::string& url,
52  const std::string& data,
53  std::string* response);
54 
55  private:
56  Status FetchInternal(HttpMethod method, const std::string& url,
57  const std::string& data, std::string* response);
58 
59  const int32_t timeout_in_seconds_;
60 
61  DISALLOW_COPY_AND_ASSIGN(HttpKeyFetcher);
62 };
63 
64 } // namespace media
65 } // namespace shaka
66 
67 #endif // PACKAGER_MEDIA_BASE_HTTP_KEY_FETCHER_H_
HttpKeyFetcher()
Creates a fetcher with no timeout.
virtual Status Post(const std::string &url, const std::string &data, std::string *response)
virtual Status Get(const std::string &url, std::string *response)
Status FetchKeys(const std::string &url, const std::string &request, std::string *response) override
Base class for fetching keys from the license service.
Definition: key_fetcher.h:17
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66