20 Feb 2005 zhaoway   » (Master)

now i'm really wasting my time, ;)

put in ~/.bashrc

    xtitle "netcat"
    if [[ "${2}" == "" || ! -f "${2}" || ! -r "${2}" ]]; then
        echo "Usage: wwwcat PORT FILE"
        echo "PORT is TCP port number on which you must be able to listen"
        echo "FILE is a normal local file readable by you"
        echo "Example: 1. wwwcat 8000 pr0n.gif"
        echo "         then open your browser visit http://localhost:8000"
        echo "         2. while true; do wwwcat 8000 pr0n.gif; done"
        echo "         this can serve more clients one after another"
    resp="HTTP/1.0 200 OK"
    cont_type="Content-Type: "`/usr/bin/file -bi ${2}`
    cont_length="Content-Length: "`/usr/bin/stat -c%s ${2}`
    echo -e ${resp}"\n"${cont_type}"\n"${cont_length}"\n" | /bin/cat - ${2} | /bin/nc -l -p ${1}

i suck. i know. ;)

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!