From 4e1d51ad0b2093570a4e7c714c97cae8cf910da9 Mon Sep 17 00:00:00 2001
From: godog <godog@autistici.org>
Date: Sun, 29 Jun 2014 22:39:02 +0200
Subject: [PATCH] unquote user/pass from nginx

nginx-mail-mapper did the same, which should be enough to make password with %
work, note however that nginx escapes only " " and "%" in this case
(function ngx_escape_uri)
---
 authserv/app_nginx.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/authserv/app_nginx.py b/authserv/app_nginx.py
index 3642961..923bb5c 100644
--- a/authserv/app_nginx.py
+++ b/authserv/app_nginx.py
@@ -1,5 +1,6 @@
 import socket
 import threading
+import urllib
 from flask import Flask, request, abort, make_response
 from authserv.app_common import do_auth
 
@@ -21,8 +22,8 @@ def _shard_to_ip(shard):
 @app.route('/', methods=('GET',))
 def do_nginx_http_auth():
     service = app.config.get('NGINX_AUTH_SERVICE', 'mail')
-    username = request.environ.get('HTTP_AUTH_USER')
-    password = request.environ.get('HTTP_AUTH_PASS')
+    username = urllib.unquote(request.environ.get('HTTP_AUTH_USER'))
+    password = urllib.unquote(request.environ.get('HTTP_AUTH_PASS'))
     source_ip = request.environ.get('HTTP_CLIENT_IP')
     protocol = request.environ.get('HTTP_AUTH_PROTOCOL')
     try:
-- 
GitLab