Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2022-09-10
11:57 • Closed ticket [2927221fff]: provide helper function to get http headers plus... artifact: 7a73d4ade7 user: kjnash
2022-09-09
08:04
Fix bug [2927221] - revised http::meta, new http::metaValue, header names are case-insensitive so co... check-in: 31732edc8a user: kjnash tags: http-bugfixes-2022H2
2010-01-07
16:29 • Ticket [2927221fff] provide helper function to get http headers status still... artifact: 8609dc3efa user: ferrieux
2010-01-06
22:44 • New ticket [2927221fff]. artifact: f181d36297 user: dvrsn

provide helper function to get http headers

Closed / Fixed2927221fffffffffffffffffffffffffffffffffCreated 17 years agoUpdated 4 years ago
Descriptionplain2010-01-06 22:44:10
The http package puts the response headers into the meta element of the state array exactly as they are received from the server.  If a program needs to get a specific well-known header (i.e., Location) they must search the meta array in a case-insensitive manner rather than just accessing the keys.  

The requested feature is to provide a case-insensitive lookup into the meta array, either through a new helper function (::http::header) or by having http::meta take an optional key argument to return only the requested key instead of the entire array.  (::http::meta token ?key?)
ferrieuxplain2010-01-07 16:29:47
A new helper function ::http::header would indeed be the simplest, returning basically the same key-value list (isomorphous to a dict BTW) as ::meta but with [string tolower] applied to the keys.
kjnashplain2022-09-10 11:57:24
Fixed in commit [31732edc8a], branch http-bugfixes-2022H2.

N.B. the list of header names and values is not a dict because the same header name can be sent more than once.
Log in (anonymous is fine) to add a comment.