]> git.plutz.net Git - rpi_small/blob - files/srv/webserver.sed
redirect HTTP requests to mockup web server
[rpi_small] / files / srv / webserver.sed
1 #!/bin/sed -nrf
2
3 :START
4 /\r?\n\r?$/bRESPONSE; N; bSTART;
5
6 :RESPONSE
7
8 /\nHost: oktopus\r?\n/{
9 s;^.*$;;;
10 iHTTP/1.1 200 OK\r\
11 Content-Type: text/html; encoding=utf-8\r\
12 Connection: close\r\
13 \r\
14 <HTML><HEAD><TITLE>Oktopus</TITLE></HEAD><BODY><H1>Oktopus</H1>Oktopus</BODY></HTML>
15 p
16 q
17 }
18
19 s;^.*$;;;
20 iHTTP/1.1 307 Temporary Redirect\r\
21 Location: http://oktopus\r\
22 Connection: close\r\
23 \r\
24 p
25 q