Regression sending sync message
A test case to reproduce the problem:
#include <glib.h>
#include <libsoup/soup.h>
static void
http_printer(SoupLogger *logger,
SoupLoggerLogLevel level,
char direction,
const char *data,
gpointer user_data)
{
g_message("%c %s", direction, data);
}
int main()
{
SoupSession *session;
SoupMessage *msg;
SoupLogger *logger;
GInputStream *stream;
char *encoded_form;
GError *error = NULL;
logger = soup_logger_new(SOUP_LOGGER_LOG_BODY);
soup_logger_set_printer(logger, http_printer, NULL, NULL);
encoded_form = soup_form_encode("sessionId", "console",
"authenticationToken", "1",
"clientAddress", "10.1.213.24:52192",
NULL);
msg = soup_message_new_from_encoded_form("POST",
"http://127.0.0.1:8444",
encoded_form);
g_assert(msg);
soup_message_set_flags(msg, SOUP_MESSAGE_IDEMPOTENT);
session = soup_session_new();
soup_session_add_feature(session, SOUP_SESSION_FEATURE(logger));
stream = soup_session_send(session, msg, NULL, &error);
if (stream == NULL) {
g_warning("error: %s", error->message);
g_error_free(error);
}
g_clear_object(&stream);
g_object_unref(msg);
g_object_unref(session);
return 0;
}
Open a server with something like: nc -l -p 8444 | hexdump -C
Run the test application and see that not all the data arrives to the server. Then close the application and you will see that it somehow the stream flushes and the rest of the data arrives to the server.
Edited by Patrick Griffis