X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fhttp.h;fp=src%2Flibgame%2Fhttp.h;h=b002ec65b48a39a158bd8e4bffd202bf676423bb;hb=dde5b6f0ddf3293cea59da9ef623ff0f7c94b5c9;hp=0000000000000000000000000000000000000000;hpb=195333e38da4b8195579937eb048cc9e55e9393c;p=rocksndiamonds.git diff --git a/src/libgame/http.h b/src/libgame/http.h new file mode 100644 index 00000000..b002ec65 --- /dev/null +++ b/src/libgame/http.h @@ -0,0 +1,49 @@ +// ============================================================================ +// Artsoft Retro-Game Library +// ---------------------------------------------------------------------------- +// (c) 1995-2021 by Artsoft Entertainment +// Holger Schemel +// info@artsoft.org +// https://www.artsoft.org/ +// ---------------------------------------------------------------------------- +// http.h +// ============================================================================ + +#ifndef HTTP_H +#define HTTP_H + +#include "system.h" + +#define MAX_HTTP_HEAD_SIZE 4096 +#define MAX_HTTP_BODY_SIZE 1048576 +#define MAX_HTTP_ERROR_SIZE 1024 + +#define HTTP_SUCCESS(c) ((c) >= 200 && (c) < 300) + + +struct HttpRequest +{ + char head[MAX_HTTP_HEAD_SIZE + 1]; + char body[MAX_HTTP_BODY_SIZE + 1]; + + char *hostname; + int port; + char *method; + char *uri; +}; + +struct HttpResponse +{ + char head[MAX_HTTP_HEAD_SIZE + 1]; + char body[MAX_HTTP_BODY_SIZE + 1]; + int body_size; + + int status_code; + char status_text[MAX_HTTP_ERROR_SIZE + 1]; +}; + + +char *GetHttpError(void); +boolean DoHttpRequest(struct HttpRequest *, struct HttpResponse *); + +#endif