Forum Discussion

Conor_Cunningha's avatar
Conor_Cunningha
Icon for Nimbostratus rankNimbostratus
Oct 22, 2008

HTTP::retry

G'day,

 

 

I have the following code;

 

 

when HTTP_REQUEST { 
  
  
 if { [HTTP::method] == "POST" } { 
  
 log local0.alert "We have a POST" 
 set post 1 
 set request [HTTP::request] 
  
 if { [HTTP::header exists "Content-Length"] } { 
    
   HTTP::collect [HTTP::header "Content-Length"] 
  
 } else { HTTP::collect 10000 } 
  
 } else { 
 log local0.alert "DO WE EVER GET HERE" 
 event disable all 
 } 
 } 
  
 when HTTP_REQUEST_DATA { 
  
  do stuff 
 HTTP::release 
 } 
 

 

 

I was wondering whether the HTTP::release in HTTP_REQUEST_DATA releases the memory used for the set request [HTTP::request]

 

 

Otherwise I think I'm effectively going to run out of memory very quickly as I only have a small Big IP 1500 with little memory.

 

 

If it doesn't free the memory, is there a way of freeing the memory used by HTTP::request ?

 

 

Cheers,

 

 

Conor

2 Replies

  • Hi Conor,

     

     

    You could explicitly unset request to clear the memory (unset request).

     

     

    Also, I don't think you need to use HTTP::release in HTTP_REQUEST_DATA:

     

     

     

    HTTP::release wiki page

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/http__release

     

     

    Releases the data collected via HTTP::collect. Unless a subsequent HTTP::collect command was issued, there is no need to use the HTTP::release command inside of the HTTP_REQUEST_DATA and HTTP_RESPONSE_DATA events, since (in these cases) the data is implicitly released.

     

     

     

     

    And IE can send post requests with a content length header set to 0. There is a note on the HTTP::collect page warning against collecting without a value. Perhaps you would want to only collect if the the Content-Length value exists and is greater than 0?

     

     

    Aaron
  • Thanks for the heads up Aaron. I started to use the unset command and that has helped a bit. I'll wrap up the HTTP::collect in an if.

     

     

    Thanks a million,

     

     

    Conor