Forum Discussion
Carl_Brothers
Employee
Mar 30, 2009string map - Does it accept variables
Here is the case I am working around and hopefully it is just my ignorance of TCL constructs:
One SAP portal responds to many FQDNs and the FQDN determines to a small extent what the customer sees and controls how they log into the system.
When they log off the people using the "special" FQDNs are to be redirected to the original login page rather than the SAP page that requires NTLM auth.
Want this line to work, but it does not:
HTTP::header replace Location [string map -nocase {($uriLogoff) ($uriSSO)} [HTTP::header Location]]
HTTP::header replace Location [string map -nocase {"/actual/logoff/uri/that/requires/NTLM" "/long/path/to/login/page/without/NTLM"} [HTTP::header Location]]
Thanks in advance.
2 Replies
- hoolio
Cirrostratus
Hi Carl,
You can use variables with string map, but you cannot use them with curly braces. In TCL curly braces generally prevent variable substitution. They're nice to use to avoid having to escape metacharacters.
If you want to allow variable expansion, you can use quotes or the list command:
set updated_string [string map "$find $replace" $original_string]
Aaron - Carl_Brothers
Employee
That did it. Works like a champ!
HTTP::header replace Location [string map -nocase [list $uriLogoff $uriSSO] [HTTP::header Location]]
I was using the curly braces due to the examples containing them. I did not know of the exact limitations that they impart, so thanks for the clarification.
Thank you for the help with making this work.
Carl
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
