[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [flashproxy/master] Tolerate other URL parameters in client regisration lines.
commit 3e80ad4f244841beb53f23d70f13bd925c9bc48d
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date: Wed Oct 9 23:06:00 2013 -0700
Tolerate other URL parameters in client regisration lines.
---
facilitator/facilitator-reg-daemon | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/facilitator/facilitator-reg-daemon b/facilitator/facilitator-reg-daemon
index 2cb2904..ed9eb7e 100755
--- a/facilitator/facilitator-reg-daemon
+++ b/facilitator/facilitator-reg-daemon
@@ -7,6 +7,7 @@ import socket
import sys
import threading
import time
+import urlparse
import fac
@@ -81,9 +82,14 @@ def find_client_addr(body):
client=...
Returns None if no client line was found."""
for line in body.splitlines():
- if line.startswith("client="):
- _, client_spec = line.split("=", 1)
- return fac.parse_addr_spec(client_spec)
+ try:
+ qs = urlparse.parse_qs(line, keep_blank_values=True, strict_parsing=True)
+ except ValueError:
+ continue
+ client_specs = qs["client"]
+ if len(client_specs) != 1:
+ continue
+ return fac.parse_addr_spec(client_specs[0])
return None
class Handler(SocketServer.StreamRequestHandler):
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits