Lines Matching refs:ctx
53 static void cf_haproxy_ctx_reset(struct cf_haproxy_ctx *ctx) in cf_haproxy_ctx_reset() argument
55 DEBUGASSERT(ctx); in cf_haproxy_ctx_reset()
56 ctx->state = HAPROXY_INIT; in cf_haproxy_ctx_reset()
57 Curl_dyn_reset(&ctx->data_out); in cf_haproxy_ctx_reset()
60 static void cf_haproxy_ctx_free(struct cf_haproxy_ctx *ctx) in cf_haproxy_ctx_free() argument
62 if(ctx) { in cf_haproxy_ctx_free()
63 Curl_dyn_free(&ctx->data_out); in cf_haproxy_ctx_free()
64 free(ctx); in cf_haproxy_ctx_free()
71 struct cf_haproxy_ctx *ctx = cf->ctx; in cf_haproxy_date_out_set() local
77 DEBUGASSERT(ctx); in cf_haproxy_date_out_set()
78 DEBUGASSERT(ctx->state == HAPROXY_INIT); in cf_haproxy_date_out_set()
82 result = Curl_dyn_addn(&ctx->data_out, STRCONST("PROXY UNKNOWN\r\n")); in cf_haproxy_date_out_set()
95 result = Curl_dyn_addf(&ctx->data_out, "PROXY %s %s %s %i %i\r\n", in cf_haproxy_date_out_set()
110 struct cf_haproxy_ctx *ctx = cf->ctx; in cf_haproxy_connect() local
114 DEBUGASSERT(ctx); in cf_haproxy_connect()
124 switch(ctx->state) { in cf_haproxy_connect()
129 ctx->state = HAPROXY_SEND; in cf_haproxy_connect()
132 len = Curl_dyn_len(&ctx->data_out); in cf_haproxy_connect()
136 Curl_dyn_ptr(&ctx->data_out), len, FALSE, in cf_haproxy_connect()
144 Curl_dyn_tail(&ctx->data_out, len - (size_t)nwritten); in cf_haproxy_connect()
145 if(Curl_dyn_len(&ctx->data_out) > 0) { in cf_haproxy_connect()
150 ctx->state = HAPROXY_DONE; in cf_haproxy_connect()
153 Curl_dyn_free(&ctx->data_out); in cf_haproxy_connect()
158 *done = (!result) && (ctx->state == HAPROXY_DONE); in cf_haproxy_connect()
168 cf_haproxy_ctx_free(cf->ctx); in cf_haproxy_destroy()
176 cf_haproxy_ctx_reset(cf->ctx); in cf_haproxy_close()
215 struct cf_haproxy_ctx *ctx; in cf_haproxy_create() local
219 ctx = calloc(1, sizeof(*ctx)); in cf_haproxy_create()
220 if(!ctx) { in cf_haproxy_create()
224 ctx->state = HAPROXY_INIT; in cf_haproxy_create()
225 Curl_dyn_init(&ctx->data_out, DYN_HAXPROXY); in cf_haproxy_create()
227 result = Curl_cf_create(&cf, &Curl_cft_haproxy, ctx); in cf_haproxy_create()
230 ctx = NULL; in cf_haproxy_create()
233 cf_haproxy_ctx_free(ctx); in cf_haproxy_create()