GType soup_http_input_stream_get_type (void) G_GNUC_CONST;
-SoupHTTPInputStream *soup_http_input_stream_new (SoupSession *session,
- SoupMessage *msg);
+GInputStream *soup_http_input_stream_new (SoupSession *session,
+ SoupMessage *msg);
-gboolean soup_http_input_stream_send (SoupHTTPInputStream *httpstream,
- GCancellable *cancellable,
- GError **error);
+gboolean soup_http_input_stream_send (SoupHTTPInputStream *httpstream,
+ GCancellable *cancellable,
+ GError **error);
-void soup_http_input_stream_send_async (SoupHTTPInputStream *httpstream,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-gboolean soup_http_input_stream_send_finish (SoupHTTPInputStream *httpstream,
- GAsyncResult *result,
- GError **error);
+void soup_http_input_stream_send_async (SoupHTTPInputStream *httpstream,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean soup_http_input_stream_send_finish (SoupHTTPInputStream *httpstream,
+ GAsyncResult *result,
+ GError **error);
-SoupMessage *soup_http_input_stream_get_message (SoupHTTPInputStream *httpstream);
+SoupMessage *soup_http_input_stream_get_message (SoupHTTPInputStream *httpstream);
G_END_DECLS
GCancellable *cancellable,
GError **error)
{
- SoupHTTPInputStream *httpstream;
+ GInputStream *httpstream;
SoupRequestHTTP *http = SOUP_REQUEST_HTTP (request);
httpstream = soup_http_input_stream_new (soup_request_get_session (request), http->priv->msg);
- if (!soup_http_input_stream_send (httpstream, cancellable, error)) {
+ if (!soup_http_input_stream_send (SOUP_HTTP_INPUT_STREAM (httpstream),
+ cancellable, error)) {
g_object_unref (httpstream);
return NULL;
}
- return (GInputStream *)httpstream;
+ return httpstream;
}
{
ConditionalHelper *helper = (ConditionalHelper *)user_data;
GSimpleAsyncResult *simple;
- SoupHTTPInputStream *httpstream;
+ GInputStream *stream;
simple = g_simple_async_result_new (G_OBJECT (helper->req),
helper->callback, helper->user_data,
if (msg->status_code == SOUP_STATUS_NOT_MODIFIED) {
SoupCache *cache = (SoupCache *)soup_session_get_feature (session, SOUP_TYPE_CACHE);
- httpstream = (SoupHTTPInputStream *)soup_cache_send_response (cache, helper->original);
- if (httpstream) {
- g_simple_async_result_set_op_res_gpointer (simple, httpstream, g_object_unref);
+ stream = soup_cache_send_response (cache, helper->original);
+ if (stream) {
+ g_simple_async_result_set_op_res_gpointer (simple, stream, g_object_unref);
soup_message_got_headers (helper->original);
g_object_unref (simple);
} else {
/* Ask again for the resource, somehow the cache cannot locate it */
- httpstream = soup_http_input_stream_new (session, helper->original);
- soup_http_input_stream_send_async (httpstream, G_PRIORITY_DEFAULT,
+ stream = soup_http_input_stream_new (session, helper->original);
+ soup_http_input_stream_send_async (SOUP_HTTP_INPUT_STREAM (stream), G_PRIORITY_DEFAULT,
helper->cancellable, sent_async, simple);
}
} else {
/* It is in the cache but it was modified remotely */
- httpstream = soup_http_input_stream_new (session, helper->original);
- soup_http_input_stream_send_async (httpstream, G_PRIORITY_DEFAULT,
+ stream = soup_http_input_stream_new (session, helper->original);
+ soup_http_input_stream_send_async (SOUP_HTTP_INPUT_STREAM (stream), G_PRIORITY_DEFAULT,
helper->cancellable, sent_async, simple);
}
SoupRequestHTTP *http;
GAsyncReadyCallback callback;
gpointer user_data;
- SoupHTTPInputStream *httpstream;
+ GInputStream *stream;
} SendAsyncHelper;
static void soup_request_http_send_async (SoupRequest *request,
helper->callback, helper->user_data,
soup_request_http_send_async);
- g_simple_async_result_set_op_res_gpointer (simple, helper->httpstream, g_object_unref);
+ g_simple_async_result_set_op_res_gpointer (simple, helper->stream, g_object_unref);
/* Issue signals */
soup_message_got_headers (helper->http->priv->msg);
gpointer user_data)
{
SoupRequestHTTP *http = SOUP_REQUEST_HTTP (request);
- SoupHTTPInputStream *httpstream;
+ GInputStream *stream;
GSimpleAsyncResult *simple;
SoupSession *session;
SoupCache *cache;
response = soup_cache_has_response (cache, http->priv->msg);
if (response == SOUP_CACHE_RESPONSE_FRESH) {
- SoupHTTPInputStream *httpstream;
-
- httpstream = (SoupHTTPInputStream *)
- soup_cache_send_response (cache, http->priv->msg);
+ stream = soup_cache_send_response (cache, http->priv->msg);
/* Cached resource file could have been deleted outside
*/
- if (httpstream) {
+ if (stream) {
/* Do return the stream asynchronously as in
* the other cases. It's not enough to use
* g_simple_async_result_complete_in_idle as
helper->http = g_object_ref (http);
helper->callback = callback;
helper->user_data = user_data;
- helper->httpstream = httpstream;
+ helper->stream = stream;
soup_add_timeout (soup_session_get_async_context (session),
0, send_async_cb, helper);
return;
simple = g_simple_async_result_new (G_OBJECT (http),
callback, user_data,
soup_request_http_send_async);
- httpstream = soup_http_input_stream_new (soup_request_get_session (request),
- http->priv->msg);
- soup_http_input_stream_send_async (httpstream, G_PRIORITY_DEFAULT,
+ stream = soup_http_input_stream_new (soup_request_get_session (request),
+ http->priv->msg);
+ soup_http_input_stream_send_async (SOUP_HTTP_INPUT_STREAM (stream),
+ G_PRIORITY_DEFAULT,
cancellable, sent_async, simple);
}