aboutsummaryrefslogtreecommitdiff
path: root/src/supplemental/http/http_msg.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/supplemental/http/http_msg.h')
-rw-r--r--src/supplemental/http/http_msg.h33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/supplemental/http/http_msg.h b/src/supplemental/http/http_msg.h
index 7d9e7dcf..e08dab8a 100644
--- a/src/supplemental/http/http_msg.h
+++ b/src/supplemental/http/http_msg.h
@@ -22,36 +22,45 @@ typedef struct http_header {
char *name;
char *value;
nni_list_node node;
+ bool static_name : 1; // name is static, do not free it
+ bool static_value : 1; // value is static, do not free it
+ bool alloc_header : 1; // header is heap allocated
} http_header;
+typedef struct http_header nni_http_header;
typedef struct nni_http_entity {
- char *data;
- size_t size; // allocated/expected size
- size_t len; // current length
- bool own; // if true, data is "ours", and should be freed
+ char *data;
+ size_t size;
+ bool own; // if true, data is "ours", and should be freed
+ char clen[24]; // 64-bit lengths, in decimal
+ char ctype[128]; // 63+63+; per RFC 6838
+ http_header content_type;
+ http_header content_length;
+ nni_list hdrs;
+ char *buf;
+ size_t bufsz;
+ bool parsed;
} nni_http_entity;
struct nng_http_req {
- nni_list hdrs;
nni_http_entity data;
char meth[32];
+ char host[260]; // 253 per IETF, plus 6 for :port plus null
+ char ubuf[200]; // Most URIs are smaller than this
char *uri;
const char *vers;
- char *buf;
- size_t bufsz;
- bool parsed;
+ http_header host_header;
};
struct nng_http_res {
- nni_list hdrs;
nni_http_entity data;
uint16_t code;
char *rsn;
const char *vers;
- char *buf;
- size_t bufsz;
- bool parsed;
bool iserr;
+ http_header location;
};
+extern void nni_http_free_header(http_header *);
+
#endif