-/* $OpenBSD: http.h,v 1.2 2014/07/13 14:17:37 reyk Exp $ */
+/* $OpenBSD: http.h,v 1.3 2014/07/13 15:11:23 reyk Exp $ */
/*
* Copyright (c) 2012 - 2014 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#ifndef _HTTPD_HTTP_H
-#define _HTTPD_HTTP_H
+#ifndef _HTTP_H
+#define _HTTP_H
enum httpmethod {
HTTP_METHOD_NONE = 0,
/* Used during runtime */
struct http_descriptor {
struct kv http_pathquery;
+ struct kv http_matchquery;
#define http_path http_pathquery.kv_key
#define http_query http_pathquery.kv_value
#define http_rescode http_pathquery.kv_key
#define http_resmesg http_pathquery.kv_value
+#define query_key http_matchquery.kv_key
+#define query_val http_matchquery.kv_value
char *http_version;
enum httpmethod http_method;
struct kv *http_lastheader;
};
-#endif /* _HTTPD_HTTP_H */
+#endif /* _HTTP_H */
-/* $OpenBSD: http.h,v 1.3 2014/07/12 14:34:13 reyk Exp $ */
+/* $OpenBSD: http.h,v 1.4 2014/07/13 15:11:23 reyk Exp $ */
/*
* Copyright (c) 2012 - 2014 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#ifndef _RELAYD_HTTP_H
-#define _RELAYD_HTTP_H
+#ifndef _HTTP_H
+#define _HTTP_H
enum httpmethod {
HTTP_METHOD_NONE = 0,
{ 0, NULL } \
}
+struct http_mediatype {
+ char *media_name;
+ char *media_type;
+ char *media_subtype;
+};
+/* Some default media types */
+#define MEDIA_TYPES { \
+ { "css", "text", "css" }, \
+ { "html", "text", "html" }, \
+ { "txt", "text", "plain" }, \
+ { "gif", "image", "gif" }, \
+ { "jpeg", "image", "jpeg" }, \
+ { "jpg", "image", "jpeg" }, \
+ { "png", "image", "png" }, \
+ { "js", "application", "javascript" }, \
+ { NULL } \
+}
+
/* Used during runtime */
struct http_descriptor {
struct kv http_pathquery;
struct kv *http_lastheader;
};
-#endif /* _RELAYD_HTTP_H */
+#endif /* _HTTP_H */