to X-Forwarded-For: headers. This helps GroupDAV along.
$Id$
+Mon Jan 30 12:09:00 EST 2006 ajc
+* When the -f option is specified, honor X-Forwarded-Host: in addition
+ to X-Forwarded-For: headers. This helps GroupDAV along.
+
Mon Jan 30 00:14:06 EST 2006 ajc
* HTML messages are now encoded as "Quoted-Printable" before being
transmitted to the server. New utility function text_to_server_qp()
"X-Forwarded-For:" HTTP headers which may be added if your WebCit service
is sitting behind a front end proxy. This will allow users in your "Who
is online?" list to appear as connecting from their actual host address
- instead of the address of the proxy.
+ instead of the address of the proxy. In addition, the
+ "X-Forwarded-Host:" header from the front end proxy will also be honored,
+ which will help to make automatically generated absolute URL's (for
+ things like GroupDAV and mailing list subscriptions) correct.
-> remotehost: the name or IP address of the host on which your Citadel
server is running. The default is "localhost".
for (rptr=req; rptr!=NULL; rptr=rptr->next) {
/* lprintf(9, "< %s\n", rptr->line); */
+
+ /*
+ * We don't appear to need this; it was already done in webcit.c
if (!strncasecmp(rptr->line, "Host: ", 6)) {
safestrncpy(WC->http_host, &rptr->line[6],
sizeof WC->http_host);
}
+ */
+
if (!strncasecmp(rptr->line, "If-Match: ", 10)) {
safestrncpy(dav_ifmatch, &rptr->line[10],
sizeof dav_ifmatch);
while (hptr != NULL) {
safestrncpy(buf, hptr->line, sizeof buf);
+ lprintf(9, "HTTP HEADER: %s\n", buf);
hptr = hptr->next;
if (!strncasecmp(buf, "Cookie: webcit=", 15)) {
else if (!strncasecmp(buf, "User-agent: ", 12)) {
safestrncpy(user_agent, &buf[12], sizeof user_agent);
}
+ else if (!strncasecmp(buf, "X-Forwarded-Host: ", 18)) {
+ if (follow_xff) {
+ safestrncpy(WC->http_host, &buf[18], sizeof WC->http_host);
+ }
+ }
else if (!strncasecmp(buf, "Host: ", 6)) {
- safestrncpy(WC->http_host, &buf[6], sizeof WC->http_host);
+ if (strlen(WC->http_host) == 0) {
+ safestrncpy(WC->http_host, &buf[6], sizeof WC->http_host);
+ }
}
else if (!strncasecmp(buf, "X-Forwarded-For: ", 17)) {
safestrncpy(browser_host, &buf[17], sizeof browser_host);