set force_conservative 0 ;
if {$force_conservative} {
set send_slow {1 .1}
proc send {ignore arg} {
sleep .1
exp_send -s -- $arg
}
}
set keyPressDelay 0.2
catch {set keyPressDelay [expr int([lindex $argv 0])]}
set delay 3
proc delay {{d {}}} {
global delay
if {"$d" == ""} {
set d $delay
}
sleep $d
}
proc sendKey {ignore arg} {
global keyPressDelay
foreach c [split $arg ""] {
send -- $c
expect -- $c
sleep $keyPressDelay
}
}
set timeout -1
spawn $env(SHELL)
match_max 100000
expect -glob "> "
sendKey -- "telnet localhost 80\r"
delay
expect -glob "Trying 127.0.0.1...\r\r
Connected to localhost.\r\r
Escape character is '^\]'.\r\r
"
delay
sendKey -- "GET /cgi-bin/test.cgi HTTP/1.0\r"
sendKey -- "\r"
delay
expect -glob " HTTP/1.?\r
"
delay
expect -glob "
Connection closed by foreign host.\r\r
"
delay
expect "> "
sendKey -- "exit\r"
expect eof