diff options
author | stanley lieber <stanley.lieber@gmail.com> | 2013-02-04 16:40:05 -0600 |
---|---|---|
committer | stanley lieber <stanley.lieber@gmail.com> | 2013-02-04 16:40:05 -0600 |
commit | c877493fb00717de1a22860d88efb75ebf14ebec (patch) | |
tree | cb3cb0e47598e2880cdd20367925102856d41a5d /rc/bin/rc-httpd/handlers/redirect | |
parent | 0b212ed5054cd08bbc14a12936c07bc1ff5890a2 (diff) |
add rc-httpd
Diffstat (limited to 'rc/bin/rc-httpd/handlers/redirect')
-rwxr-xr-x | rc/bin/rc-httpd/handlers/redirect | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/rc/bin/rc-httpd/handlers/redirect b/rc/bin/rc-httpd/handlers/redirect new file mode 100755 index 000000000..e223091eb --- /dev/null +++ b/rc/bin/rc-httpd/handlers/redirect @@ -0,0 +1,30 @@ +#!/bin/rc +if(~ $#2 0){ + error 500 + exit +} +switch($1){ +case perm* + do_log 301 + echo 'HTTP/1.1 301 Moved Permanently'^$cr +case temp* + do_log 302 + echo 'HTTP/1.1 302 Moved Temporarily'^$cr +case seeother + do_log 303 + echo 'HTTP/1.1 303 See Other'^$cr +case * + error 500 + exit +} +echo 'Location: ' ^ $2 ^ $cr +emit_extra_headers +echo 'Content-type: text/html'^$cr +echo $cr +echo '<html><body>' +if(~ $#3 0) + echo 'Browser did not accept redirect.' +if not + echo $3 +echo '<a href="'^$"location^'/">Click here</a>' +echo '</body></html>' |