tinywebd

diff src/http.h @ 5:def49a046566

serialization of responses
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 17 Apr 2015 01:57:00 +0300
parents 852a745503cf
children 5ec50ca0d071
line diff
     1.1 --- a/src/http.h	Thu Apr 16 17:34:15 2015 +0300
     1.2 +++ b/src/http.h	Fri Apr 17 01:57:00 2015 +0300
     1.3 @@ -24,6 +24,13 @@
     1.4  	int body_offset;
     1.5  };
     1.6  
     1.7 +struct http_resp_header {
     1.8 +	int status;
     1.9 +	int ver_major, ver_minor;
    1.10 +	char **fields;
    1.11 +	int num_fields;
    1.12 +};
    1.13 +
    1.14  #define HTTP_HDR_OK			0
    1.15  #define HTTP_HDR_INVALID	-1
    1.16  #define HTTP_HDR_NOMEM		-2
    1.17 @@ -33,6 +40,11 @@
    1.18  void http_print_header(struct http_req_header *hdr);
    1.19  void http_destroy_header(struct http_req_header *hdr);
    1.20  
    1.21 +int http_init_resp(struct http_resp_header *resp);
    1.22 +int http_add_resp_field(struct http_resp_header *resp, const char *fmt, ...);
    1.23 +void http_destroy_resp(struct http_resp_header *resp);
    1.24 +int http_serialize_resp(struct http_resp_header *resp, char *buf);
    1.25 +
    1.26  const char *http_strmsg(int code);
    1.27  
    1.28  #endif	/* HTTP_H_ */