changeset 612:59588bbf8d55

Remove possible trailing slash from proxy URI.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 20 May 2014 06:20:43 +0300
parents 019a54b07f60
children 2cd71b7c1e8e
files main.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/main.c	Tue May 20 05:34:33 2014 +0300
+++ b/main.c	Tue May 20 06:20:43 2014 +0300
@@ -184,6 +184,7 @@
     BOOL ret = FALSE;
     char *proto = NULL, *rest = NULL, *host = NULL,
          *auth = NULL, *port = NULL;
+    size_t len;
 
     if (!argSplitStr(uri, "://", &proto, &rest))
     {
@@ -210,6 +211,11 @@
         goto out;
     }
 
+    // Remove trailing slash
+    len = strlen(rest) - 1;
+    if (rest[len] == '/')
+        rest[len] = 0;
+
     // Check for auth credentials
     if (argSplitStr(rest, "@", &auth, &host))
     {