Skip to content

Commit

Permalink
attempt to handle POST
Browse files Browse the repository at this point in the history
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Oct 1, 2008
1 parent 19b0fce commit 744b571
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions http.c
Expand Up @@ -253,8 +253,12 @@ int obtain_cookie(struct anyconnect_info *vpninfo)
xmlNode *xml_node;
char buf[65536];
int result, buflen;
char request_body[2048];
char *request_body_type = NULL;
char *method = "GET";

request_body[0] = 0;

retry:
if (!vpninfo->https_ssl && open_https(vpninfo)) {
fprintf(stderr, "Failed to open HTTPS connection to %s\n",
Expand All @@ -273,13 +277,23 @@ int obtain_cookie(struct anyconnect_info *vpninfo)
*/
my_SSL_printf(vpninfo->https_ssl, "%s %s HTTP/1.1\r\n", method, vpninfo->urlpath);
my_SSL_printf(vpninfo->https_ssl, "Host: %s\r\n", vpninfo->hostname);
my_SSL_printf(vpninfo->https_ssl, "Accept: */*\r\n");
my_SSL_printf(vpninfo->https_ssl, "Accept-Encoding: identity\r\n");
if (vpninfo->cookies) {
my_SSL_printf(vpninfo->https_ssl, "Cookie: ");
for (opt = vpninfo->cookies; opt; opt = opt->next)
my_SSL_printf(vpninfo->https_ssl, "%s=%s%s", opt->option,
opt->value, opt->next?"; ":"\r\n");
}
if (request_body_type) {
my_SSL_printf(vpninfo->https_ssl, "Content-Type: %s\r\n",
request_body_type);
my_SSL_printf(vpninfo->https_ssl, "Content-Length: %zd\r\n",
strlen(request_body));
}
my_SSL_printf(vpninfo->https_ssl, "X-Transcend-Version: 1\r\n\r\n");
if (request_body_type)
SSL_write(vpninfo->https_ssl, request_body, strlen(request_body));

buflen = process_http_response(vpninfo, &result, NULL, buf, 65536);
if (buflen < 0) {
Expand Down

0 comments on commit 744b571

Please sign in to comment.