GResolv *resolv;
char *accept_option;
char *user_agent;
+ gboolean close_connection;
GWebDebugFunc debug_func;
gpointer debug_data;
web->accept_option = g_strdup("*/*");
web->user_agent = g_strdup_printf("GWeb/%s", VERSION);
+ web->close_connection = FALSE;
return web;
}
return result;
}
+void g_web_set_close_connection(GWeb *web, gboolean enabled)
+{
+ if (web == NULL)
+ return;
+
+ web->close_connection = enabled;
+}
+
+gboolean g_web_get_close_connection(GWeb *web)
+{
+ if (web == NULL)
+ return FALSE;
+
+ return web->close_connection;
+}
+
static gboolean received_data(GIOChannel *channel, GIOCondition cond,
gpointer user_data)
{
if (session->web->accept_option != NULL)
g_string_append_printf(buf, "Accept: %s\r\n",
session->web->accept_option);
- g_string_append(buf, "Connection: close\r\n");
+ if (session->web->close_connection == TRUE)
+ g_string_append(buf, "Connection: close\r\n");
g_string_append(buf, "\r\n");
str = g_string_free(buf, FALSE);
gboolean g_web_set_user_agent(GWeb *web, const char *format, ...)
__attribute__((format(printf, 2, 3)));
+void g_web_set_close_connection(GWeb *web, gboolean enabled);
+gboolean g_web_get_close_connection(GWeb *web);
+
guint g_web_request(GWeb *web, GWebMethod method, const char *url,
GWebResultFunc func, gpointer user_data);