[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [flashproxy/master] Bracket IPv6 addresses returned from appspot.



commit d837ddd690fb976e31f4ec87546072cd2f0c84ae
Author: Arlo Breault <arlolra@xxxxxxxxx>
Date:   Sun May 19 11:04:24 2013 -0700

    Bracket IPv6 addresses returned from appspot.
---
 appspot/fp.go |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/appspot/fp.go b/appspot/fp.go
index ea19c89..93465c3 100644
--- a/appspot/fp.go
+++ b/appspot/fp.go
@@ -2,6 +2,7 @@ package fp
 
 import (
 	"fmt"
+	"net"
 	"net/http"
 
 	"appengine"
@@ -11,7 +12,11 @@ import (
 const BASE = "https://fp-facilitator.org/reg/";
 
 func ipHandler(w http.ResponseWriter, r *http.Request) {
-	fmt.Fprintf(w, "%s", r.RemoteAddr)
+	remoteAddr := r.RemoteAddr
+	if net.ParseIP(remoteAddr).To4() == nil {
+		remoteAddr = "[" + remoteAddr + "]"
+	}
+	fmt.Fprintf(w, "%s", remoteAddr)
 }
 
 func regHandler(w http.ResponseWriter, r *http.Request) {

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits