Jon_Strabala_46
Feb 03, 2010Nimbostratus
How to use HTTP::respond to send a 1x1 gif
Hello,
I am trying to write a simple iRule to that uses HTTP::respond (from HTTP_REQUEST) to send a 1x1 gif back to the client on any request.
I build a 1x1 gif (44 bytes) but somehow it expands into 67 bytes at the client any ideas on what I am doing wrong?
- Jon
when RULE_INIT {
set ::t1x1gif \x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\xff\xff\xff\xff
append ::t1x1gif \xff\xff\x21\xf9\x04\x01\x0a\x00\x01\x00\x2c\x00\x00\x00\x00\x01\x00
append ::t1x1gif \x01\x00\x00\x02\x02\x4c\x01\x00\x3b\x00
log local0. "length of 1x1 transparent gif == [string length $::t1x1gif]"
}
when HTTP_REQUEST {
The GIF is 44 bytes, but the Response Header says "Content-Length67" - and it is not a legal image
what am I doing wrong ?
log local0. "respond with a 1x1 transparent gif"
HTTP::respond 200 content $::t1x1gif "Accept-Ranges" "bytes" "Content-Type" "image/gif" "Content-Length" 44 "Dummy" 1999
HTTP::respond 200 content $::t1x1gif "Accept-Ranges" "bytes" "Content-Type" "image/gif"
}
-------------
request ...
-------------
(Request-Line)GET /prox_evdo/auth.gif HTTP/1.1
Host10.0.185.150
User-AgentMozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)
Acceptimage/png,image/*;q=0.8,*/*;q=0.5
Accept-Languageen-us,en;q=0.5
Accept-Encodinggzip,deflate
Accept-CharsetISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive115
Connectionkeep-alive
-------------
response ...
-------------
(Status-Line)HTTP/1.0 200 OK
Accept-Rangesbytes
Content-Typeimage/gif
Dummy1999
ServerBigIP
ConnectionKeep-Alive
Content-Length67
-------------
ltm log
-------------
Feb 3 10:57:41 local/tmm1 info tmm1[21110]: Rule serve_gif : length of 1x1 transparent gif == 44
Feb 3 10:58:44 local/tmm info tmm[21109]: Rule serve_gif : respond with a 1x1 transparent gif