aboutsummaryrefslogtreecommitdiffstats
path: root/www/apache13/files/patch-ag
blob: 48d05fff51c206cf5204443154708cf6a324ce3b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
*** src/mod_dir.c.orig  Sat Jun 22 00:12:07 1996
--- src/mod_dir.c   Sun Nov  3 08:33:16 1996
***************
*** 83,88 ****
--- 83,89 ----
  #define SUPPRESS_LAST_MOD 8
  #define SUPPRESS_SIZE 16
  #define SUPPRESS_DESC 32
+ #define SUPPRESS_HTML_PREAMBLE 64
  
  struct item {
      char *type;
***************
*** 205,210 ****
--- 206,213 ----
              opts |= SUPPRESS_SIZE;
          else if(!strcasecmp(w,"SuppressDescription"))
              opts |= SUPPRESS_DESC;
+   else if(!strcasecmp(w,"SuppressHTMLPreamble"))
+       opts |= SUPPRESS_HTML_PREAMBLE;
          else if(!strcasecmp(w,"None"))
              opts = 0;
    else
***************
*** 404,411 ****
   * Actually generating output
   */
  
  
! int insert_readme(char *name, char *readme_fname, int rule, request_rec *r) {
      char *fn;
      FILE *f;
      struct stat finfo;
--- 407,421 ----
   * Actually generating output
   */
  
+ void put_html_preamble(char *title_name, request_rec *r)
+ {
+   rvputs(r, "<HEAD><TITLE>Index of ", title_name,
+          "</TITLE></HEAD><BODY>\n", NULL);
+ }
  
! int insert_readme(char *name, char *readme_fname, int rule,
!         char *title_name, request_rec *r)
! {
      char *fn;
      FILE *f;
      struct stat finfo;
***************
*** 419,430 ****
          if(stat(fn,&finfo) == -1)
              return 0;
          plaintext=1;
-         if(rule) rputs("<HR>\n", r);
-         rputs("<PRE>\n", r);
      }
-     else if (rule) rputs("<HR>\n", r);
      if(!(f = pfopen(r->pool,fn,"r")))
          return 0;
      if (!plaintext)
    send_fd(f, r);
      else
--- 429,442 ----
          if(stat(fn,&finfo) == -1)
              return 0;
          plaintext=1;
      }
      if(!(f = pfopen(r->pool,fn,"r")))
          return 0;
+     if(!rule && plaintext && title_name != NULL)
+   put_html_preamble(title_name, r);
+     if(rule) rputs("<HR>\n", r);
+     if(plaintext) rputs("<PRE>\n", r);
+ 
      if (!plaintext)
    send_fd(f, r);
      else
***************
*** 714,724 ****
      while (title_endp > title_name && *title_endp == '/')
    *title_endp-- = '\0';
      
!     rvputs(r, "<HEAD><TITLE>Index of ", title_name, "</TITLE></HEAD><BODY>\n",
!      NULL);
  
!     if((!(tmp = find_header(dir_conf,r))) || (!(insert_readme(name,tmp,0,r))))
          rvputs(r, "<H1>Index of ", title_name, "</H1>\n", NULL);
  
      /* 
       * Since we don't know how many dir. entries there are, put them into a 
--- 726,743 ----
      while (title_endp > title_name && *title_endp == '/')
    *title_endp-- = '\0';
      
!     if(!(dir_opts & SUPPRESS_HTML_PREAMBLE))
!   put_html_preamble(title_name, r);
  
!     if((!(tmp = find_header(dir_conf,r))) ||
!        (!(insert_readme(name, tmp, 0,
!           ((dir_opts & SUPPRESS_HTML_PREAMBLE) ?
!           title_name : NULL), r))))
!     {
!   if(dir_opts & SUPPRESS_HTML_PREAMBLE)
!       put_html_preamble(title_name, r);
          rvputs(r, "<H1>Index of ", title_name, "</H1>\n", NULL);
+     }
  
      /* 
       * Since we don't know how many dir. entries there are, put them into a 
***************
*** 751,757 ****
  
       if (dir_opts & FANCY_INDEXING)
           if((tmp = find_readme(dir_conf, r)))
!              insert_readme(name,tmp,1,r);
       else {
           rputs("</UL>", r);
       }
--- 770,776 ----
  
       if (dir_opts & FANCY_INDEXING)
           if((tmp = find_readme(dir_conf, r)))
!        insert_readme(name,tmp,1,NULL,r);
       else {
           rputs("</UL>", r);
       }