comparison main.c @ 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 b10d81ddfc55
children 2cd71b7c1e8e
comparison
equal deleted inserted replaced
611:019a54b07f60 612:59588bbf8d55
182 { 182 {
183 // Attempt to parse the proxy URI 183 // Attempt to parse the proxy URI
184 BOOL ret = FALSE; 184 BOOL ret = FALSE;
185 char *proto = NULL, *rest = NULL, *host = NULL, 185 char *proto = NULL, *rest = NULL, *host = NULL,
186 *auth = NULL, *port = NULL; 186 *auth = NULL, *port = NULL;
187 size_t len;
187 188
188 if (!argSplitStr(uri, "://", &proto, &rest)) 189 if (!argSplitStr(uri, "://", &proto, &rest))
189 { 190 {
190 THERR("Malformed proxy URI, should be <type>://[<userid>[:passwd]@]<host>[:<port>]\n"); 191 THERR("Malformed proxy URI, should be <type>://[<userid>[:passwd]@]<host>[:<port>]\n");
191 goto out; 192 goto out;
207 if (strlen(rest) == 0) 208 if (strlen(rest) == 0)
208 { 209 {
209 THERR("Malformed proxy URI, no host specified.\n"); 210 THERR("Malformed proxy URI, no host specified.\n");
210 goto out; 211 goto out;
211 } 212 }
213
214 // Remove trailing slash
215 len = strlen(rest) - 1;
216 if (rest[len] == '/')
217 rest[len] = 0;
212 218
213 // Check for auth credentials 219 // Check for auth credentials
214 if (argSplitStr(rest, "@", &auth, &host)) 220 if (argSplitStr(rest, "@", &auth, &host))
215 { 221 {
216 if (strlen(auth) == 0) 222 if (strlen(auth) == 0)