Forum Discussion
How can I test to see if HTTP::Status exists?
Here's the error I'm seeing:
TCL error: /Common/www.my.com_irule - Illegal argument. Invalid client side API (line 15) invoked from within "HTTP::status"
So here's what I have, the commeted section where HTTP::status is referenced causes this issue. I suspect it's not seeing a status code and complaining. I'd love to test if HTTP::status exists, if not insert XXX as the status code, and if it does insert the real status code.:
when CLIENT_ACCEPTED {
set hsl [HSL::open -proto TCP -pool syslog_pool]
}
when HTTP_REQUEST {
set http_request_time [clock clicks -milliseconds]
set remote_addr "[IP::remote_addr]"
set LogString1 "<190> $remote_addr \"[HTTP::header Host]\" \"[HTTP::method] [HTTP::uri] HTTP\/[HTTP::version]\" \"[HTTP::header User-Agent]\""
}
when HTTP_RESPONSE {
set http_status XXX
if { [HTTP::status] } {
set http_status [HTTP::status]
}
set LogString2 "[HTTP::status] pool_info: [LB::server] (ResponseTime: [expr [clock clicks -milliseconds] - $http_request_time]ms)"
set LogString2 "$http_status pool_info: [LB::server] (ResponseTime: [expr [clock clicks -milliseconds] - $http_request_time]ms)"
set LogString2 "pool_info: [LB::server] (ResponseTime: [expr [clock clicks -milliseconds] - $http_request_time]ms)"
HSL::send $hsl "$LogString1 | $LogString2 \n"
}
- hooleylistCirrostratusHi Wil,
when HTTP_RESPONSE { Use catch to handle any exception if {[catch {HTTP::status} status]==0}{ log local0. "HTTP::status was successful and returned $status" } else { log local0. "HTTP::status failed and returned $status" } }
Recent Discussions
Related Content
* 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