This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 7.1.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit c5f0fc5bd902d4f2b90c1b958eef0b953716ca53 Author: Masaori Koshiba <[email protected]> AuthorDate: Mon Nov 6 10:30:47 2017 +0900 TS-5057: Add 103 Early Hints support (cherry picked from commit 1a9944ce2ffd1c54ef0fb3e30ecd539a28b8b028) --- doc/developer-guide/api/types/TSHttpStatus.en.rst | 2 ++ lib/cppapi/include/atscppapi/HttpStatus.h | 1 + lib/ts/apidefs.h.in | 1 + lib/ts/mkdfa.c | 1 + proxy/InkAPITest.cc | 14 +++++++++++++- proxy/hdrs/HTTP.cc | 1 + proxy/hdrs/HTTP.h | 1 + proxy/http/HttpTransact.cc | 3 ++- 8 files changed, 22 insertions(+), 2 deletions(-) diff --git a/doc/developer-guide/api/types/TSHttpStatus.en.rst b/doc/developer-guide/api/types/TSHttpStatus.en.rst index 9cfe9fe..78d2453 100644 --- a/doc/developer-guide/api/types/TSHttpStatus.en.rst +++ b/doc/developer-guide/api/types/TSHttpStatus.en.rst @@ -45,6 +45,8 @@ Enumeration Members .. c:member:: TSHttpStatus TS_HTTP_STATUS_SWITCHING_PROTOCOL +.. c:member:: TSHttpStatus TS_HTTP_STATUS_EARLY_HINTS + .. c:member:: TSHttpStatus TS_HTTP_STATUS_OK .. c:member:: TSHttpStatus TS_HTTP_STATUS_CREATED diff --git a/lib/cppapi/include/atscppapi/HttpStatus.h b/lib/cppapi/include/atscppapi/HttpStatus.h index 5c2e373..071aef1 100644 --- a/lib/cppapi/include/atscppapi/HttpStatus.h +++ b/lib/cppapi/include/atscppapi/HttpStatus.h @@ -37,6 +37,7 @@ enum HttpStatus { HTTP_STATUS_CONTINUE = 100, HTTP_STATUS_SWITCHING_PROTOCOL = 101, + HTTP_STATUS_EARLY_HINTS = 103, HTTP_STATUS_OK = 200, HTTP_STATUS_CREATED = 201, diff --git a/lib/ts/apidefs.h.in b/lib/ts/apidefs.h.in index 4f0ada3..7efe019 100644 --- a/lib/ts/apidefs.h.in +++ b/lib/ts/apidefs.h.in @@ -155,6 +155,7 @@ typedef enum { TS_HTTP_STATUS_NONE = 0, TS_HTTP_STATUS_CONTINUE = 100, TS_HTTP_STATUS_SWITCHING_PROTOCOL = 101, + TS_HTTP_STATUS_EARLY_HINTS = 103, TS_HTTP_STATUS_OK = 200, TS_HTTP_STATUS_CREATED = 201, TS_HTTP_STATUS_ACCEPTED = 202, diff --git a/lib/ts/mkdfa.c b/lib/ts/mkdfa.c index 3767b0c..9dcc890 100644 --- a/lib/ts/mkdfa.c +++ b/lib/ts/mkdfa.c @@ -138,6 +138,7 @@ info_t methods[] = { info_t statuses[] = { {"100", "HTTP_STATUS_CONTINUE", -1}, {"101", "HTTP_STATUS_SWITCHING_PROTOCOL", -1}, + {"103", "HTTP_STATUS_EARLY_HINTS", -1}, {"200", "HTTP_STATUS_OK", -1}, {"201", "HTTP_STATUS_CREATED", -1}, {"202", "HTTP_STATUS_ACCEPTED", -1}, diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc index 486c343..5f67c69 100644 --- a/proxy/InkAPITest.cc +++ b/proxy/InkAPITest.cc @@ -3272,7 +3272,7 @@ REGRESSION_TEST(SDK_API_TSHttpHdr)(RegressionTest *test, int /* atype ATS_UNUSED } if (strcmp("Not Modified", TSHttpHdrReasonLookup(TS_HTTP_STATUS_NOT_MODIFIED)) != 0) { - SDK_RPRINT(test, "TSHttpHdrReasonLookup", "TestCase2", TC_FAIL, "TSHttpHdrReasonLookup returns Value's mismatch"); + SDK_RPRINT(test, "TSHttpHdrReasonLookup", "TestCase4", TC_FAIL, "TSHttpHdrReasonLookup returns Value's mismatch"); if (test_passed_Http_Hdr_Reason_Lookup == true) { test_passed_Http_Hdr_Reason_Lookup = false; } @@ -3280,6 +3280,15 @@ REGRESSION_TEST(SDK_API_TSHttpHdr)(RegressionTest *test, int /* atype ATS_UNUSED SDK_RPRINT(test, "TSHttpHdrReasonLookup", "TestCase4", TC_PASS, "ok"); } + if (strcmp("Early Hints", TSHttpHdrReasonLookup(TS_HTTP_STATUS_EARLY_HINTS)) != 0) { + SDK_RPRINT(test, "TSHttpHdrReasonLookup", "TestCase5", TC_FAIL, "TSHttpHdrReasonLookup returns Value's mismatch"); + if (test_passed_Http_Hdr_Reason_Lookup == true) { + test_passed_Http_Hdr_Reason_Lookup = false; + } + } else { + SDK_RPRINT(test, "TSHttpHdrReasonLookup", "TestCase5", TC_PASS, "ok"); + } + // Copy if (test_passed_Http_Hdr_Create == true) { if (TSHttpHdrCopy(bufp3, hdr_loc3, bufp1, hdr_loc1) == TS_ERROR) { @@ -5488,6 +5497,7 @@ typedef enum { ORIG_TS_HTTP_STATUS_CONTINUE = 100, ORIG_TS_HTTP_STATUS_SWITCHING_PROTOCOL = 101, + ORIG_TS_HTTP_STATUS_EARLY_HINTS = 103, ORIG_TS_HTTP_STATUS_OK = 200, ORIG_TS_HTTP_STATUS_CREATED = 201, @@ -5657,6 +5667,8 @@ REGRESSION_TEST(SDK_API_TSConstant)(RegressionTest *test, int /* atype ATS_UNUSE PRINT_DIFF(TS_HTTP_STATUS_NONE); PRINT_DIFF(TS_HTTP_STATUS_CONTINUE); PRINT_DIFF(TS_HTTP_STATUS_SWITCHING_PROTOCOL); + PRINT_DIFF(TS_HTTP_STATUS_EARLY_HINTS); + PRINT_DIFF(TS_HTTP_STATUS_OK); PRINT_DIFF(TS_HTTP_STATUS_CREATED); diff --git a/proxy/hdrs/HTTP.cc b/proxy/hdrs/HTTP.cc index 3be7064..bf8aea3 100644 --- a/proxy/hdrs/HTTP.cc +++ b/proxy/hdrs/HTTP.cc @@ -756,6 +756,7 @@ http_hdr_reason_lookup(unsigned status) HTTP_STATUS_ENTRY(100, Continue); // [RFC2616] HTTP_STATUS_ENTRY(101, Switching Protocols); // [RFC2616] HTTP_STATUS_ENTRY(102, Processing); // [RFC2518] + HTTP_STATUS_ENTRY(103, Early Hints); // TODO: add RFC number // 103-199 Unassigned HTTP_STATUS_ENTRY(200, OK); // [RFC2616] HTTP_STATUS_ENTRY(201, Created); // [RFC2616] diff --git a/proxy/hdrs/HTTP.h b/proxy/hdrs/HTTP.h index 5891834..251e3b9 100644 --- a/proxy/hdrs/HTTP.h +++ b/proxy/hdrs/HTTP.h @@ -43,6 +43,7 @@ enum HTTPStatus { HTTP_STATUS_CONTINUE = 100, HTTP_STATUS_SWITCHING_PROTOCOL = 101, + HTTP_STATUS_EARLY_HINTS = 103, HTTP_STATUS_OK = 200, HTTP_STATUS_CREATED = 201, diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index 29f492e..c898fce 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -4071,7 +4071,8 @@ HttpTransact::handle_forward_server_connection_open(State *s) // dont update the hostdb. let us try again with what we currently think. } - if (s->hdr_info.server_response.status_get() == HTTP_STATUS_CONTINUE) { + if (s->hdr_info.server_response.status_get() == HTTP_STATUS_CONTINUE || + s->hdr_info.server_response.status_get() == HTTP_STATUS_EARLY_HINTS) { handle_100_continue_response(s); return; } -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
