ret = -EINVAL;
goto out;
}
- free(vpninfo->urlpath);
- vpninfo->urlpath = strdup(form->action+1);
+ vpninfo->redirect_url = strdup(form->action);
ret = parse_form(vpninfo, form, xml_node, request_body, req_len);
if (ret < 0)
}
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->csd_stuburl[0] == '/' ? 1 : 0));
+ vpninfo->redirect_url = vpninfo->csd_stuburl;
ret = 0;
goto out;
}
}
if (result != 200 && vpninfo->redirect_url) {
+ redirect:
if (!strncmp(vpninfo->redirect_url, "https://", 8)) {
/* New host. Tear down the existing connection and make a new one */
char *host = vpninfo->redirect_url + 8;
result = parse_xml_response(vpninfo, buf, request_body, sizeof(request_body),
&method, &request_body_type);
if (!result)
- goto retry;
+ goto redirect;
if (result != 2)
return result;