Forum Discussion

Robert_47833's avatar
Robert_47833
Icon for Altostratus rankAltostratus
May 27, 2015

[HTTP::payload] in event HTTP_REQUEST_DATA only respresent data collected or the whole http payload?

hi,dear irule

1:HTTP::collect $content_length collects up to 1MB of data,how to call this data?

2:[HTTP::payload] in event HTTP_REQUEST_DATA only respresent 1MB data or the whole http payload?

      when HTTP_REQUEST {



  if {[HTTP::method] eq "POST"}{

     Trigger collection for up to 1MB of data

    if {[HTTP::header "Content-Length"] ne "" && [HTTP::header "Content-Length"] <= 1048576}{

      set content_length [HTTP::header "Content-Length"]

    } else {

        set content_length 1048576

    }

     Check if $content_length is not set to 0

    if { $content_length > 0} {

      HTTP::collect $content_length

    }

  }

}

when HTTP_REQUEST_DATA {
 set payload [HTTP::payload]

8 Replies

  • 2:[HTTP::payload] in event HTTP_REQUEST_DATA only respresent 1MB data or the whole http payload?

     

    it will return whole payload. if you want only 1mb, you have to include 1048576 e.g. HTTP::payload 1048576

     

    • Robert_47833's avatar
      Robert_47833
      Icon for Altostratus rankAltostratus
      even I collect up to 1M data? set content_length 1048576 HTTP::collect $content_length
    • Robert_47833's avatar
      Robert_47833
      Icon for Altostratus rankAltostratus
      HTTP::payload &182; Returns the content that the HTTP::collect command has collected thus far, up to the number of bytes specified. If you do not specify a size, the system returns the entire collected content. becasue I only collected 1M, does it mean it will only respent 1M data?
  • 2:[HTTP::payload] in event HTTP_REQUEST_DATA only respresent 1MB data or the whole http payload?

     

    it will return whole payload. if you want only 1mb, you have to include 1048576 e.g. HTTP::payload 1048576

     

    • Robert_47833's avatar
      Robert_47833
      Icon for Altostratus rankAltostratus
      even I collect up to 1M data? set content_length 1048576 HTTP::collect $content_length
    • Robert_47833's avatar
      Robert_47833
      Icon for Altostratus rankAltostratus
      HTTP::payload &182; Returns the content that the HTTP::collect command has collected thus far, up to the number of bytes specified. If you do not specify a size, the system returns the entire collected content. becasue I only collected 1M, does it mean it will only respent 1M data?