My mistake, I forgot I was playing with http:/1.1 and 1.0 and never put a connection tyoe, as well as had a type on the sockread.

Please do note you can only do one download at a time, and I have tested this.

Code:
; ------------------------------------------------------------------------------------------------------
; usage: $download(<link>)
; --
; properties:
;   .owrite - When specified, if a file already exists with the same name as that of ebign downloaded,
;             it is overwritten.  When not specified, the user will be faces with a popup asking if they
;             would like to overwrite the file.
; ------------------------------------------------------------------------------------------------------
alias download {
  if (!$isid) || (!$1) {
    /echo -s Invalid Usage: $ $+ download(link)[.owrite]
    return
  }
  else {
    var %link = $remove($$1, http://) $+ /
    var %host = $gettok(%link, 1, $asc(/))
    var %get = $iif($left($remove(%link, %host), -1), $ifmatch, /)
    if ($sock(download)) /download.close
    /sockopen download %host 80
    /sockmark download %host %get
    /set %download.info $rand(1,9999) $+ $chr(44) $+ $iif($prop && $prop == owrite, 1, 0) $+ ,1
    return $gettok(%download.info, 1, 44)
  }
}

alias download.close {
  if ($sock(download)) /sockclose download
  /unset %download.*
  if ($isFile(download.dat)) .remove download.dat
}

on 1:SOCKOPEN:download: {
  if ($sockerr) {
    /echo -a Error: Could not connect to $gettok($sock($sockname).mark, 1, 32)
    /download.close
  }
  else {
    /sockwrite -n $sockname GET $gettok($sock($sockname).mark, 2-, 32) HTTP/1.0
    /sockwrite -n $sockname Host: $gettok($sock($sockname).mark, 1, 32)
    /sockwrite -n $sockname $crlf
  }
}

on 1:SOCKREAD:download: {
  var %download.header = $gettok(%download.info, 3, 44)
  if (%download.header) {
    /sockread %data
    if (%data == $null) /set %download.info $puttok(%download.info, 0, 3, 44)
  }
  else {
    /sockread -f &data
    /bwrite download.dat -1 -1 &data
  }
}

on 1:SOCKCLOSE:download: {
  .timerdownload -m 1 250 /download.done $sock($sockname).mark
}

alias download.done {
  var %mark = $1-
  var %file = $gettok($nopath($gettok(%mark, 2-, 32)) $+ ?, 1, $asc(?))
  if (%file == $null) %file = index.htm
  var %owrite = $gettok(%download.info, 2, 44)
  if ($isFile(%file)) {
    if (%owrite) || ($$?!="Would you like to overwrite the previous file ( $+ %file $+ )?") .remove %file
  }
  .rename download.dat %file
  .signal DOWNLOAD $gettok(%download.info, 1, 44) %file
  /download.close
}

; ------------------------------------------------------------------------------------------------------
; example code
alias dlTest {
  /echo -a Downloading File...
  /set %dl.id $download($1-)
}

on *:SIGNAL:DOWNLOAD: {
  var %id = $1, %file = $2-
  ; ----------------------
  if (%id == %dl.id) {
    /echo -a File Downloaded ( $+ %file $+ )
    /run %file
  }
}

; EOF
; ------------------------------------------------------------------------------------------------------


works:

/dlText http://www.google.com
/dlTest http://www.google.com/images/logo.gif
/dlText http://home.ceinetworks.com/~hawk/mirc61.exe

I can only assume the others work, but let me know if they dont.


-KingTomato