On 15.11.2016 15:41, Branko Čibej wrote: > On 15.11.2016 15:29, br...@apache.org wrote: >> Author: brane >> Date: Tue Nov 15 14:29:27 2016 >> New Revision: 1769841 >> >> URL: http://svn.apache.org/viewvc?rev=1769841&view=rev >> Log: >> Revert r1769799 due to a chicken-and-egg problem. > > So this was fun. > > What I didn't realize is that, in order to create the > connection-specific config store, one must first know the connection > URL. But serf_connection_create() does not know the connection URL ... > > ... and the tests didn't break on my dev box, for some reason. Sorry for > the noise. > > > Here's what I propose to do: > > * Completely deprecate serf_connection_create(). > It's useless as it stands now, because it does not set the host_url > and host_info members of the connection struct (hence breaking when > the request attempts to set the Host: header, among other places) > and it does not initialize the config store. > > * Create a new function, e.g., serf_connection_create_from_address() > which would be like serf_connection_create() but would also take a > 'const char* host_url' parameter with which to initialize the > missing members. > > > The reason why I'd like to have another function besides > serf_connectIon_create2() is that the latter blocks on DNS lookup, which > is quite unacceptable for my purposes. > > > If anyone has a better idea, I'd love to hear it.
Another solution would be to create serf_connection_create3 which would be like serf_connection_create2 but would take an optional apr_sockaddr_t* parameter and only perform the DNS lookup if the address wasn't provided. I still think serf_connection_create() should be deprecated and declared permanently broken. -- Brane