-
Notifications
You must be signed in to change notification settings - Fork 1
/
httpd-socat.sh
executable file
·65 lines (42 loc) · 1.19 KB
/
httpd-socat.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#! /bin/sh
if [ -n "$HTTPCHILD" ] || [ $# -ne 0 ]; then
read -r firstline <&3
echo >&4 "you asked $firstline"
echo >&4 "foo"
printenv |grep SOCAT >&4
echo >&4 "BYE"
exit 0
fi
port=1500
bind="localhost"
self="$0"
case "$0" in
(/*) self="$0" ;;
(*) self="$(pwd)/$0";;
esac
SOCAT_VERSION='$SOCAT_VERSION'
#SOCAT_PID='$SOCAT_PID' SOCAT_PPID='$SOCAT_PPID'
script="/usr/bin/env -i - ROOTDIR='$rootdir' TMPFILE='$TMPFILE' \
HTTPCHILD=true PATH='$PATH' HOME=/ \
SOCAT_PEERADDR='\$SOCAT_PEERADDR' SOCAT_PEERPORT='\$SOCAT_PEERPORT' \
SOCAT_SOCKADDR='\$SOCAT_SOCKADDR' SOCAT_SOCKPORT='\$SOCAT_SOCKPORT' '$self'"
#script="/usr/bin/env - ROOTDIR='$rootdir' TMPFILE='$TMPFILE' HTTPCHILD=true PATH='$PATH' '$self'"
script="'$self' child"
# EXEC:"mail.sh [email protected]",fdin=3,fdout=4
socat \
TCP4-LISTEN:${port},bind=${bind},reuseaddr,fork,crlf,nodelay \
EXEC:"${script}",pty,stderr,fdin=3,fdout=4
#stderr
#tcpwrap=sh-httpd
#crnl
#nodelay
#keepalive
#bind=myaddr1,reuseaddr
#max-children=<count>
#sighup, sigint, sigquit
#path=<string> overwrite PATH
#chroot=/home/sandbox,su-d=sandbox
# tcpwrap[=<name>]
# allow-table=/path/to/hosts.allow
# deny-table=/path/to/hosts.deny
# tcpwrap-etc=/path/to