-const char cgi_rcs[] = "$Id: cgi.c,v 1.102 2008/02/23 16:33:43 fabiankeil Exp $";
+const char cgi_rcs[] = "$Id: cgi.c,v 1.103 2008/03/21 11:13:57 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgi.c,v $
*
* Revisions :
* $Log: cgi.c,v $
+ * Revision 1.103 2008/03/21 11:13:57 fabiankeil
+ * Only gather host information if it's actually needed.
+ * Also move the code out of accept_connection() so it's less likely
+ * to delay other incoming connections if the host is misconfigured.
+ *
* Revision 1.102 2008/02/23 16:33:43 fabiankeil
* Let forward_url() use the standard parameter ordering
* and mark its second parameter immutable.
return NULL;
}
- get_host_information(csp->cfd, &ip_address, &hostname);
+ if (csp->config->hostname)
+ {
+ get_host_information(csp->cfd, &ip_address, NULL);
+ hostname = strdup(csp->config->hostname);
+ }
+ else
+ {
+ get_host_information(csp->cfd, &ip_address, &hostname);
+ }
err = map(exports, "version", 1, html_encode(VERSION), 0);
if (!err) err = map(exports, "my-ip-address", 1, html_encode(ip_address ? ip_address : "unknown"), 0);
Purpose : Used with other docs and files only.
- $Id: p-config.sgml,v 2.27 2008/01/17 01:49:51 hal9 Exp $
+ $Id: p-config.sgml,v 2.28 2008/02/03 19:15:54 fabiankeil Exp $
Copyright (C) 2001-2008 Privoxy Developers http://www.privoxy.org/
See LICENSE.
Sample Configuration File for Privoxy v&p-version;
</title>
<para>
- $Id: p-config.sgml,v 2.27 2008/01/17 01:49:51 hal9 Exp $
+ $Id: p-config.sgml,v 2.28 2008/02/03 19:15:54 fabiankeil Exp $
</para>
<para>
Copyright (C) 2001-2008 Privoxy Developers http://www.privoxy.org/
<![%config-file;[<literallayout>@@#single-threaded</literallayout>]]>
</sect3>
+<!-- ~~~~~ New section ~~~~~ -->
+<sect3 renderas="sect4" id="hostname"><title>hostname</title>
+
+<variablelist>
+ <varlistentry>
+ <term>Specifies:</term>
+ <listitem>
+ <para>
+ The hostname shown on the CGI pages.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Type of value:</term>
+ <listitem>
+ <para>Text</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Default value:</term>
+ <listitem>
+ <para><emphasis>Unset</emphasis></para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Effect if unset:</term>
+ <listitem>
+ <para>
+ The hostname provided by the operating system is used.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Notes:</term>
+ <listitem>
+ <para>
+ On some misconfigured systems resolving the hostname fails or
+ takes too much time and slows Privoxy down. Setting a fixed hostname
+ works around the problem.
+ </para>
+ <para>
+ In other circumstances it might be desirable to show a hostname
+ other than the one returned by the operating system. For example
+ if the system has several different hostnames and you don't want
+ to use the first one.
+ </para>
+ <para>
+ Note that Privoxy does not validate the specified hostname value.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+
+<![%config-file;[<literallayout>@@#hostname hostname.example.org</literallayout>]]>
+</sect3>
+
</sect2>
<!-- ~ End section ~ -->
-const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.45 2007/09/30 16:59:22 fabiankeil Exp $";
+const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.46 2008/03/21 11:13:57 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jbsockets.c,v $
*
* Revisions :
* $Log: jbsockets.c,v $
+ * Revision 1.46 2008/03/21 11:13:57 fabiankeil
+ * Only gather host information if it's actually needed.
+ * Also move the code out of accept_connection() so it's less likely
+ * to delay other incoming connections if the host is misconfigured.
+ *
* Revision 1.45 2007/09/30 16:59:22 fabiankeil
* Set the maximum listen() backlog to 128. Apparently SOMAXCONN is
* neither high enough, nor a hard limit on mingw32. Again for BR#1795281.
* 2 : ip_address = Pointer to return the pointer to
* the ip address string.
* 3 : hostname = Pointer to return the pointer to
- * the hostname.
+ * the hostname or NULL if the caller
+ * isn't interested in it.
*
* Returns : void.
*
#endif /* def HAVE_GETHOSTBYADDR_R_(8|7|5)_ARGS */
s_length = sizeof(server);
- *hostname = NULL;
+ if (NULL != hostname)
+ {
+ *hostname = NULL;
+ }
*ip_address = NULL;
if (!getsockname(afd, (struct sockaddr *) &server, &s_length))
{
*ip_address = strdup(inet_ntoa(server.sin_addr));
+
+ if (NULL == hostname)
+ {
+ /*
+ * We're done here, the caller isn't
+ * interested in knowing the hostname.
+ */
+ return;
+ }
#if defined(HAVE_GETHOSTBYADDR_R_8_ARGS)
gethostbyaddr_r((const char *)&server.sin_addr,
sizeof(server.sin_addr), AF_INET,
-const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.72 2008/02/03 13:46:15 fabiankeil Exp $";
+const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.73 2008/02/16 16:54:51 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/loadcfg.c,v $
* routine to load the configuration and the global
* variables it writes to.
*
- * Copyright : Written by and Copyright (C) 2001-2007 the SourceForge
+ * Copyright : Written by and Copyright (C) 2001-2008 the SourceForge
* Privoxy team. http://www.privoxy.org/
*
* Based on the Internet Junkbuster originally written
*
* Revisions :
* $Log: loadcfg.c,v $
+ * Revision 1.73 2008/02/16 16:54:51 fabiankeil
+ * Fix typo.
+ *
* Revision 1.72 2008/02/03 13:46:15 fabiankeil
* Add SOCKS5 support. Patch #1862863 by Eric M. Hopper with minor changes.
*
#define hash_forward_socks4a 2639958518ul /* "forward-socks4a" */
#define hash_forward_socks5 3963965522ul /* "forward-socks5" */
#define hash_forwarded_connect_retries 101465292ul /* "forwarded-connect-retries" */
+#define hash_hostname 10308071ul /* "hostname" */
#define hash_jarfile 2046641ul /* "jarfile" */
#define hash_listen_address 1255650842ul /* "listen-address" */
#define hash_logdir 422889ul /* "logdir" */
freez(config->confdir);
freez(config->logdir);
freez(config->templdir);
+ freez(config->hostname);
freez(config->haddr);
freez(config->logfile);
config->forwarded_connect_retries = atoi(arg);
continue;
+/* *************************************************************************
+ * hostname hostname-to-show-on-cgi-pages
+ * *************************************************************************/
+ case hash_hostname :
+ freez(config->hostname);
+ config->hostname = strdup(arg);
+ if (NULL == config->hostname)
+ {
+ log_error(LOG_LEVEL_FATAL, "Out of memory saving hostname.");
+ }
+ continue;
+
/* *************************************************************************
* jarfile jar-file-name
* In logdir by default
#ifndef PROJECT_H_INCLUDED
#define PROJECT_H_INCLUDED
/** Version string. */
-#define PROJECT_H_VERSION "$Id: project.h,v 1.105 2008/03/21 11:16:27 fabiankeil Exp $"
+#define PROJECT_H_VERSION "$Id: project.h,v 1.106 2008/03/24 11:21:03 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/project.h,v $
*
* Revisions :
* $Log: project.h,v $
+ * Revision 1.106 2008/03/24 11:21:03 fabiankeil
+ * Share the action settings for multiple patterns in the same
+ * section so we waste less memory for gigantic block lists
+ * (and load them slightly faster). Reported by Franz Schwartau.
+ *
* Revision 1.105 2008/03/21 11:16:27 fabiankeil
* Garbage-collect csp->my_ip_addr_str and csp->my_hostname.
*
/** The short names of the pcre filter files. */
const char *re_filterfile_short[MAX_AF_FILES];
+ /** The hostname to show on CGI pages, or NULL to use the real one. */
+ const char *hostname;
+
#ifdef FEATURE_COOKIE_JAR
/** The file name of the cookie jar file */