trafficserver-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hiroaki Nakamura <hnaka...@gmail.com>
Subject Is there a way to handle multiple headers of the same name using TSLua plugin?
Date Tue, 10 May 2016 08:20:29 GMT
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