Remove leading '/' from csd_stuburl and csd_waiturl strings
authorAdam Piątyszek <ediap@users.sourceforge.net>
Tue, 4 Aug 2009 12:05:40 +0000 (14:05 +0200)
committerAdam Piątyszek <ediap@users.sourceforge.net>
Tue, 4 Aug 2009 12:05:40 +0000 (14:05 +0200)
This was necessary, because of connection errors when using:
"xxx.yyy.com//CACHE/sdesktop/install/binaries/sfinst"
FIXME: this should be implemented in a more generic way!

Signed-off-by: Adam Piątyszek <ediap@users.sourceforge.net>
auth.c
http.c

diff --git a/auth.c b/auth.c
index f24c68e..1b6d89b 100644 (file)
--- a/auth.c
+++ b/auth.c
@@ -373,7 +373,8 @@ int parse_xml_response(struct openconnect_info *vpninfo, char *response,
        if (vpninfo->csd_token && vpninfo->csd_ticket && vpninfo->csd_starturl && vpninfo->csd_waiturl) {
                /* First, redirect to the stuburl -- we'll need to fetch and run that */
                free(vpninfo->urlpath);
-               vpninfo->urlpath = strdup(vpninfo->csd_stuburl);
+               vpninfo->urlpath = strdup(vpninfo->csd_stuburl +
+                                         (vpninfo->csd_stuburl[0] == '/' ? 1 : 0));
                ret = 0;
                goto out;
        }
diff --git a/http.c b/http.c
index d4b8a3e..86fff19 100644 (file)
--- a/http.c
+++ b/http.c
@@ -326,7 +326,8 @@ static int run_csd_script(struct openconnect_info *vpninfo, char *buf)
 
        free(vpninfo->csd_stuburl);
        vpninfo->csd_stuburl = NULL;
-       vpninfo->urlpath = strdup(vpninfo->csd_waiturl);
+       vpninfo->urlpath = strdup(vpninfo->csd_waiturl +
+                                 (vpninfo->csd_waiturl[0] == '/' ? 1 : 0));
        vpninfo->csd_waiturl = NULL;
        return 0;
 }