You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@locus.apache.org on 2000/06/02 16:50:00 UTC
cvs commit: apache-1.3/src/modules/proxy mod_proxy.h proxy_util.c
wrowe 00/06/02 07:49:59
Modified: src CHANGES
src/modules/proxy mod_proxy.h proxy_util.c
Log:
PR: 1462, 2216, 3645
Submitted by: David Whitmarsh <da...@dial.pipex.com>
Reviewed by: William Rowe
Applied the __declspec(thread) fix for Win95 so the mod_proxy module
may be dynamically loaded. Changed WIN32-specific dll entry point
function of the patch to MSVC standard DllMain.
Also expanded the list of PR's that should be closed in r.e. proxy
bugs fixed by 1.3.13-dev
Revision Changes Path
1.1544 +6 -1 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.1543
retrieving revision 1.1544
diff -u -r1.1543 -r1.1544
--- CHANGES 2000/06/01 17:51:23 1.1543
+++ CHANGES 2000/06/02 14:49:58 1.1544
@@ -1,8 +1,12 @@
Changes with Apache 1.3.13
+ *) Correct mod_proxy Win95 dynamic link __declspec(thread) bug.
+ David Whitmarsh <da...@dial.pipex.com>
+ PR: 1462, 2216, 3645
+
*) Correct mod_proxy Win32 garbage collection bug (clean failing
due to stat() against directory).
- PR: 1891, 3278, 4139, 5997
+ PR: 1891, 3278, 3640, 4139, 5997
[Michael Friedel <mf...@lbell.slctnet.com>]
*) Add '-n' option to htpasswd to make it print its user:pw record
@@ -94,6 +98,7 @@
*) use send/recv instead of write/read in proxy_connect -- fixes
https through proxy on NT. [willem.vanpelt@philips.com]
+ PR 5963, 5899, 5823, 5107, 4990?, 4885, 4680, 4468, 3801, 2014
*) [EBCDIC] Make chunked encoding work again; it was broken by the
recent CRLF macro changes. An oversight. [Martin Kraemer]
1.47 +5 -0 apache-1.3/src/modules/proxy/mod_proxy.h
Index: mod_proxy.h
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/proxy/mod_proxy.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- mod_proxy.h 2000/01/11 14:13:44 1.46
+++ mod_proxy.h 2000/06/02 14:49:59 1.47
@@ -260,6 +260,11 @@
cache_req *cache;
};
+struct per_thread_data {
+ struct hostent hpbuf;
+ u_long ipaddr;
+ char *charpbuf[2];
+};
/* Function prototypes */
/* proxy_cache.c */
1.89 +53 -14 apache-1.3/src/modules/proxy/proxy_util.c
Index: proxy_util.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_util.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -r1.88 -r1.89
--- proxy_util.c 2000/06/01 23:42:26 1.88
+++ proxy_util.c 2000/06/02 14:49:59 1.89
@@ -68,7 +68,7 @@
static int proxy_match_domainname(struct dirconn_entry *This, request_rec *r);
static int proxy_match_hostname(struct dirconn_entry *This, request_rec *r);
static int proxy_match_word(struct dirconn_entry *This, request_rec *r);
-
+static struct per_thread_data *get_per_thread_data();
/* already called in the knowledge that the characters are hex digits */
int ap_proxy_hex2c(const char *x)
{
@@ -867,9 +867,7 @@
{
int i;
struct hostent *hp;
- static APACHE_TLS struct hostent hpbuf;
- static APACHE_TLS u_long ipaddr;
- static APACHE_TLS char *charpbuf[2];
+ struct per_thread_data *ptd = get_per_thread_data();
for (i = 0; host[i] != '\0'; i++)
if (!ap_isdigit(host[i]) && host[i] != '.')
@@ -881,17 +879,17 @@
return "Host not found";
}
else {
- ipaddr = ap_inet_addr(host);
- hp = gethostbyaddr((char *) &ipaddr, sizeof(ipaddr), AF_INET);
+ ptd->ipaddr = ap_inet_addr(host);
+ hp = gethostbyaddr((char *) &ptd->ipaddr, sizeof(ptd->ipaddr), AF_INET);
if (hp == NULL) {
- memset(&hpbuf, 0, sizeof(hpbuf));
- hpbuf.h_name = 0;
- hpbuf.h_addrtype = AF_INET;
- hpbuf.h_length = sizeof(ipaddr);
- hpbuf.h_addr_list = charpbuf;
- hpbuf.h_addr_list[0] = (char *) &ipaddr;
- hpbuf.h_addr_list[1] = 0;
- hp = &hpbuf;
+ memset(&ptd->hpbuf, 0, sizeof(ptd->hpbuf));
+ ptd->hpbuf.h_name = 0;
+ ptd->hpbuf.h_addrtype = AF_INET;
+ ptd->hpbuf.h_length = sizeof(ptd->ipaddr);
+ ptd->hpbuf.h_addr_list = ptd->charpbuf;
+ ptd->hpbuf.h_addr_list[0] = (char *) &ptd->ipaddr;
+ ptd->hpbuf.h_addr_list[1] = 0;
+ hp = &ptd->hpbuf;
}
}
*reqhp = *hp;
@@ -1290,3 +1288,44 @@
return len;
}
+#if defined WIN32
+
+static DWORD tls_index;
+
+BOOL WINAPI DllMain (HINSTANCE dllhandle, DWORD reason, LPVOID reserved)
+{
+ LPVOID memptr;
+
+ switch (reason) {
+ case DLL_PROCESS_ATTACH:
+ tls_index = TlsAlloc();
+ case DLL_THREAD_ATTACH: /* intentional no break */
+ TlsSetValue (tls_index, malloc (sizeof (struct per_thread_data)));
+ break;
+ case DLL_THREAD_DETACH:
+ memptr = TlsGetValue (tls_index);
+ if (memptr) {
+ free (memptr);
+ TlsSetValue (tls_index, 0);
+ }
+ break;
+ }
+
+ return TRUE;
+}
+
+#endif
+
+static struct per_thread_data *get_per_thread_data()
+{
+#if defined WIN32
+
+ return (struct per_thread_data *) TlsGetValue (tls_index);
+
+#else
+
+ static APACHE_TLS per_thread_data sptd;
+ return *sptd;
+
+#endif
+}
Re: cvs commit: apache-1.3/src/modules/proxy mod_proxy.h proxy_util.c
Posted by David Whitmarsh <da...@dial.pipex.com>.
Rodent of Unusual Size wrote:
> wrowe@locus.apache.org wrote:
> >
> > Log:
> > PR: 1462, 2216, 3645
> > Submitted by: David Whitmarsh <da...@dial.pipex.com>
> > Reviewed by: William Rowe
>
> This breaks the build of mod_proxy on Linux. I'm not entirely
> sure what's going on here; does the following fix this and have
> the desired effect?
>
> Index: proxy_util.c
> ===================================================================
> RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_util.c,v
> retrieving revision 1.89
> diff -u -r1.89 proxy_util.c
> --- proxy_util.c 2000/06/02 14:49:59 1.89
> +++ proxy_util.c 2000/06/02 16:02:52
> @@ -1324,8 +1324,8 @@
>
> #else
>
> - static APACHE_TLS per_thread_data sptd;
> - return *sptd;
> + static APACHE_TLS struct per_thread_data sptd;
> + return &sptd;
>
> #endif
> }
>
Whoops.
I believe you are correct. I only found this a couple of weeks ago
myself when I finally santitised my laptop by replacing Win95 with
linux.
David
RE: cvs commit: apache-1.3/src/modules/proxy mod_proxy.h proxy_util.c
Posted by "William A. Rowe, Jr." <wr...@lnd.com>.
Yep, that did it. Typo ouside of the Win build (promise to
throw a GB drive in my old 386 and get linux or free bsd up
within a few weeks :-)
> -----Original Message-----
> From: Rodent of Unusual Size [mailto:Ken.Coar@Golux.Com]
> Sent: Friday, June 02, 2000 11:03 AM
> To: new-httpd@apache.org
> Subject: Re: cvs commit: apache-1.3/src/modules/proxy mod_proxy.h
> proxy_util.c
>
>
> wrowe@locus.apache.org wrote:
> >
> > Log:
> > PR: 1462, 2216, 3645
> > Submitted by: David Whitmarsh <da...@dial.pipex.com>
> > Reviewed by: William Rowe
>
> This breaks the build of mod_proxy on Linux. I'm not entirely
> sure what's going on here; does the following fix this and have
> the desired effect?
>
> Index: proxy_util.c
> ===================================================================
> RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_util.c,v
> retrieving revision 1.89
> diff -u -r1.89 proxy_util.c
> --- proxy_util.c 2000/06/02 14:49:59 1.89
> +++ proxy_util.c 2000/06/02 16:02:52
> @@ -1324,8 +1324,8 @@
>
> #else
>
> - static APACHE_TLS per_thread_data sptd;
> - return *sptd;
> + static APACHE_TLS struct per_thread_data sptd;
> + return &sptd;
>
> #endif
> }
>
> --
> #ken P-)}
>
> Ken Coar <http://Golux.Com/coar/>
> Apache Software Foundation <http://www.apache.org/>
> "Apache Server for Dummies" <http://Apache-Server.Com/>
> "Apache Server Unleashed" <http://ApacheUnleashed.Com/>
>
Re: cvs commit: apache-1.3/src/modules/proxy mod_proxy.h proxy_util.c
Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
wrowe@locus.apache.org wrote:
>
> Log:
> PR: 1462, 2216, 3645
> Submitted by: David Whitmarsh <da...@dial.pipex.com>
> Reviewed by: William Rowe
This breaks the build of mod_proxy on Linux. I'm not entirely
sure what's going on here; does the following fix this and have
the desired effect?
Index: proxy_util.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_util.c,v
retrieving revision 1.89
diff -u -r1.89 proxy_util.c
--- proxy_util.c 2000/06/02 14:49:59 1.89
+++ proxy_util.c 2000/06/02 16:02:52
@@ -1324,8 +1324,8 @@
#else
- static APACHE_TLS per_thread_data sptd;
- return *sptd;
+ static APACHE_TLS struct per_thread_data sptd;
+ return &sptd;
#endif
}
--
#ken P-)}
Ken Coar <http://Golux.Com/coar/>
Apache Software Foundation <http://www.apache.org/>
"Apache Server for Dummies" <http://Apache-Server.Com/>
"Apache Server Unleashed" <http://ApacheUnleashed.Com/>