--- src/os/win32/readdir.h~	Wed Feb 14 08:22:10 2001
+++ src/os/win32/readdir.h	Wed Mar 07 19:17:18 2001
@@ -75,15 +75,14 @@
 # define API_EXPORT(type)    __declspec(dllexport) type __stdcall
 #endif
 
-/* struct dirent - same as Unix */
 struct dirent {
     long d_ino;                    /* inode (always 1 in WIN32) */
     off_t d_off;                /* offset to this dirent */
     unsigned short d_reclen;    /* length of d_name */
     char d_name[_MAX_FNAME+1];    /* filename (null terminated) */
+    unsigned d_attr;            /* file attribute bit mask */
 };
 
-/* typedef DIR - not the same as Unix */
 typedef struct {
     long handle;                /* _findfirst/_findnext handle */
     short offset;                /* offset into directory */
@@ -93,7 +92,8 @@
     struct dirent dent;         /* the dirent to return */
 } DIR;
 
-/* Function prototypes */
+#define A_DIR _A_SUBDIR
+
 API_EXPORT(DIR *) opendir(const char *);
 API_EXPORT(struct dirent *) readdir(DIR *);
 API_EXPORT(int) closedir(DIR *);
--- src/os/win32/readdir.c~	Wed Feb 14 08:22:10 2001
+++ src/os/win32/readdir.c	Wed Mar 07 19:16:08 2001
@@ -125,6 +125,7 @@
     dp->dent.d_ino = 1;
     dp->dent.d_reclen = strlen(dp->dent.d_name);
     dp->dent.d_off = dp->offset;
+    dp->dent.d_attr = dp->fileinfo.attrib;
 
     return &(dp->dent);
 }
--- src/modules/proxy/proxy_cache.c~	Mon Jan 15 11:05:30 2001
+++ src/modules/proxy/proxy_cache.c	Wed Mar 07 19:19:22 2001
@@ -468,11 +468,11 @@
 	/* FIXME: Shouldn't any unexpected files be deleted? */
 	/*      if (strlen(ent->d_name) != HASH_LEN) continue; */
 
-/* under OS/2 use dirent's d_attr to identify a diretory */
+/* under OS/2 or WIN32 use dirent's d_attr to identify a directory */
 /* under TPF use stat to identify a directory */
-#if defined(OS2) || defined(TPF)
+#if defined(OS2) || defined(WIN32) || defined(TPF)
 /* is it a directory? */
-#ifdef OS2
+#if defined(OS2) || defined(WIN32)
 	if (ent->d_attr & A_DIR) {
 #elif defined(TPF)
     if (stat(filename, &buf) == -1) {
@@ -500,18 +500,6 @@
 #endif
 
 /* read the file */
-#if defined(WIN32)
-        /* On WIN32 open does not work for directories, 
-         * so we us stat instead of fstat to determine 
-         * if the file is a directory 
-         */
-        if (stat(filename, &buf) == -1) {
-            ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
-        		 "proxy gc: stat(%s)", filename);
-            continue;
-        }
-        fd = -1;
-#else
  	fd = open(filename, O_RDONLY | O_BINARY);
 	if (fd == -1) {
 	    if (errno != ENOENT)
@@ -525,16 +513,12 @@
 	    close(fd);
 	    continue;
 	}
-#endif
 
-/* In OS/2 and TPF this has already been done above */
-#if !defined(OS2) && !defined(TPF)
+/* In OS/2, WIN32 and TPF this has already been done above */
+#if !defined(OS2) && !defined(WIN32) && !defined(TPF)
 	if (S_ISDIR(buf.st_mode)) {
 	    char newcachedir[HUGE_STRING_LEN];
-#if !defined(WIN32)
-            /* Win32 used stat, no file to close */
             close(fd);
-#endif
 	    ap_snprintf(newcachedir, sizeof(newcachedir),
 			"%s%s/", cachesubdir, ent->d_name);
 	    if (!sub_garbage_coll(r, files, cachebasedir, newcachedir)) {
@@ -554,19 +538,6 @@
 	}
 #endif
 
-#if defined(WIN32)
-        /* Since we have determined above that the file is not a directory,
-         * it should be safe to open it now 
-         */
-        fd = open(filename, O_RDONLY | O_BINARY);
-        if (fd == -1) {
-            if (errno != ENOENT)
-	        ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
-		             "proxy gc: open(%s) = %d", filename, errno);
-            continue;
-        }
-#endif
- 
 	i = read(fd, line, 26);
 	close(fd);
 	if (i == -1) {
