Audacity 3.2.0
Request.cpp
Go to the documentation of this file.
1/*!********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file Request.cpp
6 @brief Define a class for constructing HTTP requests.
7
8 Dmitry Vedenko
9 **********************************************************************/
10
11/*!********************************************************************
12
13 @class Request
14 @brief Class to construct the HTTP request.
15
16 **********************************************************************/
17
18#include "Request.h"
19
20#include <cctype>
21#include <algorithm>
22
23namespace audacity
24{
25namespace network_manager
26{
27
28
29Request::Request(std::string url) noexcept
30 : mUrl (std::move (url))
31{
32}
33
34Request& Request::setURL(std::string url) noexcept
35{
36 mUrl = std::move (url);
37
38 return *this;
39}
40
41const std::string& Request::getURL () const noexcept
42{
43 return mUrl;
44}
45
46Request& Request::setHeader (const std::string& name, std::string value)
47{
48 mHeaders.setHeader (name, std::move (value));
49
50 return *this;
51}
52
53std::string Request::getHeader (const std::string& name) const
54{
56}
57
58const HeadersList& Request::getHeaders () const noexcept
59{
60 return mHeaders;
61}
62
63Request& Request::setCookie (const std::string& name, std::string value)
64{
65 mCookies.setCookie (name, std::move (value));
66
67 return *this;
68}
69
70std::string Request::getCookie (const std::string& name) const
71{
73}
74
76{
77 return mCookies;
78}
79
80Request& Request::setMaxRedirects (size_t redirects) noexcept
81{
82 mMaxRedirects = redirects;
83
84 return *this;
85}
86
87size_t Request::getMaxRedirects () const noexcept
88{
89 return mMaxRedirects;
90}
91
93{
94 mTimeout = timeout;
95 return *this;
96}
97
99{
100 return mTimeout;
101}
102
104{
105 for (const Cookie& cookie : list)
106 {
107 if (!cookie.isExpired())
108 mCookies.setCookie (cookie);
109 }
110
111 return *this;
112}
113
114}
115}
Declare a class for constructing HTTP requests.
wxString name
Definition: TagsEditor.cpp:166
void setCookie(const Cookie &cookie)
std::string getCookieValue(const std::string &cookieName) const
void setHeader(const Header &header)
Definition: HeadersList.cpp:94
std::string getHeaderValue(const std::string &headerName) const
Timeout getTimeout() const noexcept
Definition: Request.cpp:98
std::string getCookie(const std::string &name) const
Definition: Request.cpp:70
const HeadersList & getHeaders() const noexcept
Definition: Request.cpp:58
Request & setTimeout(Timeout timeout) noexcept
Definition: Request.cpp:92
const CookiesList & getCookies() noexcept
Definition: Request.cpp:75
Request & appendCookies(const CookiesList &list)
Definition: Request.cpp:103
Request & setCookie(const std::string &name, std::string value)
Definition: Request.cpp:63
std::string getHeader(const std::string &name) const
Definition: Request.cpp:53
size_t getMaxRedirects() const noexcept
Definition: Request.cpp:87
std::chrono::milliseconds Timeout
Definition: Request.h:30
Request & setMaxRedirects(size_t redirects) noexcept
Definition: Request.cpp:80
Request & setURL(std::string url) noexcept
Definition: Request.cpp:34
const std::string & getURL() const noexcept
Definition: Request.cpp:41
Request & setHeader(const std::string &name, std::string value)
Definition: Request.cpp:46