http-client-host.c revision c6494255de7b934281dd052960fd8ab5aa48e79e
/* Copyright (c) 2013 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 "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:port
*/
static struct http_client_host_port *
unsigned int port, const char *https_name)
{
struct http_client_host_port *hport;
return hport;
}
return NULL;
}
static struct http_client_host_port *
unsigned int port, const char *https_name)
{
struct http_client_host_port *hport;
hport->ips_connect_idx = 0;
}
return hport;
}
{
struct http_client_request **req;
/* abort all pending requests */
}
}
{
}
static void
struct http_client_request *req)
{
struct http_client_request **req_idx;
unsigned int idx;
break;
}
}
}
/*
* Host
*/
static void
struct http_client_host_port *hport)
{
struct http_client_peer_addr addr;
}
{
struct http_client_host_port *hport;
return;
/* all IPs failed, but retry all of them again on the
next request. */
hport->ips_connect_idx = 0;
return;
}
}
static void
{
struct http_client_host_port *hport;
}
}
static void
struct http_client_host *host)
{
struct http_client_host_port *hport;
unsigned int requests = 0;
return;
}
// FIXME: make DNS result expire
/* make connections to requested ports */
hport->ips_connect_idx = 0;
if (count > 0)
}
}
static void http_client_host_lookup
(struct http_client_host *host)
{
struct dns_lookup_settings dns_set;
unsigned int ips_count;
int ret;
if (ret != 0) {
return;
}
"DNS lookup successful; got %d IPs", ips_count);
}
"Performing asynchronous DNS lookup");
}
}
struct http_client_host *http_client_host_get
{
struct http_client_host *host;
// FIXME: limit the maximum number of inactive cached hosts
}
return host;
}
struct http_client_request *req)
{
struct http_client_host_port *hport;
const char *error;
return;
}
}
/* add request to host (grouped by tcp port) */
else
/* start DNS lookup if necessary */
/* make a connection if we have an IP already */
return;
}
struct http_client_request *
{
struct http_client_host_port *hport;
struct http_client_request *const *requests;
struct http_client_request *req;
unsigned int i, count;
return NULL;
if (count == 0)
return NULL;
i = 0;
if (i == count)
return NULL;
}
}
"Connection to peer %s:%u claimed request %s %s",
return req;
}
{
struct http_client_host_port *hport;
struct http_client_request *const *requests;
unsigned int count, i;
*num_urgent_r = 0;
return 0;
(*num_urgent_r)++;
return count;
}
struct http_client_request *req)
{
struct http_client_host_port *hport;
return;
}
{
struct http_client_host_port *hport;
/* drop request queues */
}
}
}
{
struct http_client_request **req;
(*req)->to_delayed_error =
}
}