Revert r1769799 due to a chicken-and-egg problem.

git-svn-id: https://svn.apache.org/repos/asf/serf/trunk@1769841 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/serf_private.h b/serf_private.h
index 2217f6c..a1d0696 100644
--- a/serf_private.h
+++ b/serf_private.h
@@ -334,15 +334,11 @@
    The host and connection entries will be created in the configuration store
    when not existing already.
 
-   The config object will be allocated in CONN's pool. The config object's
+   The config object will be allocated in OUT_POOL. The config object's
    lifecycle cannot extend beyond that of the serf context!
-
-   If OPT_POOL is is not NULL, it will be used for temporary
-   allocations and the function will always return APR_SUCCESS.
  */
 apr_status_t serf__config_store_create_conn_config(serf_connection_t *conn,
-                                                   serf_config_t **config,
-                                                   apr_pool_t *opt_pool);
+                                                   serf_config_t **config);
 
 /* Same thing, but for incoming connections */
 apr_status_t serf__config_store_create_client_config(serf_incoming_t *client,
diff --git a/src/config_store.c b/src/config_store.c
index 58b31b6..e1fa215 100644
--- a/src/config_store.c
+++ b/src/config_store.c
@@ -236,27 +236,21 @@
 }
 
 apr_status_t serf__config_store_create_conn_config(serf_connection_t *conn,
-                                                   serf_config_t **config,
-                                                   apr_pool_t *opt_pool)
+                                                   serf_config_t **config)
 {
     serf__config_store_t *config_store = &conn->ctx->config_store;
     const char *host_key, *conn_key;
     serf__config_hdr_t *per_conn, *per_host;
     apr_pool_t *tmp_pool;
+    apr_status_t status;
 
     serf_config_t *cfg = apr_pcalloc(conn->pool, sizeof(serf_config_t));
     cfg->ctx_pool = config_store->pool;
     cfg->allocator = config_store->allocator;
     cfg->per_context = config_store->global_per_context;
 
-    if (!opt_pool) {
-        apr_status_t status = apr_pool_create(&tmp_pool, cfg->ctx_pool);
-        if (status != APR_SUCCESS)
-            return status;
-    }
-    else {
-        tmp_pool = opt_pool;
-    }
+    if ((status = apr_pool_create(&tmp_pool, cfg->ctx_pool)) != APR_SUCCESS)
+        return status;
 
     /* Find the config values for this connection, create empty structure
         if needed */
@@ -285,8 +279,7 @@
     }
     cfg->per_host = per_host;
 
-    if (tmp_pool != opt_pool)
-        apr_pool_destroy(tmp_pool);
+    apr_pool_destroy(tmp_pool);
 
     *config = cfg;
 
diff --git a/src/outgoing.c b/src/outgoing.c
index 028599e..bb637fa 100644
--- a/src/outgoing.c
+++ b/src/outgoing.c
@@ -1216,7 +1216,7 @@
     return APR_SUCCESS;
 }
 
-static serf_connection_t *create_connection(
+serf_connection_t *serf_connection_create(
     serf_context_t *ctx,
     apr_sockaddr_t *address,
     serf_connection_setup_t setup,
@@ -1265,8 +1265,6 @@
 
     conn->done_reqs = conn->done_reqs_tail = 0;
 
-    conn->config = NULL;
-
     /* Create a subpool for our connection. */
     apr_pool_create(&conn->skt_pool, conn->pool);
 
@@ -1280,23 +1278,6 @@
     return conn;
 }
 
-serf_connection_t *serf_connection_create(
-    serf_context_t *ctx,
-    apr_sockaddr_t *address,
-    serf_connection_setup_t setup,
-    void *setup_baton,
-    serf_connection_closed_t closed,
-    void *closed_baton,
-    apr_pool_t *pool)
-{
-    serf_connection_t *conn = create_connection(ctx, address,
-                                                setup, setup_baton,
-                                                closed, closed_baton,
-                                                pool);
-    serf__config_store_create_conn_config(conn, &conn->config, pool);
-    return conn;
-}
-
 apr_status_t serf_connection_create2(
     serf_connection_t **conn,
     serf_context_t *ctx,
@@ -1327,8 +1308,8 @@
             return status;
     }
 
-    c = create_connection(ctx, host_address, setup, setup_baton,
-                          closed, closed_baton, pool);
+    c = serf_connection_create(ctx, host_address, setup, setup_baton,
+                               closed, closed_baton, pool);
 
     /* We're not interested in the path following the hostname. */
     c->host_url = apr_uri_unparse(c->pool,
@@ -1343,7 +1324,7 @@
     }
 
     /* Store the connection specific info in the configuration store */
-    status = serf__config_store_create_conn_config(c, &config, NULL);
+    status = serf__config_store_create_conn_config(c, &config);
     if (status)
         return status;
     c->config = config;
diff --git a/test/test_internal.c b/test/test_internal.c
index 81512a2..14296ab 100644
--- a/test/test_internal.c
+++ b/test/test_internal.c
@@ -119,13 +119,13 @@
     /* Test 1: This should return a config object with per_context, per_host and
        per_connection hash_table's initialized. */
     CuAssertIntEquals(tc, APR_SUCCESS,
-                      serf__config_store_create_conn_config(conn1, &cfg1, NULL));
+                      serf__config_store_create_conn_config(conn1, &cfg1));
     CuAssertPtrNotNull(tc, cfg1->per_context);
     CuAssertPtrNotNull(tc, cfg1->per_host);
     CuAssertPtrNotNull(tc, cfg1->per_conn);
     /* Get a config object for the other connection also. */
     CuAssertIntEquals(tc, APR_SUCCESS,
-                      serf__config_store_create_conn_config(conn2, &cfg2, NULL));
+                      serf__config_store_create_conn_config(conn2, &cfg2));
 
     /* Test 2: Get a non-existing per connection key, value should be NULL */
     CuAssertIntEquals(tc, APR_SUCCESS,
@@ -180,13 +180,13 @@
     /* Test 1: This should return a config object with per_context, per_host and
      per_connection hash_table's initialized. */
     CuAssertIntEquals(tc, APR_SUCCESS,
-                      serf__config_store_create_conn_config(conn1, &cfg1, NULL));
+                      serf__config_store_create_conn_config(conn1, &cfg1));
     CuAssertPtrNotNull(tc, cfg1->per_context);
     CuAssertPtrNotNull(tc, cfg1->per_host);
     CuAssertPtrNotNull(tc, cfg1->per_conn);
     /* Get a config object for the other connection also. */
     CuAssertIntEquals(tc, APR_SUCCESS,
-                      serf__config_store_create_conn_config(conn2, &cfg2, NULL));
+                      serf__config_store_create_conn_config(conn2, &cfg2));
 
     /* Test 2: Get a non-existing per connection key, value should be NULL */
     CuAssertIntEquals(tc, APR_SUCCESS,
@@ -277,7 +277,7 @@
                             conn_closed, NULL, tb->pool);
 
     CuAssertIntEquals(tc, APR_SUCCESS,
-                      serf__config_store_create_conn_config(conn, &cfg, NULL));
+                      serf__config_store_create_conn_config(conn, &cfg));
 
     /* Add and remove a key per-context */
     CuAssertIntEquals(tc, APR_SUCCESS,