Forum Discussion
stevehuffy
Apr 21, 2015Nimbostratus
Yeh, thanks. Was hoping for something more generic that would support other headers, but I guess similar will do for my use case, as E-Tags seem to only have a specific format. I am not sure why HTTP::header adds more characters to the actual HTTP header, but would have thought something like this would have reformatted: [puts [HTTP::header values X-Test]], but can't find anything easily.
So I am now doing this (hopefully it will provide the original E-Tag ok - it will be going in a 304 response):
log local0. "from irule HTTP::headers- [HTTP::header values X-Test]"
log local0. "to get it to original- [string map {\\\" "\""} [string trim [HTTP::header values X-Test] \{\}]]"
Test1
$ curl http:// -H 'X-Test: "test"'
-
: from irule HTTP::headers- {"test"}
: to get it to original- "test"
Test2
$ curl http:// -H 'X-Test: W/"test"'
-
: from irule HTTP::headers- W/\"test\"
: to get it to original- W/"test"
Test3 (the iRule doesn't handle this, but hopefully an E-tag is never formatted like this)
$ curl http:// -H 'X-Test: W/"ba8ba5c\"37e1fce1:0"'
-
: from irule HTTP::headers- {W/"ba8ba5c\"37e1fce1:0"}
: to get it to original- W/"ba8ba5c"37e1fce1:0"