summaryrefslogtreecommitdiff
path: root/event-httpd.h
blob: cb8779d665bb29326fa8b7cf8a6e7e8a3c741e8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (C) 2021 Russell King.
// Licensed under GPL version 2. See COPYING.
#ifndef MINI_HTTPD_H
#define MINI_HTTPD_H

struct client {
	GSocketConnection *conn;
	GDataInputStream *data;
	GOutputStream *out;
	GInputStream *in;

	gboolean forwarded;
	gboolean can_chunk;
	int error;
	const char *errstr;
	char *method;
	char *uri;
	char *query;
	char *version;

	struct resource *resource;
	void *resource_data;
};

void close_client(struct client *c);
void respond_header(struct client *c, int error_code, const char *reason,
		    const char *headers);
void respond_chunk(struct client *c, const GString *s);

#endif