api: expose the QUERY method to plugins Add TS_HTTP_METHOD_QUERY and TS_HTTP_LEN_QUERY to the C API, QUERY to the cripts method constants, and QUERY to the C++ API's HttpMethod enum, so plugins can compare against the pre-allocated method name the way they do for the other well-known methods. The HttpMethod enumerator is appended rather than inserted next to PURGE so the existing enumerator values do not shift.
diff --git a/doc/developer-guide/cripts/cripts-headers.en.rst b/doc/developer-guide/cripts/cripts-headers.en.rst index 20e1c9b..75a1b0c 100644 --- a/doc/developer-guide/cripts/cripts-headers.en.rst +++ b/doc/developer-guide/cripts/cripts-headers.en.rst
@@ -121,6 +121,7 @@ ``cripts::Method::OPTIONS`` The OPTIONS method. ``cripts::Method::CONNECT`` The CONNECT method. ``cripts::Method::TRACE`` The TRACE method. +``cripts::Method::QUERY`` The QUERY method. ============================ ====================================================================== These symbols can be used to compare against the method in the request object. For example:
diff --git a/doc/developer-guide/plugins/http-headers/header-functions.en.rst b/doc/developer-guide/plugins/http-headers/header-functions.en.rst index 47d0745..de6db73 100644 --- a/doc/developer-guide/plugins/http-headers/header-functions.en.rst +++ b/doc/developer-guide/plugins/http-headers/header-functions.en.rst
@@ -71,6 +71,9 @@ ``TS_HTTP_METHOD_PUSH`` "PUSH" +``TS_HTTP_METHOD_QUERY`` + "QUERY" + Traffic Server also defines several common values that appear in HTTP headers.
diff --git a/doc/release-notes/whats-new.en.rst b/doc/release-notes/whats-new.en.rst index d6bfd22..9d853d6 100644 --- a/doc/release-notes/whats-new.en.rst +++ b/doc/release-notes/whats-new.en.rst
@@ -73,6 +73,8 @@ * Add ``TSVConnPPInfoGet`` to get Proxy Protocol information. * Add ``TSContScheduleOnEntirePool`` and ``TSContScheduleEveryOnEntirePool`` to schedule continuations on every thread in a pool. +* Add ``TS_HTTP_METHOD_QUERY`` and ``TS_HTTP_LEN_QUERY`` for the HTTP ``QUERY`` + method, along with the corresponding cripts and C++ API constants. Features --------
diff --git a/include/cripts/Headers.hpp b/include/cripts/Headers.hpp index b1010cf..3278bbb 100644 --- a/include/cripts/Headers.hpp +++ b/include/cripts/Headers.hpp
@@ -531,6 +531,7 @@ extern const cripts::Header::Method TRACE; // This is a special feature of ATS extern const cripts::Header::Method PURGE; + extern const cripts::Header::Method QUERY; } // namespace Method // Lookup status constants, these are used in the Cache::Response::lookupstatus
diff --git a/include/ts/apidefs.h.in b/include/ts/apidefs.h.in index 86bb8e2..d641cd0 100644 --- a/include/ts/apidefs.h.in +++ b/include/ts/apidefs.h.in
@@ -1491,6 +1491,7 @@ extern const char *TS_HTTP_METHOD_PUT; extern const char *TS_HTTP_METHOD_TRACE; extern const char *TS_HTTP_METHOD_PUSH; +extern const char *TS_HTTP_METHOD_QUERY; /* -------------------------------------------------------------------------- HTTP methods string lengths */ @@ -1504,6 +1505,7 @@ extern int TS_HTTP_LEN_PUT; extern int TS_HTTP_LEN_TRACE; extern int TS_HTTP_LEN_PUSH; +extern int TS_HTTP_LEN_QUERY; /* -------------------------------------------------------------------------- TLS Next Protocol well-known protocol names. */
diff --git a/include/tscpp/api/HttpMethod.h b/include/tscpp/api/HttpMethod.h index 59a6fb7..27b94ed 100644 --- a/include/tscpp/api/HttpMethod.h +++ b/include/tscpp/api/HttpMethod.h
@@ -43,7 +43,8 @@ HTTP_METHOD_PURGE, HTTP_METHOD_PUT, HTTP_METHOD_TRACE, - HTTP_METHOD_PUSH + HTTP_METHOD_PUSH, + HTTP_METHOD_QUERY }; /**
diff --git a/src/api/InkAPIInternal.cc b/src/api/InkAPIInternal.cc index 8bb20a2..43a22ee 100644 --- a/src/api/InkAPIInternal.cc +++ b/src/api/InkAPIInternal.cc
@@ -285,6 +285,7 @@ const char *TS_HTTP_METHOD_PUT; const char *TS_HTTP_METHOD_TRACE; const char *TS_HTTP_METHOD_PUSH; +const char *TS_HTTP_METHOD_QUERY; /* HTTP methods string lengths */ int TS_HTTP_LEN_CONNECT; @@ -297,6 +298,7 @@ int TS_HTTP_LEN_PUT; int TS_HTTP_LEN_TRACE; int TS_HTTP_LEN_PUSH; +int TS_HTTP_LEN_QUERY; //////////////////////////////////////////////////////////////////// // @@ -730,6 +732,7 @@ TS_HTTP_METHOD_PUT = HTTP_METHOD_PUT.c_str(); TS_HTTP_METHOD_TRACE = HTTP_METHOD_TRACE.c_str(); TS_HTTP_METHOD_PUSH = HTTP_METHOD_PUSH.c_str(); + TS_HTTP_METHOD_QUERY = HTTP_METHOD_QUERY.c_str(); TS_HTTP_LEN_CONNECT = static_cast<int>(HTTP_METHOD_CONNECT.length()); TS_HTTP_LEN_DELETE = static_cast<int>(HTTP_METHOD_DELETE.length()); @@ -741,6 +744,7 @@ TS_HTTP_LEN_PUT = static_cast<int>(HTTP_METHOD_PUT.length()); TS_HTTP_LEN_TRACE = static_cast<int>(HTTP_METHOD_TRACE.length()); TS_HTTP_LEN_PUSH = static_cast<int>(HTTP_METHOD_PUSH.length()); + TS_HTTP_LEN_QUERY = static_cast<int>(HTTP_METHOD_QUERY.length()); /* HTTP miscellaneous values */ TS_HTTP_VALUE_BYTES = HTTP_VALUE_BYTES.c_str();
diff --git a/src/cripts/Headers.cc b/src/cripts/Headers.cc index fb66890..93a4460 100644 --- a/src/cripts/Headers.cc +++ b/src/cripts/Headers.cc
@@ -38,6 +38,7 @@ const cripts::Header::Method OPTIONS(TS_HTTP_METHOD_OPTIONS, TS_HTTP_LEN_OPTIONS); const cripts::Header::Method CONNECT(TS_HTTP_METHOD_CONNECT, TS_HTTP_LEN_CONNECT); const cripts::Header::Method TRACE(TS_HTTP_METHOD_TRACE, TS_HTTP_LEN_TRACE); + const cripts::Header::Method QUERY(TS_HTTP_METHOD_QUERY, TS_HTTP_LEN_QUERY); // This is a special feature of ATS const cripts::Header::Method PURGE(TS_HTTP_METHOD_PURGE, TS_HTTP_LEN_PURGE); } // namespace Method
diff --git a/src/tscpp/api/HttpMethod.cc b/src/tscpp/api/HttpMethod.cc index a1f6801..bcbce2f 100644 --- a/src/tscpp/api/HttpMethod.cc +++ b/src/tscpp/api/HttpMethod.cc
@@ -25,4 +25,4 @@ const std::string atscppapi::HTTP_METHOD_STRINGS[] = {std::string("UNKNOWN"), std::string("GET"), std::string("POST"), std::string("HEAD"), std::string("CONNECT"), std::string("DELETE"), std::string("OPTIONS"), std::string("PURGE"), std::string("PUT"), - std::string("TRACE"), std::string("PUSH")}; + std::string("TRACE"), std::string("PUSH"), std::string("QUERY")};
diff --git a/src/tscpp/api/Request.cc b/src/tscpp/api/Request.cc index 72ea026..1782522 100644 --- a/src/tscpp/api/Request.cc +++ b/src/tscpp/api/Request.cc
@@ -128,6 +128,8 @@ state_->method_ = HTTP_METHOD_OPTIONS; } else if (method_str == TS_HTTP_METHOD_PURGE) { state_->method_ = HTTP_METHOD_PURGE; + } else if (method_str == TS_HTTP_METHOD_QUERY) { + state_->method_ = HTTP_METHOD_QUERY; } else if (method_str == TS_HTTP_METHOD_PUT) { state_->method_ = HTTP_METHOD_PUT; } else if (method_str == TS_HTTP_METHOD_TRACE) {