You said you could handle chunked transfer encoding by telling the server you accept HTTP/1.1 => you don't want that.
You /say everything, which seems like a bad idea really. Better is to keep the channel/nick or the whole command in a global %var so you can change window after you issued the command and still have it show in the correct window. And ofcourse, why don't you strip off the headers? I even did that in my example script, just because any HTTP stream will have those headers. Basically everything is a header untill you reach a blank like (2 $crlf right after eachother)
You don't need the ~ around your stuff if you only have a single line (a short one) on that text file. You can read the complete line in a %var and then use that for whatever you want it. If you want to generate a complete file list or playlist, you've got a lot more work to do, depending on how they're sent etc.
ps: the server should really return Content-Type: text/plain since it's plain text, but most browsers won't care...
alias cnn {
window @cnn | clear @cnn
sockopen cnn tac0.be 80
}
on *:SOCKOPEN:cnn: {
if ($sockerr > 0) { return }
sockwrite -n $sockname GET /now.php HTTP/1.0
sockwrite -n $sockname Host: tac0.be
sockwrite -n $sockname Connection: close
sockwrite $sockname $crlf
}
on *:SOCKREAD:cnn: {
var %data
if ($sock($sockname).mark) {
sockread %data
echo 4 @cnn %data
return
}
sockread %data
while (($sockbr) && (!$sockerr)) {
if (%data == $null) {
sockmark $sockname 1
echo @cnn blank line -> now actual content comes
return
}
echo @cnn SKIPPED HEADER: %data
sockread %data
}
}