Wednesday 8 June 2011

Can it make a cup of coffee

Sometimes after weeks of troubleshooting network issues people ask in jest, can it make a cup of coffee?

when HTTP_REQUEST {
set coffee { 5)3;; 4(3;; 2+1-5+1;; 2|1 5|1]1;; 2\1-5/1;;_9_2;;\1_9/1}
set response "<html><head><title>Coffee 2.0</title></head><body><pre>"
switch [HTTP::uri] {
"/coffee" {
append response "<p>"
for {set x 0} {$x < [string length $coffee] } {incr x} {
set mychar [string index $coffee $x]
set myrepeat [string index $coffee [incr x]]
if {$mychar equals ";"} {
append response "<br>"
continue
}
append response [string repeat $mychar $myrepeat]
}
append response "<p></pre><i><small>Your coffee is served.<p>"
append response "The Virtual Coffee Machine<p>"
HTTP::respond 200 content $response
event disable all
}
}
}

 

F5 OS Version: 10.2.0
Author: Kevin Davies

No comments:

Post a Comment