webui: handle RSS link torrent URLs
This commit is contained in:
parent
0249ce330d
commit
15905c2f35
2 changed files with 18 additions and 6 deletions
|
|
@ -5,7 +5,6 @@
|
|||
* and chunked transfer-encoding, and follows 3xx redirects. This is deliberately
|
||||
* simple — it serves RSS/Torznab fetches, not a general-purpose user agent. */
|
||||
#include "naut/http_client.h"
|
||||
#include "naut/log.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <netdb.h>
|
||||
|
|
@ -16,9 +15,15 @@
|
|||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/err.h>
|
||||
|
||||
/* This lib is linked into the plugin module too, which can't resolve the host's
|
||||
* naut_log symbols, so keep diagnostics dependency-free. */
|
||||
#define HTTP_WARN(...) (void)fprintf(stderr, "http: " __VA_ARGS__)
|
||||
|
||||
#define HTTP_MAX_BODY (16 * 1024 * 1024) /* 16 MiB cap */
|
||||
#define HTTP_MAX_REDIR 5
|
||||
|
||||
|
|
@ -58,7 +63,7 @@ static int dial(const char *host, const char *port) {
|
|||
static bool conn_open(conn_t *c, const char *host, const char *port, bool tls) {
|
||||
memset(c, 0, sizeof *c);
|
||||
c->fd = dial(host, port);
|
||||
if (c->fd < 0) { NAUT_WARN("http: connect %s:%s failed", host, port); return false; }
|
||||
if (c->fd < 0) { HTTP_WARN("connect %s:%s failed\n", host, port); return false; }
|
||||
if (!tls) return true;
|
||||
|
||||
c->ctx = SSL_CTX_new(TLS_client_method());
|
||||
|
|
@ -69,7 +74,7 @@ static bool conn_open(conn_t *c, const char *host, const char *port, bool tls) {
|
|||
SSL_set_fd(c->ssl, c->fd);
|
||||
SSL_set_tlsext_host_name(c->ssl, host); /* SNI */
|
||||
if (SSL_connect(c->ssl) != 1) {
|
||||
NAUT_WARN("http: TLS handshake with %s failed", host);
|
||||
HTTP_WARN("TLS handshake with %s failed\n", host);
|
||||
conn_close(c);
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue