httptail

#!/bin/sh
# outputs a file over HTTP 1.1 and pushes updates when new lines are appended
HTTP=/tmp/httptail.fifo
unlink "$HTTP"
mkfifo "$HTTP"

status () { printf '%s\r\n' "HTTP/1.1 200 Ok" >>$HTTP; } 
header () { printf '%s\r\n' "$1" >>$HTTP 2>/dev/null; }
divide () { printf '\r\n' >>$HTTP; }
length () { printf '%x\r\n' "$1" >>$HTTP; }
body_n () { printf '%s\n\r\n' "$1" >>$HTTP; }

tail -f "$HTTP" | tee | nc -l -p 8008 | (
  status
  header "Content-type: $(file --brief --mime "$1")"
  header "Transfer-Encoding: chunked"
  divide
  length "$(wc -c <"$1")"
  body_n "$(cat "$1")"
  tail -n0 -f "$1" | while IFS=$(printf '\n') read -r line; do
    length "$(printf '%s\n' "$line" | wc -c)"
    body_n "$line"
  done
)