m_137079
Dec 04, 2013Nimbostratus
getting all headers from http request without using a loop
I am using the below irule to get all headers from every http request. Is there any other efficient way to do this for instance without using a loop. Any input is much appreciated
Present Irule
when HTTP_REQUEST {
set HttpHeader " "
set now [clock format [clock seconds] -format "%D %H:%M:%S %z"]
set contentlength [HTTP::header "Content-Length"]
foreach aHeader [HTTP::header names] {
append HttpHeader $aHeader ":" [HTTP::header value $aHeader] "\r\n"
}
HSL::send $applayer_hsl "<190>\r\n$HttpHeader\r\nPath:[URI::path [HTTP::uri]][URI::basename [HTTP::uri]]\r\nQueryStr:[HTTP::query]\r\nHttpKalive:[HTTP::is_keepalive]\r\nHttpVer:[HTTP::version]\r\nF5Addr: [IP::local_addr]\r\nClientIP:[IP::client_addr]\r\nTime:$now\r\nPort:$ClientPort\r\nServer:[LB::server addr]\r\n"
}
when CLIENT_ACCEPTED {
set applayer_hsl [HSL::open -proto UDP -pool hsl_8080_pool]
set ClientPort [TCP::local_port]
}
Remember HTTP:request only logs the request headers, not the payload (if there is one), and given that the default Max Header Size in an http profile is 32768, you are unlikely to exceed 64K.