~moody/rc-gemd

ref: 89c9f20250438c4768fc3186d9d83b45d2997c03 rc-gemd/rc-gemd -rwxr-xr-x 514 bytes
89c9f202Moody Parse query options properly 11 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/rc
rc_gemd_dir=/rc/bin/rc-gemd
path=(/bin $rc_gemd_dir/handlers)
cr=

url=`{sed 's/'$cr'//;1q'}
if(~ $url *://*){
	scheme=`{echo $url | sed 's,://.*,,g'}
	url=`{echo $url | sed 's,'^$scheme^'://,,'}
}
if not
	scheme='gemini://'

server_name=`{echo $url | sed 's,/.*,,'}
location=`{echo $url | sed 's,[a-zA-Z0-9.:]+/?,/,'}

query=`{echo $location | sed 's,[^?]*\??,,'}
location=`{echo $location | sed 's,\?.*,,'}

echo request from `{sed 's/!.*//' $net/remote} to $url >[1=2]

. $rc_gemd_dir/select-handler