Skip to content

Commit 4dba05c

Browse files
substacksubstack
substack
authored and
substack
committed
bash http server
1 parent 2b2e12b commit 4dba05c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

networks/server.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
# to run: ./server.sh | nc -lp 9000
3+
# then go to http://localhost:9000
4+
FILE=$HOME/media/photo/tux-kitty.jpg
5+
echo HTTP/1.1 200 OK
6+
echo Content-Type: image/jpeg
7+
echo Content-Length: `wc -c $FILE`
8+
echo
9+
cat $FILE

0 commit comments

Comments
 (0)