trafficserver-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hiroaki Nakamura <hnaka...@gmail.com>
Subject Re: Is there a way to handle multiple headers of the same name using TSLua plugin?
Date Tue, 10 May 2016 09:47:14 GMT
Hi Shu,

Thanks for you response.

I read http://stackoverflow.com/questions/4371328/are-duplicate-http-response-headers-acceptable/4371395#4371395
and am trying to modify ts.*.get_headers in TSLua to concatenate
multiple values of the same header.

If it turns out to works for me, I will send a pull request.

Thanks.

2016-05-10 18:41 GMT+09:00 Shu Kit Chan <chanshukit@gmail.com>:
> Unfortunately not right now. Suggestions to the syntax change as well as
> patches are welcome.
>
> Thanks.
>
> Kit
>
> On Tue, May 10, 2016 at 1:20 AM, Hiroaki Nakamura <hnakamur@gmail.com>
> wrote:
>>
>> Hi all,
>>
>> I tried to get two Cache-Control headers using TSLua plugin
>> with the following code.
>>
>> ```
>> function do_global_read_response()
>>     ts.http.set_debug(DEBUG)
>>
>>     headers = ts.server_response.get_headers()
>>     for k, v in pairs(headers) do
>>         ts.debug("server_response.header: k=" .. k .. ", v=" .. v)
>>     end
>> end
>> ```
>>
>> However, I got just one value of Cache-Control from
>> ts.server_response.get_headers()
>> although there are two Cache-Control lines in "Incoming O.S. Response".
>>
>> Is there a way to handle multiple headers of the same name using TSLua
>> plugin?
>>
>> traffic.out
>>
>> ```
>> [May 10 17:10:52.540] Server {0x2abab99e4700} DIAG: (ts_lua)
>> server_response.header: k=Connection, v=keep-alive
>> [May 10 17:10:52.540] Server {0x2abab99e4700} DIAG: (ts_lua)
>> server_response.header: k=Date, v=Tue, 10 May 2016 08:10:52 GMT
>> [May 10 17:10:52.540] Server {0x2abab99e4700} DIAG: (ts_lua)
>> server_response.header: k=Content-Type, v=image/jpeg
>> [May 10 17:10:52.540] Server {0x2abab99e4700} DIAG: (ts_lua)
>> server_response.header: k=Cache-Control, v=s-maxage=180
>> [May 10 17:10:52.540] Server {0x2abab99e4700} DIAG: (ts_lua)
>> server_response.header: k=Etag, v="3e5a3b-5280bf0e2f776"
>> [May 10 17:10:52.540] Server {0x2abab99e4700} DIAG: (ts_lua)
>> server_response.header: k=Last-Modified, v=Tue, 29 Dec 2015 16:30:34
>> GMT
>> [May 10 17:10:52.540] Server {0x2abab99e4700} DIAG: (ts_lua)
>> server_response.header: k=Via, v=http/1.1
>> copr-builder-960458626.novalocal (ApacheTrafficServer-second
>> [uScSsNfUpSeN:t cCSi p sS])
>> [May 10 17:10:52.540] Server {0x2abab99e4700} DIAG: (ts_lua)
>> server_response.header: k=Content-Length, v=4086331
>> [May 10 17:10:52.540] Server {0x2abab99e4700} DIAG: (ts_lua)
>> server_response.header: k=Age, v=0
>> [May 10 17:10:52.540] Server {0x2abab99e4700} DIAG: (ts_lua)
>> server_response.header: k=Accept-Ranges, v=bytes
>> [May 10 17:10:52.540] Server {0x2abab99e4700} DIAG: (ts_lua)
>> server_response.header: k=Server, v=ATS
>>
>> ...(snip)...
>>
>> +++++++++ Incoming O.S. Response +++++++++
>> -- State Machine Id: 0
>> HTTP/1.1 200 OK
>> Date: Tue, 10 May 2016 08:10:52 GMT
>> Server: ATS
>> Last-Modified: Tue, 29 Dec 2015 16:30:34 GMT
>> ETag: "3e5a3b-5280bf0e2f776"
>> Accept-Ranges: bytes
>> Content-Length: 4086331
>> Content-Type: image/jpeg
>> Cache-Control: public
>> Cache-Control: s-maxage=180
>> Age: 0
>> Connection: keep-alive
>> Via: http/1.1 copr-builder-960458626.novalocal
>> (ApacheTrafficServer-second [uScSsNfUpSeN:t cCSi p sS])
>> ```
>>
>> Regards,
>> Hiroaki
>
>

Mime
View raw message