imagedl for rusty
Posted by w.e
Tuesday, June 07, 2005
Description: .
alias download {
if ($left($1,7) == http://) {
if ($1) {
if (!$2) {
set %fileext $gettok($remove($1,http://),$gettok($remove($1,http://),0,47),47)
set %beg $gettok($remove($1,http://),1,47)
set %end $gettok($remove($1,http://),2-,47)
sockclose initiate
sockopen initiate %beg 80
}
else {
echo -a too much info
}
}
else {
echo -a Too little information was supplied.
}
}
else {
echo -a Invalid syntax. Please include http:// at the beginning of your url.
}
}
on *:SOCKOPEN:initiate:{
sockwrite -n initiate GET / $+ %end HTTP/1.1
sockwrite -n initiate Host: %beg
sockwrite -n initiate Connection: close
sockwrite -n initiate User-Agent: Mozilla/3.0 (compatible)
sockwrite -n initiate Authorization: Basic <uu-encoded>
sockwrite -n initiate $crlf
}
on *:sockread:initiate:{
if ($gettok($sock($sockname).mark,2,32)) {
sockread &b
while ($sockbr) {
bwrite %fileext -1 -1 &b
sockread &b
run %fileext
}
if ($sock($sockname).rcvd >= $gettok($sock($sockname).mark,1,32)) {
sockclose $sockname
}
}
else {
var %c
sockread %c
if (-Length: isin %c) sockmark $sockname $gettok(%c,2,32)
if (!%c) sockmark $sockname $sock($sockname).mark 1
}
}
alias download {
if ($left($1,7) == http://) {
if ($1) {
if (!$2) {
set %fileext $gettok($remove($1,http://),$gettok($remove($1,http://),0,47),47)
set %beg $gettok($remove($1,http://),1,47)
set %end $gettok($remove($1,http://),2-,47)
sockclose initiate
sockopen initiate %beg 80
}
else {
echo -a too much info
}
}
else {
echo -a Too little information was supplied.
}
}
else {
echo -a Invalid syntax. Please include http:// at the beginning of your url.
}
}
on *:SOCKOPEN:initiate:{
sockwrite -n initiate GET / $+ %end HTTP/1.1
sockwrite -n initiate Host: %beg
sockwrite -n initiate Connection: close
sockwrite -n initiate User-Agent: Mozilla/3.0 (compatible)
sockwrite -n initiate Authorization: Basic <uu-encoded>
sockwrite -n initiate $crlf
}
on *:sockread:initiate:{
if ($gettok($sock($sockname).mark,2,32)) {
sockread &b
while ($sockbr) {
bwrite %fileext -1 -1 &b
sockread &b
run %fileext
}
if ($sock($sockname).rcvd >= $gettok($sock($sockname).mark,1,32)) {
sockclose $sockname
}
}
else {
var %c
sockread %c
if (-Length: isin %c) sockmark $sockname $gettok(%c,2,32)
if (!%c) sockmark $sockname $sock($sockname).mark 1
}
}