summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndreas Fankhauser hiddenalpha.ch2025-10-17 16:26:05 +0200
committerAndreas Fankhauser hiddenalpha.ch2025-10-17 16:26:05 +0200
commit1b089cfce9ef4ecaa5861a02ebd2f09a0ca09f46 (patch)
tree66ea99b1e14c32c7dfb947b02a277050c7908178 /include
parenta50aacc2b61d451cf6dad329eb1a8b0af679aa7b (diff)
downloadQntan-1b089cfce9ef4ecaa5861a02ebd2f09a0ca09f46.tar.gz
Qntan-1b089cfce9ef4ecaa5861a02ebd2f09a0ca09f46.zip
Fix findings in HttpClient.
Diffstat (limited to 'include')
-rw-r--r--include/qntan/Qntan.h31
1 files changed, 24 insertions, 7 deletions
diff --git a/include/qntan/Qntan.h b/include/qntan/Qntan.h
index 9772de4..7c2a498 100644
--- a/include/qntan/Qntan.h
+++ b/include/qntan/Qntan.h
@@ -48,6 +48,7 @@ struct Qntan_File;
struct Qntan_Process;
struct Qntan_HshTbl;
struct Qntan_HshTbl_Cursor;
+struct Qntan_HttpClient;
struct Qntan_Socket;
struct Qntan_TarEnc;
struct Qntan_TarEnc_Hdr;
@@ -980,6 +981,8 @@ struct Qntan_HttpClient_Exchg_Opts {
/*
* Like {"key1", "val1", "key2", "val2", NULL} */
char **hdrs;
+ /**/
+ uint8_t isTls;
/*
* can be NULL, which means body gets written through separate calls.
* MUST be null-byte-terminated.
@@ -989,12 +992,12 @@ struct Qntan_HttpClient_Exchg_Opts {
/**/
Qntan_Cls cls;
/**/
- void (*onRspHdr)( char const*proto, int code, char const*msg, char const**hdrs, Qntan_Cls );
+ void (*onRspHdr)( char const*proto, int code, char const*msg, char const*const*hdrs, Qntan_Cls );
/*
* @param len
* Negative values indicate errors.
* If positive, it indicates how long 'buf' is.
- * WARN: if zero, value of 'buf' is unspecified!
+ * WARN: if zero or negative, value of 'buf' is unspecified!
* @param flgs
* 'flgs & 4' means this is last buffer (EndOfMsg). */
void (*onBodyChunk)( char const*buf, int len, int flgs, Qntan_Cls );
@@ -1006,23 +1009,37 @@ struct Qntan_HttpClient_Exchg {
* Write another request body chunk.
* @param flgs
* 'flgs & 4' means this is the last buffer (aka EndOfMsg). */
- void (*write)( struct Qntan_HttpClient**, req, void*buf, int len, int flgs,
+ void (*write)( struct Qntan_HttpClient_Exchg**, void*buf, int len, int flgs,
void(*onDone)(int,Qntan_Cls), Qntan_Cls );
/*
* Set backpressure. This means that callbacks won't be called anymore.
* Events will be held back until resumed. */
- void (*pause)( struct Qntan_HttpClient**, );
+ void (*pause)( struct Qntan_HttpClient_Exchg** );
/*
* Reset backpressure. */
- void (*resume)( struct Qntan_HttpClient**, );
+ void (*resume)( struct Qntan_HttpClient_Exchg** );
/**/
};
struct Qntan_HttpClient {
/**/
void (*httpReq)( struct Qntan_HttpClient**, struct Qntan_HttpClient_Exchg_Opts*,
- void(*onDone)(int,struct Qntan_HttpClient_Exchg**,Qntan_Cls), Qntan_Cls );
- /**/
+ void(*onDone)( int err, struct Qntan_HttpClient_Exchg**exchg,
+ void(*unref)(struct Qntan_HttpClient_Exchg**),
+ Qntan_Cls onDoneArg),
+ Qntan_Cls onDoneArg );
+ /* Creates a new HTTP exchange (aka request/response).
+ * @param onDone
+ * Will be called with the result.
+ * @param err
+ * Negative on erorrs. Zero if 'exchg' is ready-to-use.
+ * @param exchg
+ * WARN: Only valid if 'err' is zero. The requested instance.
+ * @param unref
+ * The function to be called as soon 'exchg' is no longer used.
+ * @param onDoneArg
+ * Passed through closure (aka context).
+ */
};