return FALSE;
}
- debug(session->web, "bytes to write %zu", count);
-
status = g_io_channel_write_chars(session->transport_channel,
buf->str, count, &bytes_written, NULL);
- debug(session->web, "status %u bytes written %zu",
- status, bytes_written);
+ debug(session->web, "status %u bytes to write %zu bytes written %zu",
+ status, count, bytes_written);
if (status != G_IO_STATUS_NORMAL && status != G_IO_STATUS_AGAIN)
return FALSE;
{
struct web_session *session = user_data;
struct addrinfo hints;
+ char *port;
int ret;
if (results == NULL || results[0] == NULL) {
session->addr = NULL;
}
- ret = getaddrinfo(results[0], NULL, &hints, &session->addr);
+ port = g_strdup_printf("%u", session->port);
+ ret = getaddrinfo(results[0], port, &hints, &session->addr);
+ g_free(port);
if (ret != 0 || session->addr == NULL) {
call_result_func(session, 400);
return;
return 0;
}
} else {
+ struct addrinfo hints;
+ char *port;
+ int ret;
+
if (session->address == NULL)
session->address = g_strdup(session->host);
+ memset(&hints, 0, sizeof(struct addrinfo));
+ hints.ai_flags = AI_NUMERICHOST;
+
+ if (session->addr != NULL) {
+ freeaddrinfo(session->addr);
+ session->addr = NULL;
+ }
+
+ port = g_strdup_printf("%u", session->port);
+ ret = getaddrinfo(session->address, port, &hints,
+ &session->addr);
+ g_free(port);
+ if (ret != 0 || session->addr == NULL) {
+ free_session(session);
+ return 0;
+ }
+
if (create_transport(session) < 0) {
free_session(session);
return 0;