Help with autoindex on; missing slash for directories

I’m working on upgrading some servers running nginx-0.6.34 to either
nginx-0.8.4 or nginx-0.7.61. The problem is I have another tool that
was crawling the nginx directory and following all the directories it
found. With the latest version of nginx the the directories aren’t
given a slash so doing the automated crawl fails.

The older nginx-0.6.34 output the following: ( Added pre tag to
prevent auto formatting from happening.)



Index of /static/

Index of /static/


../
site/  30-Jun-2009 21:49                   -

The newer nginx-0.8.4 and nginx-0.7.61 out puts the following:



Index of /static/

Index of /static/


../
site  30-Jun-2009 21:49                   -

Notice the missing slash after the word site. I was relying on having
the slash so I could navigate down directories with my crawler.

Any one have a solution to add the slash back?

Thanks!

-Yazz Atlas

Hello!

On Tue, Jun 30, 2009 at 11:09:11PM -0700, Yazz Atlas wrote:

I’m working on upgrading some servers running nginx-0.6.34 to either
nginx-0.8.4 or nginx-0.7.61. The problem is I have another tool that
was crawling the nginx directory and following all the directories it
found. With the latest version of nginx the the directories aren’t
given a slash so doing the automated crawl fails.

[…]

Notice the missing slash after the word site. I was relying on having
the slash so I could navigate down directories with my crawler.

Any one have a solution to add the slash back?

Which OS? Which filesystem?

And could you please:

  1. Test if this regression appeared in 0.7.40.

  2. Show ./configure output on your system.

Maxim D.

Hi,

I dont know if i am in the right forum to understand something related
to the Linux patch.

Currently we are auditing the latest patch applied on our company’s
Linux servers and was trying to figure out what does the date mentioned
below signifies (patch release date / patch applied date)?

2.6.18-128.1.10.el5 #1 SMP Wed Apr 29 13:53:08 EDT 2009

Can any of you help me in making me understand cos i am a beginner and
doing this for the very first time.

You help will certainly help me complete my work.

Thanks in advance

Posted at Nginx Forum:

Hello!

On Tue, Oct 13, 2009 at 11:21:57PM +0400, Igor S. wrote:

On Thu, Jul 16, 2009 at 04:25:16PM -0700, Yazz D. Atlas wrote:
2009/07/16 16:16:10 [debug] 20579#0: *2 http autoindex file: “.svn”, type 4
the only directories here are ‘.svn’, ‘.’ and ‘…’. It’s symlinks


Igor S.
Igor Sysoev

Index: src/http/modules/ngx_http_random_index_module.c

— src/http/modules/ngx_http_random_index_module.c (revision 2519)
+++ src/http/modules/ngx_http_random_index_module.c (working copy)
@@ -175,7 +175,7 @@

     len = ngx_de_namelen(&dir);
  •    if (!dir.valid_type) {
    
  •    if (dir.type == 0) {
    

Oh, I somehow missed random index module.

But please note that it’s currently broken for symlinks and this
patch doesn’t fix it - links to files won’t pass this check, and
will be ignored by ngx_de_is_file() test later.

Otherwise looks good and fixes autoindex issue as originally
reported.

Maxim D.

p.s. Just a quick note: I’ve added autoindex and random index
tests to test suite, with currently broken tests marked as TODO.

On Wed, Oct 14, 2009 at 04:44:19AM +0400, Maxim D. wrote:

On Fri, Jul 17, 2009 at 07:01:00AM +0400, Maxim D. wrote:

I just ran “GET http://localhost:88/static
2009/07/16 16:16:10 [debug] 20579#0: *2 http autoindex file: “video”, type 10
Attached patch fixes the problem. It also fixes typo (DT_LINK

+++ src/http/modules/ngx_http_random_index_module.c (working copy)
@@ -175,7 +175,7 @@

     len = ngx_de_namelen(&dir);
  •    if (!dir.valid_type) {
    
  •    if (dir.type == 0) {
    

Oh, I somehow missed random index module.

dirent.d_type had been actually introduced for random index.

But please note that it’s currently broken for symlinks and this
patch doesn’t fix it - links to files won’t pass this check, and
will be ignored by ngx_de_is_file() test later.

Yes, random index ignores symlinks.

Otherwise looks good and fixes autoindex issue as originally
reported.

Maxim D.

p.s. Just a quick note: I’ve added autoindex and random index
tests to test suite, with currently broken tests marked as TODO.

Now autoindex.t does not report error for 0.8.19. Is it correct ?

On Tue, Jul 21, 2009 at 10:08:06PM +0400, Maxim D. wrote:

Maxim,
2009/07/16 16:16:10 [debug] 20579#0: *2 http autoindex file: “site”, type 10

implicitly checking for 0) - on all systems I’ve seen it’s 0, but
AFAIK it’s not guaranteed.

This patch was shamelessly tested with The CSRG Archives CD-ROM 1
as shipped by Marshall Kirk McKusick. :slight_smile:

Another patch version.

Hello!

On Wed, Oct 14, 2009 at 03:28:20PM +0400, Igor S. wrote:

On Fri, Jul 17, 2009 at 03:14:35PM +0400, Igor S. wrote:

is the patch and the log file.
2009/07/16 16:16:10 [debug] 20579#0: *2 http autoindex file: “.”, type 4
I’ve reproduced this bug on FreeBSD too. Will look how to resolve this.
This patch was shamelessly tested with The CSRG Archives CD-ROM 1
===================================================================

dirent.d_type had been actually introduced for random index.

But please note that it’s currently broken for symlinks and this
patch doesn’t fix it - links to files won’t pass this check, and
will be ignored by ngx_de_is_file() test later.

Yes, random index ignores symlinks.

It behaves inconsistently on systems with and without
dirent.d_type…

Otherwise looks good and fixes autoindex issue as originally
reported.

Maxim D.

p.s. Just a quick note: I’ve added autoindex and random index
tests to test suite, with currently broken tests marked as TODO.

Now autoindex.t does not report error for 0.8.19. Is it correct ?

As it’s marked as TODO, prove won’t complain loudly but instead
notify you by something like “TODO passed: 4” once it will pass.

Try “prove -v autoindex.t” to see more details.

Maxim D.

Hello!

On Wed, Oct 14, 2009 at 04:41:03PM +0400, Igor S. wrote:

On Tue, Oct 13, 2009 at 11:21:57PM +0400, Igor S. wrote:

cd9660 on FreeBSD).

     len = ngx_de_namelen(&dir);

will be ignored by ngx_de_is_file() test later.

  •    if (dir.type == 0) {
    
  •    if (dir.type == 0 || ngx_de_is_link(&dir)) {
    

Ok, this way it looks right and fairy consistent. Thanks.

Maxim D.

On Wed, Oct 14, 2009 at 04:22:47PM +0400, Maxim D. wrote:

On Tue, Jul 21, 2009 at 10:08:06PM +0400, Maxim D. wrote:

2009/07/16 16:16:10 [debug] 20579#0: *2 http autoindex file: “questionnaires”, type 10
to directories that has no slash now.
Also I’ve changed DT_UNKNOWN check to explicit one (instead of
Igor S.

  •    if (!dir.valid_type) {
    

Yes, random index ignores symlinks.

It behaves inconsistently on systems with and without
dirent.d_type…

OK, I have changed:

     len = ngx_de_namelen(&dir);
  •    if (dir.type == 0) {
    
  •    if (dir.type == 0 || ngx_de_is_link(&dir)) {
    
           /* 1 byte for '/' and 1 byte for terminating '\0' */