X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fnet%2Fhttp.h;h=29fa27d6cca39a8ec41946fdf8d0502977f1764f;hb=ebdb6199fdf3a09932ea6da7b147ee9e19834078;hp=2b49c7f0b7dd7abbb084711842187df394f943ae;hpb=78635481e7180925345b59273ee7428a35c6dddc;p=bertos.git diff --git a/bertos/net/http.h b/bertos/net/http.h index 2b49c7f0..29fa27d6 100644 --- a/bertos/net/http.h +++ b/bertos/net/http.h @@ -44,6 +44,7 @@ #define NET_HTTP_H #include +#include typedef int (*http_handler_t)(struct netconn *client, const char *name, char *revc_buf, size_t revc_len); @@ -54,17 +55,34 @@ typedef struct HttpCGI http_handler_t handler; ///< Callback to process the special request } HttpCGI; +enum +{ + HTTP_CONTENT_JSON = 0, + HTTP_CONTENT_HTML, + HTTP_CONTENT_CSS, + HTTP_CONTENT_JS, + HTTP_CONTENT_PNG, + HTTP_CONTENT_JPEG, + HTTP_CONTENT_GIF, + HTTP_CONTENT_PLAIN, + + HTTP_CONTENT_CNT +}; #define CGI_MATCH_NONE 0 #define CGI_MATCH_WORD 1 ///< Select item in table only if string match #define CGI_MATCH_EXT 2 ///< Select item in table if the extention match #define CGI_MATCH_NAME 3 ///< Select item in table if the string is content -void http_getPageName(const char *revc_buf, size_t recv_len, char *page_name, size_t len); +int http_getValue(char *tolenized_buf, size_t tolenized_buf_len, const char *key, char *value, size_t len); +int http_tokenizeGetRequest(char *raw_buf, size_t raw_len); +void http_getPageName(const char *recv_buf, size_t recv_len, char *page_name, size_t len); +void http_decodeUrl(const char *raw_buf, size_t raw_len, char *decodec_buf, size_t len); +int http_searchContentType(const char *name); -void http_sendOk(struct netconn *client); -void http_sendFileNotFound(struct netconn *client); -void http_sendInternalErr(struct netconn *client); +void http_sendOk(struct netconn *client, int content_type); +void http_sendFileNotFound(struct netconn *client, int content_type); +void http_sendInternalErr(struct netconn *client, int content_type); void http_poll(struct netconn *server); void http_init(http_handler_t default_callback, struct HttpCGI *table);