Problem with http_client_config (bug?)

Jan 2, 2015 at 1:52 PM
Edited Jan 2, 2015 at 1:53 PM
Hi,

I've managed to statically link casablanca with my project, but sine I updated from 2.2 to 2.4 I'm facing the problem that I can't create a http_client object.

I have the following code to create my client:
http_client client(U("http://192.168.76.123"));
client.request(web::http::methods::GET.....
this one works as supposed, but as soon as I change it to:
http_client_config conf;
http_client client(U("http://192.168.76.123"));
client.request(web::http::methods::GET.....
I get a unhandled exception in base_uri.h line 243:
uri(const uri &other) :
            m_uri(other.m_uri),
            m_components(other.m_components)
        {}
other is always NULL.

Any advices?

regards
Michael
Coordinator
Jan 2, 2015 at 9:18 PM
Hi Michael,

I assume in the second code snippet you meant to pass the http_client_config as a parameter to the client constructor? Are you targeting XP by chance? I recall seeing something like this in the past. If you are building from source targeting XP you need to remember to define CPPREST_TARGET_XP in your application using the C++ Rest SDK. If you use the NuGet package this is automatically done for you.

Thanks,
Steve
Jan 5, 2015 at 7:02 AM
Hi,

thanks for the reply.
You were right with the CPPREST_TARGET_XP, defining this flag solved my problem.

Many thanks.
Michael
Coordinator
Jan 5, 2015 at 4:27 PM
Hi Michael,

FYI for when you are actually running on XP we had a regression with the release, accidentally taking a dependency on a dll that isn't available on XP. Here is the bug tracking.

Steve
Coordinator
Jan 8, 2015 at 12:52 AM
FYI - this bug has been fixed in the development branch and will be in release 2.5.0. Until then you can build from source for XP to get the new lib and dll.

Steve
Jan 8, 2015 at 6:24 AM
Hi Steve,

thank's for the info. We are statically linking the crypt32.lib, so we don't have the problem with the dependency.
Is there a release date for 2.5.0?

Michael
Coordinator
Jan 8, 2015 at 4:26 PM
Hi Michael,

No we currently don't have a planned date for 2.5.0. We recently had a release and there has been very few changes since so I don't think it will be soon. It is quite easy to build from source though all you have to do is open our Visual Studio solution.

Steve