/* Setup a proxy server and an http server and the client context to connect to that proxy server */ apr_status_t test_server_proxy_setup(test_baton_t **tb_p, test_server_message_t *serv_message_list, apr_size_t serv_message_count, test_server_action_t *serv_action_list, apr_size_t serv_action_count, test_server_message_t *proxy_message_list, apr_size_t proxy_message_count, test_server_action_t *proxy_action_list, apr_size_t proxy_action_count, apr_int32_t options, serf_connection_setup_t conn_setup, apr_pool_t *pool) { apr_status_t status; test_baton_t *tb; status = setup(tb_p, conn_setup ? conn_setup : default_http_conn_setup, HTTP_SERV_URL, TRUE, serv_message_count, pool); if (status != APR_SUCCESS) return status; tb = *tb_p; /* Prepare the server. */ setup_test_server(&tb->serv_ctx, tb->serv_addr, serv_message_list, serv_message_count, serv_action_list, serv_action_count, options, pool); status = start_test_server(tb->serv_ctx); if (status != APR_SUCCESS) return status; /* Prepare the proxy. */ setup_test_server(&tb->proxy_ctx, tb->proxy_addr, proxy_message_list, proxy_message_count, proxy_action_list, proxy_action_count, options, pool); status = start_test_server(tb->proxy_ctx); return status; }
void setup_https_test_server(serv_ctx_t **servctx_p, apr_sockaddr_t *address, test_server_message_t *message_list, apr_size_t message_count, test_server_action_t *action_list, apr_size_t action_count, apr_int32_t options, const char *keyfile, const char **certfiles, const char *client_cn, apr_pool_t *pool) { serv_ctx_t *servctx; setup_test_server(servctx_p, address, message_list, message_count, action_list, action_count, options, pool); servctx = *servctx_p; apr_pool_cleanup_register(pool, servctx, cleanup_https_server, apr_pool_cleanup_null); servctx->handshake = ssl_handshake; servctx->reset = ssl_reset; /* Override with SSL encrypt/decrypt functions */ servctx->read = ssl_socket_read; servctx->send = ssl_socket_write; init_ssl_context(servctx, keyfile, certfiles, client_cn); }
static gboolean cb_idle_helo (gpointer user_data) { const gchar *packet; gsize packet_size; cut_trace(setup_test_server()); milter_command_encoder_encode_helo(encoder, &packet, &packet_size, fqdn); milter_test_server_write(server, packet, packet_size); return FALSE; }
/* Setup a proxy server and a https server and the client context to connect to that proxy server */ apr_status_t test_https_server_proxy_setup(test_baton_t **tb_p, test_server_message_t *serv_message_list, apr_size_t serv_message_count, test_server_action_t *serv_action_list, apr_size_t serv_action_count, test_server_message_t *proxy_message_list, apr_size_t proxy_message_count, test_server_action_t *proxy_action_list, apr_size_t proxy_action_count, apr_int32_t options, serf_connection_setup_t conn_setup, const char *keyfile, const char **certfiles, const char *client_cn, serf_ssl_need_server_cert_t server_cert_cb, apr_pool_t *pool) { apr_status_t status; test_baton_t *tb; status = setup(tb_p, conn_setup ? conn_setup : default_https_conn_setup, HTTPS_SERV_URL, TRUE, /* use proxy */ serv_message_count, pool); if (status != APR_SUCCESS) return status; tb = *tb_p; tb->server_cert_cb = server_cert_cb; /* Prepare a https server. */ setup_https_test_server(&tb->serv_ctx, tb->serv_addr, serv_message_list, serv_message_count, serv_action_list, serv_action_count, options, keyfile, certfiles, client_cn, pool); status = start_test_server(tb->serv_ctx); /* Prepare the proxy. */ setup_test_server(&tb->proxy_ctx, tb->proxy_addr, proxy_message_list, proxy_message_count, proxy_action_list, proxy_action_count, options, pool); status = start_test_server(tb->proxy_ctx); return status; }