C++ Library with http 1.1 response caching support - c++

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...

Related

How can I connect my C++ application with an node.js server to get JSON data?

It's pretty much the tittle.
Im not expecting the whole code to just copy and paste (but feel free to do it). Im just having difficulties to find some data related. If someone knows how to do it, please post some hints, article links, specific words to make some research on it.
Thank you.
As Christian mentioned in his comment, your problem can be solved by implementing an HTTP client that parses JSON responses, independently of the technology used by your server. To do this in C++, I would refer you to the following resources:
High-level library for C++ HTTP client.
libcurl (lower level library for HTTP requests).
RapidJSON library to parse the responses you will get from your server (see this benchmark for a comparison of JSON parsing libraries).
If your C++ application uses a framework such as Qt, it likely includes facilities for requests (e.g. Qt HTTP example).
On the server side, you will have to define HTTP endpoints that return the data you are interested in, encoded as JSON. The beginning of this tutorial shows an easy way to do that.
node.js c++ add on manual
https://nodejs.org/api/addons.html
http://libuv.org/
use libuv function in node.js 0.12.x

C++ Networking library supporting response caching

Hi im writing a mobile application client featuring web-requests, through POCO C++ Net-library. However for performance reasons im in need of caching the http responses( response caching to disk). I hear this can be done, but it seems POCO Net lacks this support? Are there any other network libs that supports response caching (Please point me to an example)?
For example if i request a JSON i want to check if the cached version is up-to-date with the server version, before i fetch it, to make the general appearance of the app more smooth.
(I need to use C++ since im developing cross-platform in C++)
There's no out-of-the-box support, but using Cache Framework with a custom strategy based on AbstractStrategy for disk persistence should be straightforward.
Two things to keep in mind:
Cache Framework performance/size penalty (check the linked doc)
Cache-control header:
a response is cacheable if the requirements of the request method,
request header fields, and the response status indicate that it is
cacheable.
HTH

C++ programming for HTTPS

I am a C++ programmer new to HTTPS. I need to write a COM based windows service in C++ which can handle HTTPS requests. But for that I would need to understand how the technologies and protocol fit together.
I understand this is a very open ended question but my intent is to find some documentation that introduces a C++ programmer to HTTPS programming.
Thanks in advance.
Writing your own HTTP server is no minor undertaking (if you want to get everything right), and writing one to support SSL is even more difficult. You would be much better advised to use one of the many open source servers (see here for a list), many of which can be embedded in your c++ code. Personally, I have found Mongoose very easy to embed in C++ code.
The other option for windows vista/Windows Server 2008 or later is to use the IIS Hostable core. For client versions this is available even in home basic, though IIS is not.
This does basically all the work of the HTTP and HTTPS protocols for you and all that is left to do is write the callback functions which define what to send out over the pipe.

Use gSOAP for VS 2003/C++ access to SOAP Web Service with WS-Security?

We have an upcoming project to allow an old platform that's only extensible with C++ / VS 2003 to call a SOAP-based web service that uses WS-Security.
My Google research indicates that gSOAP could be the best way to go.
I'm looking for validation and/or alternative suggestions.
I've been using gSoap with the wsse plugin for WS-Security using signatures on both the client and server side for both Windows and Linux. It took some doing, but it works well. It is extremely fast too.
It will require you to link OpenSSL with your project. I actually found a bug in the wsse plugin a few releases back that involved direct calls to OpenSSL for signature generation and validation. All of the bugs involved leaking OpenSSL structures. (The fixes were accepted into the source tree and are part of the current release.)
Overall, it really wasn't that difficult to get going. I used SoapUI (http://www.soapui.org/) to troubleshoot the signature generation when trying to validate if I was doing something wrong or the remote end was having issues.
If you're doing server side WS-Security under Apache2, you'll have to stick with the mod_gsoap 0.6 that comes with gSoap. I had to modify it a bit because it won't deal with WS-Security by default.
I believe, but didn't do a lot of investigation, that someone broke mod_gsoap 0.7 that is the current release available at SourceForge. It took me a while to figure out that 0.7 was segfaulting apache2, so maybe this will save you some pain.

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.