Forum Discussion
Michael_Horvat_
Nimbostratus
Mar 28, 2007Appending URI
Does anyone know why the http::uri will not set to the uri variable?
set uri [HTTP::uri]
if { ! ([matchclass [string tolower [HTTP::uri]] contains $::WebFiles])
and ! ( $uri ends_with "/" ) } {
append uri "/" This is set properly
set HTTP::uri $uri This doesn't set
}
- JRahm
Admin
remove the set:if { ! ([matchclass [string tolower [HTTP::uri]] contains $::WebFiles]) and ! ( $uri ends_with "/" ) } { append uri "/" HTTP::uri $uri }
- The problem is the set command. The "HTTP::uri" command comes in two flavors, one to retrieve the value (if used with no parameters) and one to set the value (if a value parameter is given).
set uri [HTTP::uri] if { ! ([matchclass [string tolower [HTTP::uri]] contains $::WebFiles]) and ! ( $uri ends_with "/" ) } { HTTP::uri "[HTTP::uri]/" }
- Michael_Horvat_
Nimbostratus
Both methods work. Thank you. - J___Alford_4002
Nimbostratus
I've been having the same difficulty. Tried the above sample code. Didn't work. - That's due to an optimization in the caching of variables. The value of [HTTP::uri] is stored in a cache and when you re-assign the value with the "HTTP::uri value" command, the cached value for the [HTTP::uri] command is not updated. The URI will get modified, but the value returned from [HTTP::uri] is the original value. That issue has been around for a long time, maybe someday it'll get fixed.
when HTTP_REQUEST { log local0. "in HTTP_REQUEST" log local0. "Original: [HTTP::uri]." set uri "/prefix[HTTP::uri]/what_the/" log local0. "After mapping: $uri" HTTP::uri $uri }
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