diff --git a/http.c b/http.c index b414f51e..31368b23 100644 --- a/http.c +++ b/http.c @@ -40,19 +40,12 @@ static int proxy_read(struct openconnect_info *vpninfo, char *buf, size_t len); #define MAX_BUF_LEN 131072 #define BUF_CHUNK_SIZE 4096 -struct oc_text_buf { - char *data; - int pos; - int buf_len; - int error; -}; - -static struct oc_text_buf *buf_alloc(void) +struct oc_text_buf *buf_alloc(void) { return calloc(1, sizeof(struct oc_text_buf)); } -static void buf_append(struct oc_text_buf *buf, const char *fmt, ...) +void buf_append(struct oc_text_buf *buf, const char *fmt, ...) { va_list ap; @@ -99,12 +92,12 @@ static void buf_append(struct oc_text_buf *buf, const char *fmt, ...) } } -static int buf_error(struct oc_text_buf *buf) +int buf_error(struct oc_text_buf *buf) { return buf ? buf->error : -ENOMEM; } -static int buf_free(struct oc_text_buf *buf) +int buf_free(struct oc_text_buf *buf) { int error = buf_error(buf); diff --git a/openconnect-internal.h b/openconnect-internal.h index ac3dcab4..f9e84d33 100644 --- a/openconnect-internal.h +++ b/openconnect-internal.h @@ -126,6 +126,13 @@ struct pin_cache { char *pin; }; +struct oc_text_buf { + char *data; + int pos; + int buf_len; + int error; +}; + #define RECONNECT_INTERVAL_MIN 10 #define RECONNECT_INTERVAL_MAX 100 @@ -552,6 +559,10 @@ int xmlpost_initial_req(struct openconnect_info *vpninfo, char *request_body, in int prepare_stoken(struct openconnect_info *vpninfo); /* http.c */ +struct oc_text_buf *buf_alloc(void); +void buf_append(struct oc_text_buf *buf, const char *fmt, ...); +int buf_error(struct oc_text_buf *buf); +int buf_free(struct oc_text_buf *buf); char *openconnect_create_useragent(const char *base); int process_proxy(struct openconnect_info *vpninfo, int ssl_sock); int internal_parse_url(char *url, char **res_proto, char **res_host,