Jim Wilcoxson wrote:
>
> Here's another version:


I was thinking you might also need a trace filter break.
I placed the following script in the private tcl/init.tcl file, to
ensure that it is the first filter that runs, however, it seems that
the rp_filter is still executing at least to run ad_permission on the
script location
and to run the security procs.

Anyone have a line on how to get this filter registered first?

Here is my version using nsv_* instead of ns_share.


##########################################
# NIMBA FILTER

ns_log Notice "Loading Nimba filter"

nsv_set nimda conns 0
nsv_set nimda max 10
nsv_set nimda count 0

proc nimda {conn ignore} {

  global breaktrace
  set breaktrace 1
  set req [ns_conn request]
  set reqlist [split $req " "]
  set url [lindex $reqlist 1]
  set host [ns_conn peeraddr]

  nsv_incr nimda count
  if {[nsv_get nimda conns] < [nsv_get nimda max]} {
    nsv_incr nimda conns
    ns_sleep 60
    nsv_incr nimda conns -1
  }
  ns_returnredirect http://$host$url
  return filter_return


}

proc nimda_breaktrace {conn ignore} {

  global breaktrace

  if {[info exists breaktrace] && $breaktrace == 1} {
    ns_log Notice "Nimba BreakTrace total: [nsv_get nimda count]
[ns_conn peeraddr]"
    return filter_return
  }
  return filter_ok

}

# NIMBA FILTER
##########################################


ns_register_filter preauth GET /scripts/* nimda

ns_register_filter trace  GET /scripts/* nimda_breaktrace


--Tom Jackson

Reply via email to