#include <haproxy/api.h>
#include <common/cfgparse.h>
+#include <haproxy/http.h>
#include <common/htx.h>
#include <haproxy/pool.h>
#include <haproxy/list.h>
#include <haproxy/api.h>
#include <haproxy/dynbuf.h>
#include <haproxy/intops.h>
-#include <common/http.h>
+#include <haproxy/http.h>
#include <common/http-hdr.h>
#include <import/ist.h>
#include <string.h>
#include <haproxy/api.h>
#include <haproxy/buf-t.h>
-#include <common/http.h>
+#include <haproxy/http-t.h>
#include <import/ist.h>
int hpack_encode_header(struct buffer *out, const struct ist n,
#include <haproxy/buf.h>
#include <import/ist.h>
#include <haproxy/chunk.h>
-#include <common/http.h>
+#include <haproxy/http-t.h>
#include <common/http-hdr.h>
/*
/*
- * include/common/http.h
+ * include/haproxy/http-t.h
*
* Version-agnostic and implementation-agnostic HTTP protocol definitions.
*
- * Copyright (C) 2000-2018 Willy Tarreau - w@1wt.eu
+ * Copyright (C) 2000-2020 Willy Tarreau - w@1wt.eu
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef _COMMON_HTTP_H
-#define _COMMON_HTTP_H
+#ifndef _HAPROXY_HTTP_T_H
+#define _HAPROXY_HTTP_T_H
-#include <haproxy/buf-t.h>
+#include <inttypes.h>
#include <import/ist.h>
+#include <haproxy/buf-t.h>
/*
* some macros mainly used when parsing header fields.
const struct ist text;
};
-extern const int http_err_codes[HTTP_ERR_SIZE];
-extern const char *http_err_msgs[HTTP_ERR_SIZE];
-extern const struct ist http_known_methods[HTTP_METH_OTHER];
-extern const uint8_t http_char_classes[256];
-
-enum http_meth_t find_http_meth(const char *str, const int len);
-int http_get_status_idx(unsigned int status);
-const char *http_get_reason(unsigned int status);
-struct ist http_get_authority(const struct ist uri, int no_userinfo);
-struct ist http_get_path(const struct ist uri);
-int http_header_match2(const char *hdr, const char *end,
- const char *name, int len);
-char *http_find_hdr_value_end(char *s, const char *e);
-char *http_find_cookie_value_end(char *s, const char *e);
-char *http_extract_cookie_value(char *hdr, const char *hdr_end,
- char *cookie_name, size_t cookie_name_l,
- int list, char **value, size_t *value_l);
-int http_parse_qvalue(const char *qvalue, const char **end);
-const char *http_find_url_param_pos(const char **chunks,
- const char* url_param_name,
- size_t url_param_name_l, char delim);
-int http_find_next_url_param(const char **chunks,
- const char* url_param_name, size_t url_param_name_l,
- const char **vstart, const char **vend, char delim);
-
-int http_parse_header(const struct ist hdr, struct ist *name, struct ist *value);
-int http_parse_stline(const struct ist line, struct ist *p1, struct ist *p2, struct ist *p3);
-int http_parse_status_val(const struct ist value, struct ist *status, struct ist *reason);
-
-/*
- * Given a path string and its length, find the position of beginning of the
- * query string. Returns NULL if no query string is found in the path.
- *
- * Example: if path = "/foo/bar/fubar?yo=mama;ye=daddy", and n = 22:
- *
- * find_query_string(path, n, '?') points to "yo=mama;ye=daddy" string.
- */
-static inline char *http_find_param_list(char *path, size_t path_l, char delim)
-{
- char *p;
-
- p = memchr(path, delim, path_l);
- return p ? p + 1 : NULL;
-}
-
-static inline int http_is_param_delimiter(char c, char delim)
-{
- return c == '&' || c == ';' || c == delim;
-}
-
-/* Match language range with language tag. RFC2616 14.4:
- *
- * A language-range matches a language-tag if it exactly equals
- * the tag, or if it exactly equals a prefix of the tag such
- * that the first tag character following the prefix is "-".
- *
- * Return 1 if the strings match, else return 0.
- */
-static inline int http_language_range_match(const char *range, int range_len,
- const char *tag, int tag_len)
-{
- const char *end = range + range_len;
- const char *tend = tag + tag_len;
-
- while (range < end) {
- if (*range == '-' && tag == tend)
- return 1;
- if (*range != *tag || tag == tend)
- return 0;
- range++;
- tag++;
- }
- /* Return true only if the last char of the tag is matched. */
- return tag == tend;
-}
-
-
-#endif /* _COMMON_HTTP_H */
+#endif /* _HAPROXY_HTTP_T_H */
/*
* Local variables:
--- /dev/null
+/*
+ * include/haproxy/http.h
+ *
+ * Functions for version-agnostic and implementation-agnostic HTTP protocol.
+ *
+ * Copyright (C) 2000-2020 Willy Tarreau - w@1wt.eu
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, version 2.1
+ * exclusively.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _HAPROXY_HTTP_H
+#define _HAPROXY_HTTP_H
+
+#include <stddef.h>
+#include <string.h>
+#include <import/ist.h>
+#include <haproxy/http-t.h>
+
+extern const int http_err_codes[HTTP_ERR_SIZE];
+extern const char *http_err_msgs[HTTP_ERR_SIZE];
+extern const struct ist http_known_methods[HTTP_METH_OTHER];
+extern const uint8_t http_char_classes[256];
+
+enum http_meth_t find_http_meth(const char *str, const int len);
+int http_get_status_idx(unsigned int status);
+const char *http_get_reason(unsigned int status);
+struct ist http_get_authority(const struct ist uri, int no_userinfo);
+struct ist http_get_path(const struct ist uri);
+int http_header_match2(const char *hdr, const char *end,
+ const char *name, int len);
+char *http_find_hdr_value_end(char *s, const char *e);
+char *http_find_cookie_value_end(char *s, const char *e);
+char *http_extract_cookie_value(char *hdr, const char *hdr_end,
+ char *cookie_name, size_t cookie_name_l,
+ int list, char **value, size_t *value_l);
+int http_parse_qvalue(const char *qvalue, const char **end);
+const char *http_find_url_param_pos(const char **chunks,
+ const char* url_param_name,
+ size_t url_param_name_l, char delim);
+int http_find_next_url_param(const char **chunks,
+ const char* url_param_name, size_t url_param_name_l,
+ const char **vstart, const char **vend, char delim);
+
+int http_parse_header(const struct ist hdr, struct ist *name, struct ist *value);
+int http_parse_stline(const struct ist line, struct ist *p1, struct ist *p2, struct ist *p3);
+int http_parse_status_val(const struct ist value, struct ist *status, struct ist *reason);
+
+/*
+ * Given a path string and its length, find the position of beginning of the
+ * query string. Returns NULL if no query string is found in the path.
+ *
+ * Example: if path = "/foo/bar/fubar?yo=mama;ye=daddy", and n = 22:
+ *
+ * find_query_string(path, n, '?') points to "yo=mama;ye=daddy" string.
+ */
+static inline char *http_find_param_list(char *path, size_t path_l, char delim)
+{
+ char *p;
+
+ p = memchr(path, delim, path_l);
+ return p ? p + 1 : NULL;
+}
+
+static inline int http_is_param_delimiter(char c, char delim)
+{
+ return c == '&' || c == ';' || c == delim;
+}
+
+/* Match language range with language tag. RFC2616 14.4:
+ *
+ * A language-range matches a language-tag if it exactly equals
+ * the tag, or if it exactly equals a prefix of the tag such
+ * that the first tag character following the prefix is "-".
+ *
+ * Return 1 if the strings match, else return 0.
+ */
+static inline int http_language_range_match(const char *range, int range_len,
+ const char *tag, int tag_len)
+{
+ const char *end = range + range_len;
+ const char *tend = tag + tag_len;
+
+ while (range < end) {
+ if (*range == '-' && tag == tend)
+ return 1;
+ if (*range != *tag || tag == tend)
+ return 0;
+ range++;
+ tag++;
+ }
+ /* Return true only if the last char of the tag is matched. */
+ return tag == tend;
+}
+
+
+#endif /* _HAPROXY_HTTP_H */
+
+/*
+ * Local variables:
+ * c-indent-level: 8
+ * c-basic-offset: 8
+ * End:
+ */
#define _TYPES_PROTO_HTTP_H
#include <haproxy/api-t.h>
-#include <common/http.h>
+#include <haproxy/http-t.h>
#include <types/channel.h>
#include <types/http_htx.h>
#include <import/ebistree.h>
#include <haproxy/buf-t.h>
-#include <common/http.h>
+#include <haproxy/http-t.h>
#include <common/htx.h>
#include <import/ist.h>
#include <haproxy/api-t.h>
#include <haproxy/chunk.h>
-#include <common/http.h>
+#include <haproxy/http-t.h>
#include <haproxy/list-t.h>
#include <haproxy/thread.h>
#include <netinet/in.h>
#include <haproxy/buf-t.h>
-#include <common/http.h>
+#include <haproxy/http-t.h>
#include <haproxy/list-t.h>
struct arg;
#include <haproxy/api.h>
#include <haproxy/hash.h>
+#include <haproxy/http.h>
#include <common/htx.h>
#include <haproxy/ticks.h>
#include <haproxy/time.h>
#include <common/standard.h>
#include <haproxy/time.h>
#include <haproxy/thread.h>
-#include <common/http.h>
+#include <haproxy/http.h>
#include <common/h1.h>
#include <common/htx.h>
#include <haproxy/api.h>
#include <common/cfgparse.h>
#include <haproxy/errors.h>
-#include <common/http.h>
+#include <haproxy/http.h>
#include <types/global.h>
#include <proto/arg.h>
#include <proto/http_fetch.h>
#include <haproxy/api.h>
#include <haproxy/dynbuf.h>
+#include <haproxy/http.h>
#include <common/cfgparse.h>
#include <common/htx.h>
#include <haproxy/list.h>
#include <haproxy/api.h>
#include <common/cfgparse.h>
#include <common/h1.h>
-#include <common/http.h>
+#include <haproxy/http.h>
#include <common/htx.h>
#include <proto/h1_htx.h>
#include <inttypes.h>
#include <haproxy/api.h>
+#include <haproxy/http.h>
#include <common/h2.h>
#include <common/http-hdr.h>
#include <import/ist.h>
#include <lua.h>
#include <lualib.h>
+#include <haproxy/http.h>
#include <haproxy/net_helper.h>
#include <haproxy/regex.h>
#include <haproxy/time.h>
#include <ctype.h>
#include <haproxy/api.h>
-#include <common/http.h>
+#include <haproxy/http.h>
#include <common/standard.h>
/* It is about twice as fast on recent architectures to lookup a byte in a
#include <haproxy/api.h>
#include <haproxy/chunk.h>
-#include <common/http.h>
+#include <haproxy/http.h>
#include <haproxy/pool.h>
#include <common/standard.h>
#include <haproxy/version.h>
#include <haproxy/api.h>
#include <common/cfgparse.h>
#include <haproxy/chunk.h>
-#include <common/http.h>
+#include <haproxy/http.h>
#include <haproxy/pool.h>
#include <haproxy/regex.h>
#include <common/standard.h>
#include <haproxy/api.h>
#include <haproxy/base64.h>
+#include <haproxy/http.h>
#include <common/htx.h>
#include <haproxy/net_helper.h>
#include <haproxy/regex.h>
#include <haproxy/api.h>
#include <haproxy/chunk.h>
-#include <common/http.h>
+#include <haproxy/http.h>
#include <haproxy/pool.h>
#include <common/standard.h>
#include <haproxy/version.h>
#include <haproxy/base64.h>
#include <haproxy/chunk.h>
#include <common/h1.h>
-#include <common/http.h>
+#include <haproxy/http.h>
#include <common/htx.h>
#include <haproxy/pool.h>
#include <common/standard.h>
#include <common/cfgparse.h>
#include <common/h1.h>
-#include <common/http.h>
+#include <haproxy/http.h>
#include <common/htx.h>
#include <proto/arg.h>
#include <haproxy/api.h>
#include <common/cfgparse.h>
#include <haproxy/chunk.h>
-#include <common/http.h>
+#include <haproxy/http.h>
#include <haproxy/pool.h>
#include <common/standard.h>
#include <haproxy/version.h>
#include <sys/uio.h>
#include <haproxy/api.h>
+#include <haproxy/http.h>
#include <common/standard.h>
#include <haproxy/time.h>
#include <haproxy/version.h>
#include <haproxy/chunk.h>
#include <haproxy/hash.h>
-#include <common/http.h>
+#include <haproxy/http.h>
#include <haproxy/net_helper.h>
#include <haproxy/regex.h>
#include <common/standard.h>
*/
#include <haproxy/api.h>
-#include <common/http.h>
+#include <haproxy/http.h>
#include <haproxy/pool.h>
#include <types/global.h>
#include <haproxy/api.h>
#include <common/cfgparse.h>
#include <haproxy/debug.h>
-#include <common/http.h>
+#include <haproxy/http.h>
#include <common/htx.h>
#include <haproxy/pool.h>
#include <haproxy/list.h>
#include <haproxy/api.h>
#include <common/cfgparse.h>
-#include <common/http.h>
+#include <haproxy/http.h>
#include <haproxy/list.h>
#include <types/vars.h>