Class ::xo::HttpRequestTrace

::xo::HttpRequestTrace[i] create ...

Class Relations

  • class: ::xotcl::Class[i]
  • superclass: ::xotcl::Object[i]
::xotcl::Class create ::xo::HttpRequestTrace \
     -superclass ::xotcl::Object

Methods (to be applied on instances)

  • POST (scripted)

    :instvar F post_data
    puts $F "Content-Length: [string length $post_data]"
    puts $F "Content-Type: [:content_type]"
    puts $F ""
    fconfigure $F -translation {auto binary}
    puts -nonewline $F $post_data
    next
  • cancel (scripted)

    catch {close ${:F}}
    next
  • finish (scripted)

    catch {close ${:F}}
    next
  • init (scripted)

    :instvar F post_data
    set :meta [list]
    set :requestCount [nsv_incr HttpRequestTrace count]  ;# make it an instvar to find it in the log file
    set F [open [ad_tmpdir]/req-[format %.4d ${:requestCount}] w]
    
    set method [expr {$post_data eq "" ? "GET" : "POST"}]
    puts $F "$method [:path] HTTP/1.0"
    puts $F "Host: [:host]"
    puts $F "User-Agent: [:user_agent]"
    foreach {tag value} [:request_header_fields] { puts $F "$tag: $value" }
    next