different domains on the same origin server peer.
/*
- * $Id: forward.cc,v 1.102 2003/05/17 17:35:06 hno Exp $
+ * $Id: forward.cc,v 1.103 2003/06/19 13:47:25 hno Exp $
*
* DEBUG: section 17 Request Forwarding
* AUTHOR: Duane Wessels
FwdServer *fs = fwdState->servers;
const char *host;
unsigned short port;
+ const char *domain = NULL;
time_t ctimeout;
struct in_addr outgoing;
debug(17, 3) ("fwdConnectStart: %s\n", url);
if (fs->_peer) {
- host = fs->_peer->host;
+ host = fs->_peer->name;
port = fs->_peer->http_port;
ctimeout = fs->_peer->connect_timeout > 0 ? fs->_peer->connect_timeout
: Config.Timeout.peer_connect;
+
+ if (fs->_peer->options.originserver)
+ domain = fwdState->request->host;
} else {
host = fwdState->request->host;
port = fwdState->request->port;
}
if (fwdCheckRetriable(fwdState)) {
- if ((fd = pconnPop(host, port)) >= 0) {
+ if ((fd = pconnPop(host, port, domain)) >= 0) {
debug(17, 3) ("fwdConnectStart: reusing pconn FD %d\n", fd);
fwdState->server_fd = fd;
fwdState->n_tries++;
/*
- * $Id: http.cc,v 1.414 2003/05/24 11:32:34 robertc Exp $
+ * $Id: http.cc,v 1.415 2003/06/19 13:47:25 hno Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
comm_remove_close_handler(fd, httpStateFree, this);
fwdUnregister(fd, fwd);
- pconnPush(fd, request->host, request->port);
+
+ if (_peer) {
+ if (_peer->options.originserver)
+ pconnPush(fd, _peer->name, orig_request->port, orig_request->host);
+ else
+ pconnPush(fd, _peer->name, _peer->http_port, NULL);
+ } else {
+ pconnPush(fd, request->host, request->port, NULL);
+ }
+
fwdComplete(fwd);
fd = -1;
httpStateFree(fd, this);
/*
- * $Id: pconn.cc,v 1.36 2003/02/21 22:50:10 robertc Exp $
+ * $Id: pconn.cc,v 1.37 2003/06/19 13:47:25 hno Exp $
*
* DEBUG: section 48 Persistent Connections
* AUTHOR: Duane Wessels
static IOCB pconnRead;
static PF pconnTimeout;
-static const char *pconnKey(const char *host, u_short port);
+static const char *pconnKey(const char *host, u_short port, const char *domain);
static hash_table *table = NULL;
static struct _pconn *pconnNew(const char *key);
static const char *
-pconnKey(const char *host, u_short port)
+pconnKey(const char *host, u_short port, const char *domain)
{
- LOCAL_ARRAY(char, buf, SQUIDHOSTNAMELEN + 10);
- snprintf(buf, SQUIDHOSTNAMELEN + 10, "%s.%d", host, (int) port);
+ LOCAL_ARRAY(char, buf, SQUIDHOSTNAMELEN * 2 + 10);
+
+ if (domain)
+ snprintf(buf, SQUIDHOSTNAMELEN * 2 + 10, "%s:%d/%s", host, (int) port, domain);
+ else
+ snprintf(buf, SQUIDHOSTNAMELEN * 2 + 10, "%s:%d", host, (int) port);
+
return buf;
}
}
void
-pconnPush(int fd, const char *host, u_short port)
+pconnPush(int fd, const char *host, u_short port, const char *domain)
{
struct _pconn *p;
}
assert(table != NULL);
- strcpy(key, pconnKey(host, port));
+ strcpy(key, pconnKey(host, port, domain));
p = (struct _pconn *) hash_lookup(table, key);
* quite a bit of CPU. Just keep it in mind.
*/
int
-pconnPop(const char *host, u_short port)
+pconnPop(const char *host, u_short port, const char *domain)
{
struct _pconn *p;
int fd = -1;
LOCAL_ARRAY(char, key, SQUIDHOSTNAMELEN + 10);
assert(table != NULL);
- strcpy(key, pconnKey(host, port));
+ strcpy(key, pconnKey(host, port, domain));
hptr = (hash_link *)hash_lookup(table, key);
if (hptr != NULL) {
/*
- * $Id: protos.h,v 1.478 2003/05/18 00:34:50 robertc Exp $
+ * $Id: protos.h,v 1.479 2003/06/19 13:47:25 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
SQUIDCEXTERN err_type errorReservePageId(const char *page_name);
SQUIDCEXTERN ErrorState *errorCon(err_type type, http_status);
-SQUIDCEXTERN void pconnPush(int, const char *host, u_short port);
-SQUIDCEXTERN int pconnPop(const char *host, u_short port);
+SQUIDCEXTERN void pconnPush(int, const char *host, u_short port, const char *domain);
+SQUIDCEXTERN int pconnPop(const char *host, u_short port, const char *domain);
SQUIDCEXTERN void pconnInit(void);
/* tools.c */