summaryrefslogtreecommitdiffstats
path: root/dyndns-update/myip
blob: c57ea7a917f4049ca50355c024e87f9a11055de9 (plain)
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
#!/usr/bin/python3

import os
import sys

def out(s=""):
	print(s, file=sys.stdout, end="\r\n")

def outenv(name):
	val = os.environ.get(name)
	if val is None:
		val = ""
	val = val.replace("\r", " ").replace("\n", " ").replace("\0", " ")
	out(f"{name}={val}")

out("Content-type: text/plain")
out("Status: 200 Ok")
out()

for name in ("REMOTE_ADDR",
	     "REMOTE_HOST",
	     "REMOTE_PORT",
	     "HTTPS",
	     "REQUEST_METHOD",
	     "REQUEST_URI",
	     "HTTP_USER_AGENT",
	     "HTTP_HOST",
	     "HTTP_COOKIE",
	     "HTTP_REFERER",
	     "QUERY_STRING", ):
	outenv(name)

sys.exit(0)
bues.ch cgit interface