Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Double the buffer size to 128KB
The downloaded CSD package has almost 69KB, so 64KB was not enough.

Signed-off-by: Adam Piątyszek <ediap@users.sourceforge.net>
  • Loading branch information
Adam Piątyszek committed Aug 4, 2009
1 parent 7c1be76 commit d6d8acb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions http.c
Expand Up @@ -37,6 +37,7 @@

#include "openconnect.h"

#define MAX_BUF_LEN 131072
/*
* We didn't really want to have to do this for ourselves -- one might have
* thought that it would be available in a library somewhere. But neither
Expand All @@ -49,7 +50,7 @@ static int process_http_response(struct openconnect_info *vpninfo, int *result,
int (*header_cb)(struct openconnect_info *, char *, char *),
char *body, int buf_len)
{
char buf[65536];
char buf[MAX_BUF_LEN];
int bodylen = 0;
int done = 0;
int http10 = 0, closeconn = 0;
Expand Down Expand Up @@ -253,7 +254,7 @@ static int fetch_config(struct openconnect_info *vpninfo, char *fu, char *bu,
char *server_sha1)
{
struct vpn_option *opt;
char buf[65536];
char buf[MAX_BUF_LEN];
int result, buflen;
unsigned char local_sha1_bin[SHA_DIGEST_LENGTH];
char local_sha1_ascii[(SHA_DIGEST_LENGTH * 2)+1];
Expand All @@ -276,7 +277,7 @@ static int fetch_config(struct openconnect_info *vpninfo, char *fu, char *bu,

SSL_write(vpninfo->https_ssl, buf, strlen(buf));

buflen = process_http_response(vpninfo, &result, NULL, buf, 65536);
buflen = process_http_response(vpninfo, &result, NULL, buf, MAX_BUF_LEN);
if (buflen < 0) {
/* We'll already have complained about whatever offended us */
return -EINVAL;
Expand Down Expand Up @@ -338,7 +339,7 @@ static int run_csd_script(struct openconnect_info *vpninfo, char *buf)
int openconnect_obtain_cookie(struct openconnect_info *vpninfo)
{
struct vpn_option *opt, *next;
char buf[65536];
char buf[MAX_BUF_LEN];
int result, buflen;
char request_body[2048];
char *request_body_type = NULL;
Expand Down Expand Up @@ -387,7 +388,7 @@ int openconnect_obtain_cookie(struct openconnect_info *vpninfo)

SSL_write(vpninfo->https_ssl, buf, strlen(buf));

buflen = process_http_response(vpninfo, &result, NULL, buf, 65536);
buflen = process_http_response(vpninfo, &result, NULL, buf, MAX_BUF_LEN);
if (buflen < 0) {
/* We'll already have complained about whatever offended us */
exit(1);
Expand Down

0 comments on commit d6d8acb

Please sign in to comment.