how to set proxy credentials in the websocket client code using boost - c++

I am new to boost lib. I need a client program which will communicate with the server even in proxy environment also. I have tried with the poco lib,in that i got struck at creation of web socket after Handshake. After i am trying with this boost package and i have downloaded a sample chat client program from the boost examples.In that i don't know where to set proxy requirements. I searched in the all .cpp file inside the boost package. But i didn't understand any thing.
Can any body plz help me whether it is possible to do client communication in proxy environment with this.if it is possible tell me how.if not with this,please suggest any possible way.
Thanks,
vvk.

Boost Asio does not have proxy support.
I'd use libcurl for this myself. Libcurl has some integrations with Boost Asio floating around on github.
There's also CppNetlib which (undoubtedly) will have proxy support, and is integrated with Boost Library like Asio is (although it's not a part of the boost library distribution like Asio is).
Lastly, there's some hints on getting "manual" proxying started using just Boost Asio here:
how to add proxy support to boost::asio?
Although this will leave you implementing your own authentication too :/

Related

C++ HTTP requests API

I'm rewriting a Java project in C++ where I used okhttp. Is there a similar lib to easily send GET/POST requests? I tried to setup cURLpp but can't find a guide to compile it.
You can try to use cpp-netlib based on C++11

C++ Library with http 1.1 response caching support

I am working on a project where I need to communicate with a server using a network library in C++. Currently im using POCO/Net
Is there any C++ library that has support for response caching, authentication, HTTP and HTTPS similar to the Java version?
Greatful for help!
wwwlib seems to provide the kind of persistant cache you are after and is http 1.1 compliant according to W3lib. I have not yet tried it though, it seems very low level in comparison to POCO. Someone else might have a simpler library...

What direction should I follow to add webservice functionalities to my application?

I have a problem, and I know there are many ways to solve it. I hope you can help me chose the fittest.
I am developping an application mainly using Matlab, and I try to gradually shift some of its functionalities to c++. I develop on windows, for windows.
I am quite experienced in these two programming languages, but I know nothing of web development.
I want to add some functionalities to this application that will use some webservices hosted on a server protected by ssl.
I am alone on this project, but I can spend some time learning new stuff if need be.
I would like to know what tools you think I should better use for this task ?
So far, I have tried and failed the following approach :
calling the webservice directly from Matlab. I have added the self-signed ssl certificate to every truststore I could find on my computer, but I keep getting an error telling me that the certificate is not valid.
calling the webservice using gSoap and c++. For this, I need to rebuild the gSoap binaries with ssl capabilities. I tried too do so using visual studio and mingw/gcc but did not succeed, and I could not find any help online.
I have the feeling after a few hours/days browsing and looking for solution that the tools I try to use are not the most used and therefore not the best documented (and therefore not the best suited for a rookie), so what is your advice?
I think using gSoap from your C++ modules would be the best choice.
Information about using gSoap with SSL as client is available here: Secure SOAP Clients with HTTPS/SSL
A link about using gSoap for building a VS Application: Creating a gSoap eBay Client Application with Visual C++ 2008
May be this helps for using gSoap with MinGW: Using gSoap in Qt/Windows

How i can send an HttpRequest from C++

I'm using DataServices and OData protocol. I need to generate HTTP Get, Post, Delete, and Update from a C++ application. How I can do this? What is the easiest way?
Try cURL. check out this SO post. Perform a simple HTTP request using C++ / Boost via a proxy?
Boost.Asio. There's an example of a simple HTTP client (with a GET request).
The POCO library is another alternative to cURL
You can use MS stuff: Wininet or WinHTTP.
Adding to this old post.
Beast is a cross-platform, header-only, modern C++11 library built on Boost.Asio that provides implementations of the HTTP and WebSocket protocols.
The project is under evaluation to be included in Boost, so it may be worth looking at it.

Perform a simple HTTP request using C++ / Boost via a proxy?

I'm quite a newbie with Boost, and my only experience of surfing though a proxy using a library is using .NET (that is really convenient for that purpose). I'm now trying to perform a simple HTTP request through a HTTP proxy.
Is there a tidy way to do it using boost directly?
My proxy use a NTLM authentification.
No, Boost provides neither an HTTP client nor a way to interface with proxies. You would necessarily have to implement those features yourself.
To be clear, yes, it is possible to implement an HTTP client using Boost.Asio. But implementing a client that can reliably talk through a proxy is significantly more complex, and Asio does not provide any support for that beyond the low-level socket itself. It certainly does not include the framework for performing NTLM authentication, which may prove difficult to get right.
More complex libraries like cURL provide that support.