30#include <sptk5/RegularExpression.h>
31#include <sptk5/Strings.h>
32#include <sptk5/net/HttpParams.h>
33#include <sptk5/net/HttpReader.h>
34#include <sptk5/net/TCPSocket.h>
152 return m_requestHeaders;
164 return m_reader->getHttpHeaders();
180 std::chrono::milliseconds timeout = std::chrono::seconds(60));
197 std::chrono::milliseconds timeout = std::chrono::seconds(60));
213 std::chrono::milliseconds timeout = std::chrono::seconds(60));
228 std::chrono::milliseconds timeout = std::chrono::seconds(60));
286 std::shared_ptr<HttpReader> m_reader;
296 HttpHeaders m_requestHeaders;
Definition: HttpConnect.h:56
Authorization & operator=(const Authorization &other)=default
String method() const
Definition: HttpConnect.h:74
Authorization(const String &method, const String &username, const String &password, const String &jwtToken)
String value() const
Definition: HttpConnect.h:83
Authorization(const Authorization &other)=default
Definition: HttpConnect.h:109
BasicAuthorization(const String &username, const String &password)
Definition: HttpConnect.h:116
Definition: HttpConnect.h:123
BearerAuthorization(const String &jwtToken)
Definition: HttpConnect.h:129
HTTP socket.
Definition: HttpConnect.h:50
int cmd_get(const String &pageName, const HttpParams ¶meters, Buffer &output, const Authorization *authorization=nullptr, std::chrono::milliseconds timeout=std::chrono::seconds(60))
Sends the GET command to the server.
int cmd_delete(const String &pageName, const HttpParams ¶meters, Buffer &output, const Authorization *authorization=nullptr, std::chrono::milliseconds timeout=std::chrono::seconds(60))
Sends the DELETE command to the server.
int cmd_post(const String &pageName, const HttpParams ¶meters, const Buffer &content, Buffer &output, const sptk::Strings &possibleContentEncodings, const Authorization *authorization=nullptr, std::chrono::milliseconds timeout=std::chrono::seconds(60))
Sends the POST command to the server.
HttpHeaders & requestHeaders()
Returns the HTTP request headers.
Definition: HttpConnect.h:150
const HttpHeaders & responseHeaders() const
Returns the HTTP headers.
Definition: HttpConnect.h:162
Strings makeHeaders(const String &httpCommand, const String &pageName, const HttpParams &requestParameters, const Authorization *authorization) const
int statusCode() const
Get the request execution status code.
String responseHeader(const String &headerName) const
Get value of response header.
void sendCommand(const Buffer &cmd)
Sends a single command to HTTP server.
String statusText() const
Get the request execution status text.
int cmd_put(const String &pageName, const HttpParams ¶meters, const Buffer &content, Buffer &output, const Authorization *authorization=nullptr, std::chrono::milliseconds timeout=std::chrono::seconds(60))
Sends the PUT command to the server.
void sendCommand(const String &cmd)
Sends a single command to HTTP server.
int getResponse(Buffer &output, std::chrono::milliseconds timeout)
Retrieves the server response on the command.
HttpConnect(TCPSocket &socket)
Constructor.
Definition: HttpParams.h:69
Definition: TCPSocket.h:165