[
https://issues.apache.org/jira/browse/TS-4510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15333055#comment-15333055
]
ASF GitHub Bot commented on TS-4510:
------------------------------------
Github user jpeach commented on a diff in the pull request:
https://github.com/apache/trafficserver/pull/697#discussion_r67285947
--- Diff: plugins/experimental/ts_lua/ts_lua_server_request.c ---
@@ -258,10 +286,27 @@ ts_lua_server_request_get_headers(lua_State *L)
while (field_loc) {
name = TSMimeHdrFieldNameGet(http_ctx->server_request_bufp,
http_ctx->server_request_hdrp, field_loc, &name_len);
if (name && name_len) {
- value = TSMimeHdrFieldValueStringGet(http_ctx->server_request_bufp,
http_ctx->server_request_hdrp, field_loc, -1, &value_len);
lua_pushlstring(L, name, name_len);
- lua_pushlstring(L, value, value_len);
- lua_rawset(L, -3);
+ lua_gettable(L, -2);
+ if (lua_isnil(L, -1)) {
--- End diff --
This definitely needs explanatory comments. I think what is going on is
that the first ``lua_pushlstring`` is used to test whether there is already a
value fir this header. If there is you concat to it. But it needs explanations
:)
> ts_lua plugin - support multiple headers with the same name
> -----------------------------------------------------------
>
> Key: TS-4510
> URL: https://issues.apache.org/jira/browse/TS-4510
> Project: Traffic Server
> Issue Type: Improvement
> Components: Lua, Plugins
> Reporter: Kit Chan
> Assignee: Kit Chan
> Fix For: 7.0.0
>
>
> Currently ts_lua plugin does not handle well when the request or response
> contains multiple header with the same name.
> We either retrieve the last value of first value of these headers and when we
> set new value to the header, we only change the first one and leave the rest
> there still.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)