if ((ret = buf_error(resp_buf)))
goto out;
- /* XX: Is this initial GET / (to populate LastMRH_Session and MRHSession
- * cookies) actually necessary?
+ /* XX: This initial 'GET /' seems to be necessary to populate LastMRH_Session and
+ * MRHSession cookies, without which the subsequent 'POST' will fail.
*/
ret = do_https_request(vpninfo, "GET", NULL, NULL, &form_buf, 1);
free(form_buf);
if (ret < 0)
return ret;
- /* XX: Is this second GET /my.policy (to update MRHSession cookie)
- * also necessary?
- */
- free(vpninfo->urlpath);
- if (!(vpninfo->urlpath = strdup("my.policy"))) {
+ /* XX: build static form (username and password) */
+ form = calloc(1, sizeof(*form));
+ if (!form) {
nomem:
ret = -ENOMEM;
goto out;
}
- ret = do_https_request(vpninfo, "GET", NULL, NULL, &form_buf, 1);
- free(form_buf);
- form_buf = NULL;
- if (ret < 0)
- return ret;
-
- /* XX: build static form (username and password) */
- form = calloc(1, sizeof(*form));
- if (!form)
- goto nomem;
opt = form->opts = calloc(1, sizeof(*opt));
if (!opt)
goto nomem;
print("Initial GET / to populate LastMRH_Session and MRHSession cookies...", file=stderr)
res = s.get(endpoint.geturl(), allow_redirects=False)
assert any(c.value for c in s.cookies if c.name=='MRHSession') and any(c.value for c in s.cookies if c.name=='LastMRH_Session')
-print("GET /my.policy to update MRHSession cookie...", file=stderr)
-res = s.get(endpoint._replace(path='/my.policy').geturl(), allow_redirects=False, headers={'Referer': res.url})
+#print("GET /my.policy to update MRHSession cookie...", file=stderr)
+#res = s.get(endpoint._replace(path='/my.policy').geturl(), allow_redirects=False, headers={'Referer': res.url})
#print("GET /vdesk/timeoutagent-i.php to update TIN cookie (probably unnecessary).")
#res = s.get(endpoint._replace(path='/vdesk/timeoutagent-i.php').geturl(), allow_redirects=False)