summaryrefslogtreecommitdiff
path: root/content/fetch.h
diff options
context:
space:
mode:
Diffstat (limited to 'content/fetch.h')
-rw-r--r--content/fetch.h56
1 files changed, 46 insertions, 10 deletions
diff --git a/content/fetch.h b/content/fetch.h
index 66be857f8..e7180d0c3 100644
--- a/content/fetch.h
+++ b/content/fetch.h
@@ -34,21 +34,41 @@ struct content;
struct fetch;
struct ssl_cert_info;
+/**
+ * Fetcher message types
+ */
typedef enum {
FETCH_PROGRESS,
+ FETCH_CERTS,
FETCH_HEADER,
FETCH_DATA,
+ /* Anything after here is a completed fetch of some kind. */
FETCH_FINISHED,
FETCH_TIMEDOUT,
FETCH_ERROR,
FETCH_REDIRECT,
FETCH_NOTMODIFIED,
- FETCH_CERTS,
FETCH_AUTH,
FETCH_CERT_ERR,
FETCH_SSL_ERR
} fetch_msg_type;
+/** Minimum finished message type.
+ *
+ * If a fetch does not progress this far, it's an error and the fetch machinery
+ * will send FETCH_ERROR to the llcache on fetch_free()
+ */
+#define FETCH_MIN_FINISHED_MSG FETCH_FINISHED
+
+/**
+ * This message is actually an internal message used to indicate
+ * that a fetch was aborted. Do not send this, nor expect it.
+ */
+#define FETCH__INTERNAL_ABORTED FETCH_ERROR
+
+/**
+ * Fetcher message data
+ */
typedef struct fetch_msg {
fetch_msg_type type;
@@ -69,14 +89,21 @@ typedef struct fetch_msg {
const char *realm;
} auth;
- struct {
- const struct ssl_cert_info *certs;
- size_t num_certs;
- } certs;
+ const struct cert_chain *chain;
} data;
} fetch_msg;
/**
+ * Fetcher post data types
+ */
+typedef enum {
+ FETCH_POSTDATA_NONE,
+ FETCH_POSTDATA_URLENC,
+ FETCH_POSTDATA_MULTIPART,
+} fetch_postdata_type;
+
+
+/**
* Fetch POST multipart data
*/
struct fetch_multipart_data {
@@ -89,6 +116,20 @@ struct fetch_multipart_data {
bool file; /**< Item is a file */
};
+/**
+ * fetch POST data
+ */
+struct fetch_postdata {
+ fetch_postdata_type type;
+ union {
+ /** Url encoded POST string if type is FETCH_POSTDATA_URLENC */
+ char *urlenc;
+ /** Multipart post data if type is FETCH_POSTDATA_MULTIPART */
+ struct fetch_multipart_data *multipart;
+ } data;
+};
+
+
typedef void (*fetch_callback)(const fetch_msg *msg, void *p);
/**
@@ -213,11 +254,6 @@ void fetch_free(struct fetch *f);
void fetch_set_http_code(struct fetch *fetch, long http_code);
/**
- * get the referer from the fetch
- */
-const char *fetch_get_referer_to_send(struct fetch *fetch);
-
-/**
* set cookie data on a fetch
*/
void fetch_set_cookie(struct fetch *fetch, const char *data);