• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2000-2003, Ximian, Inc.
4  */
5 
6 #ifndef __SOUP_MESSAGE_PRIVATE_H__
7 #define __SOUP_MESSAGE_PRIVATE_H__ 1
8 
9 #include "soup-message.h"
10 #include "soup-auth.h"
11 #include "soup-content-processor.h"
12 #include "soup-content-sniffer.h"
13 #include "soup-session.h"
14 
15 typedef struct {
16 	gpointer           io_data;
17 
18 	SoupChunkAllocator chunk_allocator;
19 	gpointer           chunk_allocator_data;
20 	GDestroyNotify     chunk_allocator_dnotify;
21 
22 	guint              msg_flags;
23 	gboolean           server_side;
24 
25 	SoupContentSniffer *sniffer;
26 	gsize              bytes_for_sniffing;
27 
28 	SoupHTTPVersion    http_version, orig_http_version;
29 
30 	SoupURI           *uri;
31 	SoupAddress       *addr;
32 
33 	SoupAuth          *auth, *proxy_auth;
34 	SoupConnection    *connection;
35 
36 	GHashTable        *disabled_features;
37 
38 	SoupURI           *first_party;
39 	SoupURI           *site_for_cookies;
40 
41 	GTlsCertificate      *tls_certificate;
42 	GTlsCertificateFlags  tls_errors;
43 
44 	SoupRequest       *request;
45 
46 	SoupMessagePriority priority;
47 
48 	gboolean is_top_level_navigation;
49 } SoupMessagePrivate;
50 
51 void             soup_message_cleanup_response (SoupMessage      *msg);
52 
53 typedef enum {
54 	SOUP_MESSAGE_IO_COMPLETE,
55 	SOUP_MESSAGE_IO_INTERRUPTED,
56 	SOUP_MESSAGE_IO_STOLEN
57 } SoupMessageIOCompletion;
58 
59 typedef void     (*SoupMessageGetHeadersFn)  (SoupMessage      *msg,
60 					      GString          *headers,
61 					      SoupEncoding     *encoding,
62 					      gpointer          user_data);
63 typedef guint    (*SoupMessageParseHeadersFn)(SoupMessage      *msg,
64 					      char             *headers,
65 					      guint             header_len,
66 					      SoupEncoding     *encoding,
67 					      gpointer          user_data,
68 					      GError          **error);
69 typedef void     (*SoupMessageCompletionFn)  (SoupMessage      *msg,
70 					      SoupMessageIOCompletion completion,
71 					      gpointer          user_data);
72 
73 
74 void soup_message_send_request (SoupMessageQueueItem      *item,
75 				SoupMessageCompletionFn    completion_cb,
76 				gpointer                   user_data);
77 void soup_message_read_request (SoupMessage               *msg,
78 				SoupSocket                *sock,
79 				gboolean                   use_thread_context,
80 				SoupMessageCompletionFn    completion_cb,
81 				gpointer                   user_data);
82 
83 void soup_message_io_client    (SoupMessageQueueItem      *item,
84 				GIOStream                 *iostream,
85 				GMainContext              *async_context,
86 				SoupMessageGetHeadersFn    get_headers_cb,
87 				SoupMessageParseHeadersFn  parse_headers_cb,
88 				gpointer                   headers_data,
89 				SoupMessageCompletionFn    completion_cb,
90 				gpointer                   user_data);
91 void soup_message_io_server    (SoupMessage               *msg,
92 				GIOStream                 *iostream,
93 				GMainContext              *async_context,
94 				SoupMessageGetHeadersFn    get_headers_cb,
95 				SoupMessageParseHeadersFn  parse_headers_cb,
96 				gpointer                   headers_data,
97 				SoupMessageCompletionFn    completion_cb,
98 				gpointer                   user_data);
99 
100 /* Auth handling */
101 void           soup_message_set_auth       (SoupMessage *msg,
102 					    SoupAuth    *auth);
103 SoupAuth      *soup_message_get_auth       (SoupMessage *msg);
104 void           soup_message_set_proxy_auth (SoupMessage *msg,
105 					    SoupAuth    *auth);
106 SoupAuth      *soup_message_get_proxy_auth (SoupMessage *msg);
107 
108 /* I/O */
109 void       soup_message_io_stop        (SoupMessage *msg);
110 void       soup_message_io_finished    (SoupMessage *msg);
111 /* This is supposed to be private, but there are programs that rely on it
112  * being exported. See bug #687758, #687468.
113  */
114 SOUP_AVAILABLE_IN_2_4
115 void       soup_message_io_cleanup     (SoupMessage *msg);
116 void       soup_message_io_pause       (SoupMessage *msg);
117 void       soup_message_io_unpause     (SoupMessage *msg);
118 gboolean   soup_message_io_in_progress (SoupMessage *msg);
119 GIOStream *soup_message_io_steal       (SoupMessage *msg);
120 
121 
122 gboolean soup_message_io_run_until_write  (SoupMessage   *msg,
123 					   gboolean       blocking,
124 					   GCancellable  *cancellable,
125 					   GError       **error);
126 gboolean soup_message_io_run_until_read   (SoupMessage   *msg,
127 					   gboolean       blocking,
128 					   GCancellable  *cancellable,
129 					   GError       **error);
130 gboolean soup_message_io_run_until_finish (SoupMessage   *msg,
131 					   gboolean       blocking,
132 					   GCancellable  *cancellable,
133 					   GError       **error);
134 
135 typedef gboolean (*SoupMessageSourceFunc) (SoupMessage *, gpointer);
136 GSource *soup_message_io_get_source       (SoupMessage           *msg,
137 					   GCancellable          *cancellable,
138 					   SoupMessageSourceFunc  callback,
139 					   gpointer               user_data);
140 
141 GInputStream *soup_message_io_get_response_istream (SoupMessage  *msg,
142 						    GError      **error);
143 
144 gboolean soup_message_disables_feature (SoupMessage *msg,
145 					gpointer     feature);
146 
147 GList *soup_message_get_disabled_features (SoupMessage *msg);
148 
149 void soup_message_set_https_status (SoupMessage    *msg,
150 				    SoupConnection *conn);
151 
152 void soup_message_network_event (SoupMessage         *msg,
153 				 GSocketClientEvent   event,
154 				 GIOStream           *connection);
155 
156 GInputStream *soup_message_setup_body_istream (GInputStream *body_stream,
157 					       SoupMessage *msg,
158 					       SoupSession *session,
159 					       SoupProcessingStage start_at_stage);
160 
161 void soup_message_set_soup_request (SoupMessage *msg,
162 				    SoupRequest *req);
163 
164 SoupConnection *soup_message_get_connection (SoupMessage    *msg);
165 void            soup_message_set_connection (SoupMessage    *msg,
166 					     SoupConnection *conn);
167 
168 gpointer        soup_message_get_io_data (SoupMessage       *msg);
169 void            soup_message_set_io_data (SoupMessage       *msg,
170 					  gpointer           io);
171 
172 SoupContentSniffer *soup_message_get_content_sniffer    (SoupMessage        *msg);
173 void                soup_message_set_content_sniffer    (SoupMessage        *msg,
174 							 SoupContentSniffer *sniffer);
175 void                soup_message_set_bytes_for_sniffing (SoupMessage        *msg,
176 							 gsize               bytes);
177 
178 gboolean    soup_message_has_chunk_allocator (SoupMessage *msg);
179 SoupBuffer *soup_message_allocate_chunk      (SoupMessage *msg,
180 					      goffset      read_length);
181 
182 #endif /* __SOUP_MESSAGE_PRIVATE_H__ */
183