Commit | Line | Data |
---|---|---|
1 | #!/bin/bash | |
2 | ififo="/tmp/$$.osck"; | |
3 | ofifo="/tmp/$$.isck"; | |
4 | mkfifo "$ififo"; | |
5 | mkfifo "$ofifo"; | |
6 | ||
7 | passfifo() { | |
8 | while true; do | |
9 | cat "%1"; | |
10 | done | |
11 | } | |
12 | ||
13 | while true; do | |
14 | echo -ne 'HTTP/1.1 200 OK\n\n' > "$ofifo"; | |
15 | passfifo "$ofifo" | nc -l -p 8080 > "$ififo" & | |
16 | cat "$ififo" | head -n 1 | cut -d ' ' -f 2 | read line; | |
17 | echo "$line"; | |
18 | echo "$line" > "$ofifo"; | |
19 | kill "$!"; | |
20 | done; |