1 /* HTTP and HTTPS url schemes */ 2 3 #ifndef __GSK_URL_TRANSFER_HTTP_H_ 4 #define __GSK_URL_TRANSFER_HTTP_H_ 5 6 #include "gskurltransfer.h" 7 #include "../gsknameresolver.h" 8 #include "../http/gskhttprequest.h" 9 #include "../http/gskhttpresponse.h" 10 11 G_BEGIN_DECLS 12 13 /* --- typedefs --- */ 14 typedef struct _GskUrlTransferHttp GskUrlTransferHttp; 15 typedef struct _GskUrlTransferHttpModifierNode GskUrlTransferHttpModifierNode; 16 typedef struct _GskUrlTransferHttpClass GskUrlTransferHttpClass; 17 /* --- type macros --- */ 18 GType gsk_url_transfer_http_get_type(void) G_GNUC_CONST; 19 #define GSK_TYPE_URL_TRANSFER_HTTP (gsk_url_transfer_http_get_type ()) 20 #define GSK_URL_TRANSFER_HTTP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSK_TYPE_URL_TRANSFER_HTTP, GskUrlTransferHttp)) 21 #define GSK_URL_TRANSFER_HTTP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSK_TYPE_URL_TRANSFER_HTTP, GskUrlTransferHttpClass)) 22 #define GSK_URL_TRANSFER_HTTP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSK_TYPE_URL_TRANSFER_HTTP, GskUrlTransferHttpClass)) 23 #define GSK_IS_URL_TRANSFER_HTTP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSK_TYPE_URL_TRANSFER_HTTP)) 24 #define GSK_IS_URL_TRANSFER_HTTP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSK_TYPE_URL_TRANSFER_HTTP)) 25 26 /* --- structures --- */ 27 struct _GskUrlTransferHttpClass 28 { 29 GskUrlTransferClass base_class; 30 }; 31 32 struct _GskUrlTransferHttp 33 { 34 GskUrlTransfer base_instance; 35 GskUrlTransferHttpModifierNode *first_modifier, *last_modifier; 36 37 char *ssl_cert, *ssl_key, *ssl_password; 38 39 /* state */ 40 GskNameResolverTask *name_lookup; 41 GskStream *raw_transport; 42 guint request_count; 43 guint response_count; 44 guint undestroyed_requests; 45 46 gboolean is_proxy; 47 }; 48 /* --- prototypes --- */ 49 50 /* SSL configuration */ 51 void gsk_url_transfer_http_set_ssl_cert (GskUrlTransferHttp *http, 52 const char *cert_fname); 53 void gsk_url_transfer_http_set_ssl_key (GskUrlTransferHttp *http, 54 const char *key_fname); 55 void gsk_url_transfer_http_set_ssl_password(GskUrlTransferHttp *http, 56 const char *password); 57 58 /* HTTP Request configuration */ 59 void gsk_url_transfer_http_set_user_agent (GskUrlTransferHttp *http, 60 const char *user_agent); 61 void gsk_url_transfer_http_add_extra_header(GskUrlTransferHttp *http, 62 const char *key, 63 const char *value); 64 65 66 67 /* generic HTTP request configuration */ 68 typedef void (*GskUrlTransferHttpRequestModifierFunc)(GskHttpRequest *request, 69 gpointer mod_data); 70 71 void gsk_url_transfer_http_add_modifier (GskUrlTransferHttp *http, 72 GskUrlTransferHttpRequestModifierFunc modifier, 73 gpointer data, 74 GDestroyNotify destroy); 75 76 77 void gsk_url_transfer_http_set_proxy_address (GskUrlTransferHttp *http, 78 GskSocketAddress *proxy_address); 79 80 G_END_DECLS 81 82 #endif 83