diff options
| author | lijia <[email protected]> | 2024-07-17 14:27:15 +0800 |
|---|---|---|
| committer | lijia <[email protected]> | 2024-07-18 09:54:56 +0800 |
| commit | c4c7aa89bf01b321f5b582d84b684171e6dbcf66 (patch) | |
| tree | 37678010c572f18f5d439101a40cc1f832e0154a /include | |
| parent | b1548c7c6dc2198a4df20b11ce8eb72e766f56b7 (diff) | |
Add BODY_START message; add http_url_decode(); disable CONNECT tunnel.HEADv2.0.4dev-on-stellar2.0
Diffstat (limited to 'include')
| -rw-r--r-- | include/http_decoder.h | 51 |
1 files changed, 20 insertions, 31 deletions
diff --git a/include/http_decoder.h b/include/http_decoder.h index 7439016..ba00ab7 100644 --- a/include/http_decoder.h +++ b/include/http_decoder.h @@ -6,24 +6,27 @@ extern "C" #endif #include <bits/types/struct_iovec.h> -typedef struct iovec hstring; +struct http_message; +#define HTTP_DECODER_TOPIC "HTTP_DECODER_MESSAGE" enum http_message_type { - HTTP_TRANSACTION_NEW, + HTTP_TRANSACTION_START, - HTTP_MESSAGE_REQ_LINE, + HTTP_MESSAGE_REQ_LINE, HTTP_MESSAGE_REQ_HEADER, HTTP_MESSAGE_REQ_HEADER_END, + HTTP_MESSAGE_REQ_BODY_START, HTTP_MESSAGE_REQ_BODY, HTTP_MESSAGE_REQ_BODY_END, HTTP_MESSAGE_RES_LINE, HTTP_MESSAGE_RES_HEADER, HTTP_MESSAGE_RES_HEADER_END, + HTTP_MESSAGE_RES_BODY_START, HTTP_MESSAGE_RES_BODY, HTTP_MESSAGE_RES_BODY_END, - HTTP_TRANSACTION_FREE, + HTTP_TRANSACTION_END, HTTP_MESSAGE_MAX }; @@ -49,18 +52,18 @@ struct http_response_line { int status_code; }; -struct http_message; -#define HTTP_DECODER_TOPIC "HTTP_DECODER_MESSAGE" +typedef struct iovec hstring; enum http_message_type http_message_type_get(const struct http_message *msg); -void http_message_get_request_line(const struct http_message *msg, struct http_request_line *line); +void http_message_request_line_get0(const struct http_message *msg, struct http_request_line *line); + +void http_message_response_line_get0(const struct http_message *msg, struct http_response_line *line); -void http_message_get_response_line(const struct http_message *msg, struct http_response_line *line); /* -* Pay attention: key->str is case-insensitive. +* Pay attention: key->iov_base is case-insensitive. */ -void http_message_get_header(const struct http_message *msg, const struct iovec *key, struct http_header *hdr_result); +void http_message_header_get0(const struct http_message *msg, const struct iovec *key, struct http_header *hdr_result); /** * @brief loop reading all headers. @@ -74,38 +77,24 @@ int http_message_header_next(const struct http_message *msg, struct http_header */ int http_message_reset_header_iter(struct http_message *msg); -void http_message_get_raw_body(const struct http_message *msg, struct iovec *body); +void http_message_raw_body_get0(const struct http_message *msg, struct iovec *body); /** - * @brief If the body hasn't been compressed, same as http_message_get_raw_body(). + * @brief If the body hasn't been compressed, same as http_message_raw_body_get0(). * */ -void http_message_get_decompress_body(const struct http_message *msg, struct iovec *body); +void http_message_decompress_body_get0(const struct http_message *msg, struct iovec *body); -void http_message_get_url(const struct http_message *msg, struct iovec *url); +//raw +void http_message_raw_url_get0(const struct http_message *msg, struct iovec *url); + +void http_message_decoded_url_get0(const struct http_message *msg, struct iovec *url); /** * @retval succeed( >= 0) failed(-1) */ int http_message_get_transaction_seq(const struct http_message *msg); - - -/************************************************************ -* HTTP TUNNEL WITH CONNECT METHOD. -*************************************************************/ -struct http_tunnel_message; -#define HTTP_DECODER_TUNNEL_TOPIC "HTTP_DECODER_TUNNEL_MESSAGE" - -enum http_tunnel_message_type { - HTTP_TUNNEL_OPENING, - HTTP_TUNNEL_ACTIVE, - HTTP_TUNNEL_CLOSING, - HTTP_TUNNEL_MSG_MAX -}; -enum http_tunnel_message_type http_tunnel_message_type_get(const struct http_tunnel_message *tmsg); -void http_tunnel_message_get_payload(const struct http_tunnel_message *tmsg, struct iovec *tunnel_payload); - #ifdef __cplusplus } #endif |
