received_message_chunk_with_direction


Description:

[ Version ( since = "0.3.0" ) ]
public void received_message_chunk_with_direction (char direction, string data, int64 data_length) throws Error

Convenience version of received_message_chunk which takes the message direction and data separately, as provided by libsoup in a LoggerPrinter callback.

<informalexample><programlisting> UhmServer *mock_server; SoupSession *session; SoupLogger *logger;

static void soup_log_printer (SoupLogger *logger, SoupLoggerLogLevel level, char direction, const char *data, gpointer user_data) { / <!-- -->* Pass the data to libuhttpmock. *<!-- -->/ UhmServer *mock_server = UHM_SERVER (user_data); uhm_server_received_message_chunk_with_direction (mock_server, direction, data, strlen (data), NULL); }

mock_server = uhm_server_new (); session = soup_session_new ();

logger = soup_logger_new (SOUP_LOGGER_LOG_BODY, -1); soup_logger_set_printer (logger, (SoupLoggerPrinter) soup_log_printer, g_object_ref (mock_server), g_object_unref); soup_session_add_feature (session, SOUP_SESSION_FEATURE (logger)); g_object_unref (logger);

/<!-- -->* Do something with mock_server here. *<!-- -->/ </programlisting></informalexample>

Parameters:

this

a Server

direction

single character indicating the direction of message transmission

data

single line of a message which was received

data_length

length of data in bytes