FreeBSD/contrib/serf/outgoing.c
/* Set up the input and output stream buckets.
 When a tunnel over an http proxy is needed, create a socket bucket and
 empty aggregate bucket for sending and receiving unencrypted requests
 over the socket.

 After the tunnel is there, or no tunnel was needed, ask the application
 to create the input and output buckets, which should take care of the
 [en/de]cryption.
 */
Set up the input and output stream buckets.
When a tunnel over an http proxy is needed, create a socket bucket and
empty aggregate bucket for sending and receiving unencrypted requests
over the socket.

After the tunnel is there, or no tunnel was needed, ask the application
to create the input and output buckets, which should take care of the
[en/de]cryption.
Set up the input and output stream buckets . When a tunnel over an http proxy is needed create a socket bucket and empty aggregate bucket for sending and receiving unencrypted requests over the socket . After the tunnel is there or no tunnel was needed ask the application to create the input and output buckets which should take care of the [ en / de ] cryption .
static apr_status_t prepare_conn_streams(serf_connection_t *conn,
                                         serf_bucket_t **istream,
                                         serf_bucket_t **ostreamt,
                                         serf_bucket_t **ostreamh)
{
    apr_status_t status;
    if (conn->stream == NULL) {
        conn->latency = apr_time_now() - conn->connect_time;
    }
    if (conn->state == SERF_CONN_CONNECTED) {
        if (conn->stream == NULL) {
            status = do_conn_setup(conn);
            if (status) {
                return status;
            }
        }
        *ostreamt = conn->ostream_tail;
        *ostreamh = conn->ostream_head;
        *istream = conn->stream;
    } else {
        if (conn->stream == NULL) {
            *istream = serf_bucket_socket_create(conn->skt,
                                                 conn->allocator);
        }
        *ostreamt = *ostreamh = conn->ssltunnel_ostream;
    }
    return APR_SUCCESS;
}
static apr_status_t prepare_conn_streams ( serf_connection_t * conn , serf_bucket_t * * istream , serf_bucket_t * * ostreamt , serf_bucket_t * * ostreamh ) { apr_status_t status ; if ( conn -> stream == NULL ) { conn -> latency = apr_time_now ( ) - conn -> connect_time ; } if ( conn -> state == SERF_CONN_CONNECTED ) { if ( conn -> stream == NULL ) { status = do_conn_setup ( conn ) ; if ( status ) { return status ; } } * ostreamt = conn -> ostream_tail ; * ostreamh = conn -> ostream_head ; * istream = conn -> stream ; } else { if ( conn -> stream == NULL ) { * istream = serf_bucket_socket_create ( conn -> skt , conn -> allocator ) ; } * ostreamt = * ostreamh = conn -> ssltunnel_ostream ; } return APR_SUCCESS ; }
Set up the input and output stream buckets.
Set up the input and output stream buckets .
/* Do we need a SSL tunnel first? */ /* If the connection does not have an associated bucket, then
         * call the setup callback to get one.
         */ /* SSL tunnel needed and not set up yet, get a direct unencrypted
         stream for this socket */ /* Don't create the ostream bucket chain including the ssl_encrypt
         bucket yet. This ensure the CONNECT request is sent unencrypted
         to the proxy. */