1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-07 14:03:14 +02:00

New URL API (not really a unrealircd module api tho) - work in progress.

No longer url_start_async(a,b,c,d,e,f,g,...) but usings structs so
simply url_start_async(tehstruct);
makes it easy to add fields later without forcing all modules to
change the prototype.

Work in progress....
This commit is contained in:
Bram Matthys
2023-11-24 11:27:39 +01:00
parent c9abf0709a
commit 3548b7e2af
8 changed files with 203 additions and 161 deletions
+20
View File
@@ -1881,7 +1881,27 @@ struct HTTPForwardedHeader
char ip[IPLEN+1];
};
typedef struct OutgoingWebRequest OutgoingWebRequest;
/** An outgoing web request (eg remote includes download) */
struct OutgoingWebRequest
{
vFP callback;
void *callback_data;
char *url; /**< must be freed by url_do_transfers_async() */
char *actual_url; /**< if you actually want to use a different url, mostly for redirects (end-users: don't set this!) */
HttpMethod http_method;
char *body;
NameValuePrioList *headers;
int store_in_file;
time_t cachetime;
int max_redirects;
// If you are adding allocated fields here:
// 1) update duplicate_outgoingwebrequest() in src/misc.c
// 2) and update url_free_handle_request_portion() there as well
};
typedef struct WebRequest WebRequest;
/** An incoming web request */
struct WebRequest {
HttpMethod method; /**< GET/PUT/POST */
char *uri; /**< Requested resource, eg "/api" */