[trafficserver] branch 9.0.x updated: Updated ChangeLog
This is an automated email from the ASF dual-hosted git repository. bcall pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/9.0.x by this push: new 6084b65 Updated ChangeLog 6084b65 is described below commit 6084b650d426cd83d01e7cda10db1e68b23342ce Author: Bryan Call AuthorDate: Tue Sep 22 08:55:19 2020 -0700 Updated ChangeLog --- CHANGELOG-9.0.0 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG-9.0.0 b/CHANGELOG-9.0.0 index 19333f5..28685eb 100644 --- a/CHANGELOG-9.0.0 +++ b/CHANGELOG-9.0.0 @@ -1093,3 +1093,5 @@ Changes with Apache Traffic Server 9.0.0 #7178 - AuTest: Reuse venv if it exists already #7181 - TS_API for Note,Status,Warning,Alert,Fatal #7183 - Emits log when OCSP fails to connect to server + #7193 - Make custom xdebug HTTP header name available to other plugins. + #7202 - Strip whitespaces after field-name and before the colon in headers from the origin
[trafficserver] 02/02: Strip whitespaces after field-name and before the colon in headers from the origin (#7202)
This is an automated email from the ASF dual-hosted git repository. bcall pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git commit 2df801d729377a08b4a605c3d84a778d05c7c56e Author: Bryan Call AuthorDate: Mon Sep 21 11:53:20 2020 -0700 Strip whitespaces after field-name and before the colon in headers from the origin (#7202) (cherry picked from commit cf8f025f67ad4c453cde40776da81e8873e0a254) --- proxy/hdrs/MIME.cc | 6 ++- tests/gold_tests/headers/field_name_space.test.py | 53 ++ .../gold_tests/headers/gold/field_name_space.gold | 14 ++ 3 files changed, 71 insertions(+), 2 deletions(-) diff --git a/proxy/hdrs/MIME.cc b/proxy/hdrs/MIME.cc index c2e938d..fb7bd33 100644 --- a/proxy/hdrs/MIME.cc +++ b/proxy/hdrs/MIME.cc @@ -2574,12 +2574,14 @@ mime_parser_parse(MIMEParser *parser, HdrHeap *heap, MIMEHdrImpl *mh, const char // whitespace between a header field-name and colon with a response code // of 400 (Bad Request). // A proxy MUST remove any such whitespace from a response message before -// fowarding the message downstream. +// forwarding the message downstream. +bool raw_print_field = true; if (is_ws(field_name.back())) { if (!remove_ws_from_field_name) { return PARSE_RESULT_ERROR; } field_name.rtrim_if(::is_ws); + raw_print_field = false; } // find value first @@ -2615,7 +2617,7 @@ mime_parser_parse(MIMEParser *parser, HdrHeap *heap, MIMEHdrImpl *mh, const char MIMEField *field = mime_field_create(heap, mh); mime_field_name_value_set(heap, mh, field, field_name_wks_idx, field_name.data(), field_name.size(), field_value.data(), - field_value.size(), true, parsed.size(), false); + field_value.size(), raw_print_field, parsed.size(), false); mime_hdr_field_attach(mh, field, 1, nullptr); } } diff --git a/tests/gold_tests/headers/field_name_space.test.py b/tests/gold_tests/headers/field_name_space.test.py new file mode 100644 index 000..559ba17 --- /dev/null +++ b/tests/gold_tests/headers/field_name_space.test.py @@ -0,0 +1,53 @@ +''' +Test on handeling spaces after the field name and before the colon +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +Test.Summary = ''' +Checking on handeling spaces after the field name and before the colon +''' + +Test.ContinueOnFail = True + +# Define default ATS +ts = Test.MakeATSProcess("ts") +server = Test.MakeOriginServer("server") + +testName = "field_name_space" +request_header = { +"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n", +"timestamp": "1469733493.993", +"body": ""} +response_header = { +"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\nFoo : 123\r\nFoo: 456\r\n", +"timestamp": "1469733493.993", +"body": "xxx"} +server.addResponse("sessionlog.json", request_header, response_header) + +ts.Disk.remap_config.AddLine( +'map http://www.example.com http://127.0.0.1:{0}'.format(server.Variables.Port) +) + +# Test spaces at the end of the field name and before the : +tr = Test.AddTestRun() +tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port)) +tr.Processes.Default.StartBefore(Test.Processes.ts) +tr.Processes.Default.Command = 'curl -s -D - -v --ipv4 --http1.1 -H "Host: www.example.com" http://localhost:{0}/'.format( +ts.Variables.port) +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Streams.stderr = "gold/field_name_space.gold" +tr.StillRunningAfter = ts diff --git a/tests/gold_tests/headers/gold/field_name_space.gold b/tests/gold_tests/headers/gold/field_name_space.gold new file mode 100644 index 000..bf71178 --- /dev/null +++ b/tests/gold_tests/headers/gold/field_name_space.gold @@ -0,0 +1,14 @@ +`` +> GET /`` +> Host: www.example.com`` +> User-Agent: curl/`` +`` +< HTTP/1.1 200 OK +< Foo: 123 +< Foo: 456 +< Content-Length: 3 +< Date: `` +< Age: `` +< Connection: keep-alive +< Server: ATS/`` +``
[trafficserver] branch 9.0.x updated (26dbba2 -> 2df801d)
This is an automated email from the ASF dual-hosted git repository. bcall pushed a change to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git. from 26dbba2 Updated ChangeLog new e256d29 Make custom xdebug HTTP header name available to other plugins. (#7193) new 2df801d Strip whitespaces after field-name and before the colon in headers from the origin (#7202) The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: plugins/xdebug/xdebug.cc | 7 proxy/hdrs/MIME.cc | 6 ++-- .../field_name_space.test.py} | 39 +++--- .../gold/field_name_space.gold}| 7 ++-- 4 files changed, 35 insertions(+), 24 deletions(-) copy tests/gold_tests/{pluginTest/multiplexer/multiplexer.test.py => headers/field_name_space.test.py} (57%) copy tests/gold_tests/{remap/gold/remap-https-200.gold => headers/gold/field_name_space.gold} (72%)
[trafficserver] 01/02: Make custom xdebug HTTP header name available to other plugins. (#7193)
This is an automated email from the ASF dual-hosted git repository. bcall pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git commit e256d294254c99e921d318be28db2ef143b78956 Author: Walt Karas AuthorDate: Tue Sep 15 11:43:44 2020 -0500 Make custom xdebug HTTP header name available to other plugins. (#7193) The custom header name is passed to the xdebug plugin as plugin parameter. This change makes it available as a global TS API user parameter. (cherry picked from commit b09e04390717422e7b9917b158cd3e63c78709d1) --- plugins/xdebug/xdebug.cc | 7 +++ 1 file changed, 7 insertions(+) diff --git a/plugins/xdebug/xdebug.cc b/plugins/xdebug/xdebug.cc index 5e81190..30a1d10 100644 --- a/plugins/xdebug/xdebug.cc +++ b/plugins/xdebug/xdebug.cc @@ -706,6 +706,13 @@ TSPluginInit(int argc, const char *argv[]) } xDebugHeader.len = strlen(xDebugHeader.str); + // Make xDebugHeader available to other plugins, as a C-style string. + // + int idx = -1; + TSReleaseAssert(TSUserArgIndexReserve(TS_USER_ARGS_GLB, "XDebugHeader", "XDebug header name", ) == TS_SUCCESS); + TSReleaseAssert(idx >= 0); + TSUserArgSet(nullptr, idx, const_cast(xDebugHeader.str)); + AuxDataMgr::init("xdebug"); // Setup the global hook
[trafficserver] branch master updated: Add support for TS API for Note, Status, Warning, Alert (#7208)
This is an automated email from the ASF dual-hosted git repository. kichan pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 3eefadb Add support for TS API for Note, Status, Warning, Alert (#7208) 3eefadb is described below commit 3eefadbcae320121abbed485d601d456422aef3c Author: Kit Chan AuthorDate: Tue Sep 22 07:18:54 2020 -0700 Add support for TS API for Note, Status, Warning, Alert (#7208) --- doc/admin-guide/plugins/lua.en.rst | 40 plugins/lua/ts_lua_misc.c | 64 ++ 2 files changed, 104 insertions(+) diff --git a/doc/admin-guide/plugins/lua.en.rst b/doc/admin-guide/plugins/lua.en.rst index c282da6..e876a73 100644 --- a/doc/admin-guide/plugins/lua.en.rst +++ b/doc/admin-guide/plugins/lua.en.rst @@ -299,6 +299,46 @@ Here is an example: :ref:`TOP ` +ts.status +- +**syntax:** *ts.status(MESSAGE)* + +**context:** global + +**description**: Log the MESSAGE to error.log as status + +:ref:`TOP ` + +ts.note +--- +**syntax:** *ts.note(MESSAGE)* + +**context:** global + +**description**: Log the MESSAGE to error.log as note + +:ref:`TOP ` + +ts.warning +-- +**syntax:** *ts.warning(MESSAGE)* + +**context:** global + +**description**: Log the MESSAGE to error.log as warning + +:ref:`TOP ` + +ts.alert + +**syntax:** *ts.alert(MESSAGE)* + +**context:** global + +**description**: Log the MESSAGE to error.log as alert + +:ref:`TOP ` + TS Basic Internal Information - **syntax:** *ts.get_install_dir()* diff --git a/plugins/lua/ts_lua_misc.c b/plugins/lua/ts_lua_misc.c index 057ef07..d65ec5e 100644 --- a/plugins/lua/ts_lua_misc.c +++ b/plugins/lua/ts_lua_misc.c @@ -26,6 +26,10 @@ static int ts_lua_debug(lua_State *L); static int ts_lua_error(lua_State *L); static int ts_lua_emergency(lua_State *L); static int ts_lua_fatal(lua_State *L); +static int ts_lua_status(lua_State *L); +static int ts_lua_note(lua_State *L); +static int ts_lua_warning(lua_State *L); +static int ts_lua_alert(lua_State *L); static int ts_lua_sleep(lua_State *L); static int ts_lua_host_lookup(lua_State *L); static int ts_lua_schedule(lua_State *L); @@ -74,6 +78,22 @@ ts_lua_inject_misc_api(lua_State *L) lua_pushcfunction(L, ts_lua_fatal); lua_setfield(L, -2, "fatal"); + /* ts.status(...) */ + lua_pushcfunction(L, ts_lua_status); + lua_setfield(L, -2, "status"); + + /* ts.note(...) */ + lua_pushcfunction(L, ts_lua_note); + lua_setfield(L, -2, "note"); + + /* ts.warning(...) */ + lua_pushcfunction(L, ts_lua_warning); + lua_setfield(L, -2, "warning"); + + /* ts.alert(...) */ + lua_pushcfunction(L, ts_lua_alert); + lua_setfield(L, -2, "alert"); + /* ts.sleep(...) */ lua_pushcfunction(L, ts_lua_sleep); lua_setfield(L, -2, "sleep"); @@ -196,6 +216,50 @@ ts_lua_fatal(lua_State *L) } static int +ts_lua_status(lua_State *L) +{ + const char *msg; + size_t len = 0; + + msg = luaL_checklstring(L, 1, ); + TSStatus("%.*s", (int)len, msg); + return 0; +} + +static int +ts_lua_note(lua_State *L) +{ + const char *msg; + size_t len = 0; + + msg = luaL_checklstring(L, 1, ); + TSNote("%.*s", (int)len, msg); + return 0; +} + +static int +ts_lua_warning(lua_State *L) +{ + const char *msg; + size_t len = 0; + + msg = luaL_checklstring(L, 1, ); + TSWarning("%.*s", (int)len, msg); + return 0; +} + +static int +ts_lua_alert(lua_State *L) +{ + const char *msg; + size_t len = 0; + + msg = luaL_checklstring(L, 1, ); + TSAlert("%.*s", (int)len, msg); + return 0; +} + +static int ts_lua_schedule(lua_State *L) { int sec;