http-client-host.c revision 1e63e30812158e6446d81cdbb2f45954794d4f8a
/* Copyright (c) 2013-2016 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "net.h"
#include "str.h"
#include "hash.h"
#include "array.h"
#include "llist.h"
#include "ioloop.h"
#include "istream.h"
#include "ostream.h"
#include "time-util.h"
#include "dns-lookup.h"
#include "http-response-parser.h"
#include "http-client-private.h"
/*
* Logging
*/
static inline void
static inline void
const char *format, ...)
{
i_debug("http-client: host %s: %s",
}
}
/*
* Host
*/
static void
const char *error)
{
struct http_client_queue *const *queue_idx;
}
}
static void
struct http_client_host *host)
{
struct http_client_queue *const *queue_idx;
unsigned int requests = 0;
/* lookup failed */
return;
}
/* make connections to requested ports */
}
}
static void http_client_host_lookup
(struct http_client_host *host)
{
struct dns_lookup_settings dns_set;
int ret;
"Performing asynchronous DNS lookup");
"Performing asynchronous DNS lookup");
else {
}
} else {
unsigned int ips_count;
if (ret != 0) {
return;
}
"DNS lookup successful; got %d IPs", ips_count);
}
}
}
{
if (host->unix_local)
return 0;
if (host->explicit_ip)
return 0;
return -1;
return 0;
"IPs have expired; need to refresh DNS lookup");
return -1;
}
static struct http_client_host *http_client_host_create
(struct http_client *client)
{
struct http_client_host *host;
// FIXME: limit the maximum number of inactive cached hosts
return host;
}
struct http_client_host *http_client_host_get
{
struct http_client_host *host;
}
} else {
}
}
}
return host;
}
struct http_client_request *req)
{
struct http_client_queue *queue;
struct http_client_peer_addr addr;
const char *error;
if (http_client_peer_addr_is_https(&addr) &&
return;
}
}
/* add request to queue (grouped by tcp port) */
if (host->unix_local) {
return;
}
/* start DNS lookup if necessary */
/* make a connection if we have an IP already */
return;
}
{
struct http_client_queue *const *queue_idx;
/* drop request queues */
}
}
{
struct http_client_queue *const *queue_idx;
}