2003-06-30 16:44:03 +04:00
|
|
|
/*
|
2006-11-27 18:35:18 +03:00
|
|
|
* This file is part of NetSurf, http://netsurf-browser.org/
|
2003-06-30 16:44:03 +04:00
|
|
|
* Licensed under the GNU General Public License,
|
|
|
|
* http://www.opensource.org/licenses/gpl-license
|
|
|
|
* Copyright 2003 James Bursa <bursa@users.sourceforge.net>
|
|
|
|
*/
|
|
|
|
|
2003-09-18 03:27:33 +04:00
|
|
|
/** \file
|
|
|
|
* Fetching of data from a URL (interface).
|
2003-02-09 15:58:15 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _NETSURF_DESKTOP_FETCH_H_
|
|
|
|
#define _NETSURF_DESKTOP_FETCH_H_
|
|
|
|
|
2003-08-29 16:57:14 +04:00
|
|
|
#include <stdbool.h>
|
2005-12-20 00:54:51 +03:00
|
|
|
#include "curl/curl.h"
|
2004-01-05 05:10:59 +03:00
|
|
|
#include "netsurf/utils/config.h"
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
FETCH_TYPE,
|
2004-07-10 06:35:31 +04:00
|
|
|
FETCH_PROGRESS,
|
2004-01-05 05:10:59 +03:00
|
|
|
FETCH_DATA,
|
|
|
|
FETCH_FINISHED,
|
|
|
|
FETCH_ERROR,
|
|
|
|
FETCH_REDIRECT,
|
2006-02-06 03:10:09 +03:00
|
|
|
FETCH_NOTMODIFIED,
|
2004-01-05 05:10:59 +03:00
|
|
|
#ifdef WITH_AUTH
|
2006-02-23 18:06:54 +03:00
|
|
|
FETCH_AUTH,
|
|
|
|
#endif
|
|
|
|
#ifdef WITH_SSL
|
|
|
|
FETCH_CERT_ERR,
|
2004-01-05 05:10:59 +03:00
|
|
|
#endif
|
|
|
|
} fetch_msg;
|
2003-02-09 15:58:15 +03:00
|
|
|
|
|
|
|
struct content;
|
|
|
|
struct fetch;
|
2003-10-25 18:13:49 +04:00
|
|
|
struct form_successful_control;
|
2006-02-06 03:10:09 +03:00
|
|
|
|
|
|
|
struct cache_data {
|
|
|
|
time_t req_time; /**< Time of request */
|
|
|
|
time_t res_time; /**< Time of response */
|
|
|
|
time_t date; /**< Date: response header */
|
|
|
|
time_t expires; /**< Expires: response header */
|
|
|
|
#define INVALID_AGE -1
|
|
|
|
int age; /**< Age: response header */
|
|
|
|
int max_age; /**< Max-age Cache-control parameter */
|
|
|
|
bool no_cache; /**< no-cache Cache-control parameter */
|
|
|
|
char *etag; /**< Etag: response header */
|
2006-02-08 03:35:05 +03:00
|
|
|
time_t last_modified; /**< Last-Modified: response header */
|
2006-02-06 03:10:09 +03:00
|
|
|
};
|
2003-02-09 15:58:15 +03:00
|
|
|
|
2006-02-23 18:06:54 +03:00
|
|
|
#ifdef WITH_SSL
|
|
|
|
struct ssl_cert_info {
|
|
|
|
long version; /**< Certificate version */
|
|
|
|
char not_before[32]; /**< Valid from date */
|
|
|
|
char not_after[32]; /**< Valid to date */
|
|
|
|
int sig_type; /**< Signature type */
|
|
|
|
long serial; /**< Serial number */
|
|
|
|
char issuer[256]; /**< Issuer details */
|
|
|
|
char subject[256]; /**< Subject details */
|
|
|
|
int cert_type; /**< Certificate type */
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2003-11-06 22:41:41 +03:00
|
|
|
extern bool fetch_active;
|
2005-12-20 00:54:51 +03:00
|
|
|
extern CURLM *fetch_curl_multi;
|
2003-11-06 22:41:41 +03:00
|
|
|
|
2003-02-09 15:58:15 +03:00
|
|
|
void fetch_init(void);
|
|
|
|
struct fetch * fetch_start(char *url, char *referer,
|
2006-02-23 18:06:54 +03:00
|
|
|
void (*callback)(fetch_msg msg, void *p, const void *data,
|
2004-06-22 21:37:51 +04:00
|
|
|
unsigned long size),
|
2006-02-06 03:10:09 +03:00
|
|
|
void *p, bool only_2xx, char *post_urlenc,
|
|
|
|
struct form_successful_control *post_multipart,
|
|
|
|
bool cookies, char *headers[]);
|
2003-02-09 15:58:15 +03:00
|
|
|
void fetch_abort(struct fetch *f);
|
|
|
|
void fetch_poll(void);
|
|
|
|
void fetch_quit(void);
|
2003-03-15 18:53:20 +03:00
|
|
|
const char *fetch_filetype(const char *unix_path);
|
2004-03-22 00:32:15 +03:00
|
|
|
char *fetch_mimetype(const char *ro_path);
|
2004-04-02 17:51:13 +04:00
|
|
|
bool fetch_can_fetch(const char *url);
|
2004-06-28 03:24:11 +04:00
|
|
|
void fetch_change_callback(struct fetch *fetch,
|
2006-02-23 18:06:54 +03:00
|
|
|
void (*callback)(fetch_msg msg, void *p, const void *data,
|
2004-06-28 03:24:11 +04:00
|
|
|
unsigned long size),
|
|
|
|
void *p);
|
2007-01-13 03:19:02 +03:00
|
|
|
long fetch_http_code(struct fetch *fetch);
|
2003-02-09 15:58:15 +03:00
|
|
|
|
|
|
|
#endif
|