SoupRequest

## SoupRequest SoupRequest — Protocol-independent streaming request interface |

## Synopsis

    #include <libsoup/soup.h>

    struct              SoupRequest;
    GInputStream *      soup_request_send                   (SoupRequest *request,
                                                             GCancellable *cancellable,
                                                             GError **error);
    void                soup_request_send_async             (SoupRequest *request,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    GInputStream *      soup_request_send_finish            (SoupRequest *request,
                                                             GAsyncResult *result,
                                                             GError **error);

    goffset             soup_request_get_content_length     (SoupRequest *request);
    const char *        soup_request_get_content_type       (SoupRequest *request);
    SoupSession *       soup_request_get_session            (SoupRequest *request);
    SoupURI *           soup_request_get_uri                (SoupRequest *request);

    #define             SOUP_REQUEST_SESSION
    #define             SOUP_REQUEST_URI

## Object Hierarchy

      GObject
       +----SoupRequest
             +----SoupRequestData
             +----SoupRequestFile
             +----SoupRequestHTTP

## Implemented Interfaces

SoupRequest implements GInitable.

## Properties

      "session"                  SoupSession*          : Read / Write / Construct Only
      "uri"                      SoupURI*              : Read / Write / Construct Only

## Description

A SoupRequest is created by SoupRequester, and represents a request to retrieve a particular URI.

## Details

### struct SoupRequest

    struct SoupRequest;

A request to retrieve a particular URI.

Since 2.34

### soup_request_send ()

    GInputStream *      soup_request_send                   (SoupRequest *request,
                                                             GCancellable *cancellable,
                                                             GError **error);

Synchronously requests the URI pointed to by `request`, and returns a GInputStream that can be used to read its contents.

`request` : | a SoupRequest
`cancellable` : | a GCancellable or `NULL`
`error` : | return location for a GError, or `NULL`
Returns : | a GInputStream that can be used to read from the URI pointed to by `request`. [transfer full]

Since 2.34

### soup_request_send_async ()

    void                soup_request_send_async             (SoupRequest *request,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Begins an asynchronously request for the URI pointed to by `request`.

`request` : | a SoupRequest
`cancellable` : | a GCancellable or `NULL`
`callback` : | a GAsyncReadyCallback
`user_data` : | user data passed to `callback`

Since 2.34

### soup_request_send_finish ()

    GInputStream *      soup_request_send_finish            (SoupRequest *request,
                                                             GAsyncResult *result,
                                                             GError **error);

Gets the result of a `soup_request_send_async()`.

`request` : | a SoupRequest
`result` : | the GAsyncResult
`error` : | return location for a GError, or `NULL`
Returns : | a GInputStream that can be used to read from the URI pointed to by `request`. [transfer full]

Since 2.34

### soup_request_get_content_length ()

    goffset             soup_request_get_content_length     (SoupRequest *request);

Gets the length of the data represented by `request`.

`request` : | a SoupRequest
Returns : | the length of the data represented by `request`, or -1 if not known.

Since 2.34

### soup_request_get_content_type ()

    const char *        soup_request_get_content_type       (SoupRequest *request);

Gets the type of the data represented by `request`.

`request` : | a SoupRequest
Returns : | the type of the data represented by `request`, or `NULL` if not known.

Since 2.34

### soup_request_get_session ()

    SoupSession *       soup_request_get_session            (SoupRequest *request);

Gets `request`'s SoupSession

`request` : | a SoupRequest
Returns : | `request`'s SoupSession. [transfer none]

Since 2.34

### soup_request_get_uri ()

    SoupURI *           soup_request_get_uri                (SoupRequest *request);

Gets `request`'s URI

`request` : | a SoupRequest
Returns : | `request`'s URI. [transfer none]

Since 2.34

### SOUP_REQUEST_SESSION

    #define SOUP_REQUEST_SESSION "session"

### SOUP_REQUEST_URI

    #define SOUP_REQUEST_URI     "uri"

## Property Details

### The `"session"` property

      "session"                  SoupSession*          : Read / Write / Construct Only

The request's session.

### The `"uri"` property

      "uri"                      SoupURI*              : Read / Write / Construct Only

The request URI.