### Method

# Soup Session send

#### Declaration [src]

    GInputStream*
    soup_session_send (
      SoupSession* session,
      SoupMessage* msg,
      GCancellable* cancellable,
      GError** error
    )

#### Description [src]

Synchronously sends `msg` and waits for the beginning of a response.

On success, a `GInputStream` will be returned which you can use to read the response body. (“Success” here means only that an HTTP response was received and understood; it does not necessarily mean that a 2xx class status code was received.)

If non-`NULL`, `cancellable` can be used to cancel the request; `soup_session_send()` will return a `G_IO_ERROR_CANCELLED` error. Note that with requests that have side effects (eg, `POST`, `PUT`, `DELETE`) it is possible that you might cancel the request after the server acts on it, but before it returns a response, leaving the remote resource in an unknown state.

If `msg` is requeued due to a redirect or authentication, the initial (`3xx/401/407`) response body will be suppressed, and `soup_session_send()` will only return once a final response has been received.

Possible error domains include `SoupSessionError`, `GIOErrorEnum`, and `GTlsError` which you may want to specifically handle.

#### Parameters

`msg`

  Type: `SoupMessage`

  A `SoupMessage`.

  The data is owned by the caller of the method.

`cancellable`

  Type: `GCancellable`

  A `GCancellable`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the method if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `GInputStream`

A `GInputStream` for reading the response body, or `NULL` on error.

The caller of the method takes ownership of the returned data, and is responsible for freeing it.