Files
iptv-downloader/http.h
T

32 lines
843 B
C
Raw Normal View History

#pragma once
#include "buf.h"
typedef struct {
char method[8];
char path[256];
char query[1024];
char body[65536];
int body_len;
} Req;
/* Template globals — initialised by http_load_templates() */
extern char *g_header;
extern int g_header_len;
extern char *g_footer;
extern int g_footer_len;
extern char *g_css;
extern int g_css_len;
/* Static JS files served verbatim */
typedef struct { const char *url_path; const char *fs_name; char *data; int len; } StaticJS;
extern StaticJS g_js[];
int http_load_templates(void);
int parse_request(int fd, Req *req);
void send_page(int fd, const char *title, Buf *body, const char *script_src);
void send_css(int fd);
void send_static_js(int fd, const char *path);
void send_json(int fd, const char *json);
void send_json_buf(int fd, Buf *b);
void send_404(int fd);