Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

pure zsh implementation of wget



Hi! 

I was wondering if someone could point me to a pure zsh implementation of a function/script that downloads files like wget. 

I have been look at this (slightly modified from http://rosettacode.org/wiki/HTTP#Zsh): 

$cat wget.zsh
#!/usr/bin/env zsh
zmodload zsh/net/tcp
ztcp google.com 80
fd=$REPLY
print -l -u $fd -- 'GET / HTTP/1.1' 'Host: google.com' ''
while read -u $fd -r -e -t 1; do; :; done
ztcp -c $fd

However, when I run this script, I do not receive any files. Neither do I observe any other results. I tried it with other sites, e.g. replacing google.com by localhost, and so on. 

Does someone know what am I missing? 

BTW, would this work with https as well? 

Thanks in advance! 

Guido 




Messages sorted by: Reverse Date, Date, Thread, Author