X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fhttpfetch.h;h=aba7482c2686339fc523976ec085f7cabfd13bcd;hb=58e6d25e033c76dc91aaac18fdeda92ac23fe0e1;hp=56a198baf0014773e1ddf9f2596e0cceb46c29ac;hpb=0ea3e6dbe2288854d9d4a971fc6539c2e740a95a;p=oweals%2Fminetest.git diff --git a/src/httpfetch.h b/src/httpfetch.h index 56a198baf..aba7482c2 100644 --- a/src/httpfetch.h +++ b/src/httpfetch.h @@ -22,11 +22,13 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include +#include #include "config.h" // Can be used in place of "caller" in asynchronous transfers to discard result // (used as default value of "caller") #define HTTPFETCH_DISCARD 0 +#define HTTPFETCH_SYNC 1 struct HTTPFetchRequest { @@ -46,22 +48,24 @@ struct HTTPFetchRequest // Timeout for the connection phase, in milliseconds long connect_timeout; - // POST data (should be application/x-www-form-urlencoded - // unless a Content-Type header is specified in extra_headers) + // Indicates if this is multipart/form-data or + // application/x-www-form-urlencoded. POST-only. + bool multipart; + + // POST fields. Fields are escaped properly. // If this is empty a GET request is done instead. - std::string post_fields; + std::map post_fields; + + // Raw POST data, overrides post_fields. + std::string post_data; // If not empty, should contain entries such as "Accept: text/html" std::vector extra_headers; - HTTPFetchRequest() - { - url = ""; - caller = HTTPFETCH_DISCARD; - request_id = 0; - timeout = 0; - connect_timeout = 0; - } + //useragent to use + std::string useragent; + + HTTPFetchRequest(); }; struct HTTPFetchResult @@ -93,6 +97,7 @@ struct HTTPFetchResult caller = fetchrequest.caller; request_id = fetchrequest.request_id; } + }; // Initializes the httpfetch module