11 #include "utils/HttpRangeUtils.h"    20 #include <microhttpd.h>    21 #include <sys/select.h>    22 #include <sys/socket.h>    23 #include <sys/types.h>    25 #if MHD_VERSION >= 0x00097002    26 using MHD_RESULT = MHD_Result;
    28 using MHD_RESULT = int;
    42 HTTPMethod GetHTTPMethod(
const char *method);
    43 std::string GetHTTPMethod(HTTPMethod method);
    45 typedef enum HTTPResponseType
    55   HTTPMemoryDownloadNoFreeNoCopy,
    57   HTTPMemoryDownloadNoFreeCopy,
    60   HTTPMemoryDownloadFreeNoCopy,
    63   HTTPMemoryDownloadFreeCopy
    69   struct MHD_Connection *connection;
    70   std::string pathUrlFull;
    78   HTTPResponseType type;
    80   std::multimap<std::string, std::string> headers;
    81   std::string contentType;
   116   virtual bool CanHandleRequest(
const HTTPRequest &request) 
const = 0;
   123   virtual MHD_RESULT HandleRequest() = 0;
   198   bool HasResponseHeader(
const std::string &field) 
const;
   208   bool AddResponseHeader(
const std::string &field, 
const std::string &value, 
bool allowMultiple = 
false);
   221   void AddPostField(
const std::string &key, 
const std::string &value);
   228   bool AddPostData(
const char *data, 
size_t size);
   234   virtual bool appendPostData(
const char *data, 
size_t size)
   237   bool GetRequestedRanges(uint64_t totalLength);
   238   bool GetHostnameAndPort(std::string& hostname, uint16_t &port);
   243   std::map<std::string, std::string> m_postFields;
   246   bool m_ranged = 
false;
 void SetRequestRanged(bool ranged)
Sets whether the HTTP request contains ranges or not. 
Definition: IHTTPRequestHandler.h:183
Definition: IHTTPRequestHandler.h:66
virtual bool GetLastModifiedDate(CDateTime &lastModified) const
Returns the last modification date of the response data. 
Definition: IHTTPRequestHandler.h:147
Definition: WebServer.h:25
virtual int GetPriority() const
Returns the priority of the HTTP request handler. 
Definition: IHTTPRequestHandler.h:108
virtual std::string GetRedirectUrl() const
Returns the URL to which the request should be redirected. 
Definition: IHTTPRequestHandler.h:161
virtual int GetMaximumAgeForCaching() const
Returns the maximum age (in seconds) for which the response can be cached. 
Definition: IHTTPRequestHandler.h:140
const HTTPResponseDetails & GetResponseDetails() const
Returns the HTTP response header details. 
Definition: IHTTPRequestHandler.h:213
virtual std::string GetResponseFile() const
Returns the path to the file that should be returned as the response. 
Definition: IHTTPRequestHandler.h:168
Definition: IHTTPRequestHandler.h:77
Definition: HttpRangeUtils.h:68
const HTTPRequest & GetRequest() const
Returns the HTTP request handled by the HTTP request handler. 
Definition: IHTTPRequestHandler.h:173
DateTime class, which uses FileTime as it's base. 
Definition: XBDateTime.h:63
virtual bool CanBeCached() const
Whether the HTTP response can be cached. 
Definition: IHTTPRequestHandler.h:133
virtual bool CanHandleRanges() const
Whether the HTTP response could also be provided in ranges. 
Definition: IHTTPRequestHandler.h:128
bool IsRequestRanged() const
Returns true if the HTTP request is ranged, otherwise false. 
Definition: IHTTPRequestHandler.h:178
virtual HttpResponseRanges GetResponseData() const
Returns the ranges with raw data belonging to the response. 
Definition: IHTTPRequestHandler.h:154
void SetResponseStatus(int status)
Sets the response status of the HTTP response. 
Definition: IHTTPRequestHandler.h:190
Definition: IHTTPRequestHandler.h:85