]> git.sur5r.net Git - minitube/blobdiff - lib/http/README.md
New upstream version 3.8
[minitube] / lib / http / README.md
index efb936d6bf0f99d344e3c278d3fde4de79bca6ee..83b2e35db5f3b90268e61211fefe5cceff4b21ff 100644 (file)
@@ -9,6 +9,7 @@ This is just a wrapper around Qt's QNetworkAccessManager and friends. I use it i
 - Easier POST requests
 - Read timeouts (don't let your requests get stuck forever). (now supported by Qt >= 5.15)
 - Redirection support (now supported by Qt >= 5.6)
+- Disk-based cache implementation similar to Qt's but not strictly a HTTP cache, i.e. it ignores HTTP headers. This is good if want to cache successful requests irrespective of what the origin server says you should do. The cache also fallbacks to stale content when the server returns an error.
 
 ## Design
 
@@ -98,6 +99,19 @@ connect(reply, &HttpReply::finished, this, [](auto &reply) {
 });
 ```
 
+Or using two separate signals for success and failure:
+```
+#include "http.h"
+
+auto reply = Http::instance().get("https://google.com/");
+connect(reply, &HttpReply::data, this, [](auto &bytes) {
+    qDebug() << "Feel the bytes!" << bytes;
+});
+connect(reply, &HttpReply::error, this, [](auto &msg) {
+    qDebug() << "Something's wrong here" << msg;
+});
+```
+
 This is a real-world example of building a Http object with more complex features. It throttles requests, uses a custom user agent and caches results:
 
 ```