Gitweb links:
...log
http://git.netsurf-browser.org/netsurf-test.git/shortlog/1e32c8cd3db78d2494dc30b08ac2fe23a2247f6c
...commit
http://git.netsurf-browser.org/netsurf-test.git/commit/1e32c8cd3db78d2494dc30b08ac2fe23a2247f6c
...tree
http://git.netsurf-browser.org/netsurf-test.git/tree/1e32c8cd3db78d2494dc30b08ac2fe23a2247f6c
The branch, master has been updated
via 1e32c8cd3db78d2494dc30b08ac2fe23a2247f6c (commit)
from cef783d1432efc5594c2d9ad39e6749b1c4e95d9 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf-test.git/commit/?id=1e32c8cd3db78d2494dc30b08ac2fe23a2247f6c
commit 1e32c8cd3db78d2494dc30b08ac2fe23a2247f6c
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>
Support changing realm
diff --git a/cgi-bin/auth.cgi b/cgi-bin/auth.cgi
index 83210d8..7f7aa71 100755
--- a/cgi-bin/auth.cgi
+++ b/cgi-bin/auth.cgi
@@ -4,23 +4,23 @@ import cgi
import cgitb
cgitb.enable()
-print('WWW-Authenticate: Basic realm="NetSurf Authentication test"')
-print('Content-Type: text/plain')
-print('')
-
import os
from base64 import b64decode
auth = os.getenv("HTTP_AUTHORIZATION")
-query = os.getenv("QUERY_STRING") or "user=foo&pass=bar"
+query = os.getenv("QUERY_STRING") or
"user=foo&pass=bar&realm=NetSurf+Authentication+Test"
query = cgi.parse_qs(query)
username = query.get("user", ["foo"])[0]
password = query.get("pass", query.get("password", ["bar"]))[0]
+realm = query.get("realm", ["NetSurf Authentication Test"])
gotuser = None
gotpass = None
def badauth(reason="NOAUTH"):
+ print('WWW-Authenticate: Basic realm="{}"'.format(realm))
+ print('Content-Type: text/plain')
+ print('')
print('result=BAD, username={}/{}, password={}/{},
reason={}'.format(gotuser, username, gotpass, password, reason))
raise SystemExit
@@ -42,4 +42,6 @@ else:
badauth("BADPASS")
+print('Content-Type: text/plain')
+print('')
print("result=GOOD, username={}, password={}".format(username, password))
-----------------------------------------------------------------------
Summary of changes:
cgi-bin/auth.cgi | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/cgi-bin/auth.cgi b/cgi-bin/auth.cgi
index 83210d8..7f7aa71 100755
--- a/cgi-bin/auth.cgi
+++ b/cgi-bin/auth.cgi
@@ -4,23 +4,23 @@ import cgi
import cgitb
cgitb.enable()
-print('WWW-Authenticate: Basic realm="NetSurf Authentication test"')
-print('Content-Type: text/plain')
-print('')
-
import os
from base64 import b64decode
auth = os.getenv("HTTP_AUTHORIZATION")
-query = os.getenv("QUERY_STRING") or "user=foo&pass=bar"
+query = os.getenv("QUERY_STRING") or
"user=foo&pass=bar&realm=NetSurf+Authentication+Test"
query = cgi.parse_qs(query)
username = query.get("user", ["foo"])[0]
password = query.get("pass", query.get("password", ["bar"]))[0]
+realm = query.get("realm", ["NetSurf Authentication Test"])
gotuser = None
gotpass = None
def badauth(reason="NOAUTH"):
+ print('WWW-Authenticate: Basic realm="{}"'.format(realm))
+ print('Content-Type: text/plain')
+ print('')
print('result=BAD, username={}/{}, password={}/{},
reason={}'.format(gotuser, username, gotpass, password, reason))
raise SystemExit
@@ -42,4 +42,6 @@ else:
badauth("BADPASS")
+print('Content-Type: text/plain')
+print('')
print("result=GOOD, username={}, password={}".format(username, password))
--
NetSurf test cases
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org