Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] Add autoindex_css_file option

Clément Bœsch
March 03, 2011 07:58PM
On Wed, Feb 23, 2011 at 10:20:23AM +0100, Clément Bœsch wrote:
> On Mon, Feb 21, 2011 at 02:00:04PM +0300, Maxim Dounin wrote:
> > Hello!
> >
> > On Mon, Feb 21, 2011 at 01:20:27AM +0100, Clément Bœsch wrote:
> >
> > > On Mon, Feb 21, 2011 at 03:08:18AM +0300, Maxim Dounin wrote:
> > > > Hello!
> > > >
> > > > On Sun, Feb 20, 2011 at 09:47:37PM +0100, Clément Bœsch wrote:
> > > >
> > > > [...]
> > > >
> > > > > static u_char title[] =
> > > > > -"<html>" CRLF
> > > > > +"<!DOCTYPE html>" CRLF
> > > > > "<head><title>Index of "
> > > > > ;
> > > >
> > > > The result isn't html at all.
> > > >
> > >
> > > Well it's HTML5…
> >
> > No it isn't. You dropped html element.
> >
>
> My bad, it didn't look mandatory for the w3c validator: "<!doctype
> html><head><title></title></head></html>" seems to be the minimum, but
> I'll definitely update the patch.
>
> > Please note that there is also other issues with you patches, you
> > may want spend some more time on them before posting again.
> >
>
> Could you be a bit more explicit? What are the issues?
>
> Regards,
>

It seems those patches don't get much attention, but I guess it's normal.
Anyway, I re-attached the third patch fixing the HTML issue. If you plan
to apply those patches and need me to fix something else, just ask me.

Regards,

--
Clément B.
From 974145d80b9cd295e51b9dfef67e9eafcfb4534c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= <ubitux@gmail.com>
Date: Sun, 20 Feb 2011 21:27:44 +0100
Subject: [PATCH 3/3] Use valid HTML.

---
src/http/modules/ngx_http_autoindex_module.c | 23 ++++++++++-------------
1 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/src/http/modules/ngx_http_autoindex_module.c b/src/http/modules/ngx_http_autoindex_module.c
index 8d43028..25c6861 100644
--- a/src/http/modules/ngx_http_autoindex_module.c
+++ b/src/http/modules/ngx_http_autoindex_module.c
@@ -122,22 +122,19 @@ ngx_module_t ngx_http_autoindex_module = {
NGX_MODULE_V1_PADDING
};

+#define HTML_HEAD "<!DOCTYPE html>" CRLF "<html>" CRLF "<head>"

-static u_char title[] =
-"<html>" CRLF
-"<head><title>Index of "
-;
+static u_char title[] = HTML_HEAD "<title>Index of ";

-static u_char title_pre_css[] =
-"<html>" CRLF
-"<head><link rel=\"stylesheet\" type=\"text/css\" href=\""
+static u_char title_pre_css[] = HTML_HEAD \
+"<link rel=\"stylesheet\" type=\"text/css\" href=\""
;

static u_char title_post_css[] = "\" /><title>Index of ";

static u_char header[] =
"</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<h1>Index of "
;

@@ -384,8 +381,8 @@ ngx_http_autoindex_handler(ngx_http_request_t *r)
+ sizeof(header) - 1
+ r->uri.len
+ sizeof("</h1>") - 1
- + sizeof("<hr><pre><a href=\"../\">../</a>" CRLF) - 1
- + sizeof("</pre><hr>") - 1
+ + sizeof("<hr/><pre><a href=\"../\">../</a>" CRLF) - 1
+ + sizeof("</pre><hr/>") - 1
+ sizeof(tail) - 1;

entry = entries.elts;
@@ -428,8 +425,8 @@ ngx_http_autoindex_handler(ngx_http_request_t *r)
b->last = ngx_cpymem(b->last, r->uri.data, r->uri.len);
b->last = ngx_cpymem(b->last, "</h1>", sizeof("</h1>") - 1);

- b->last = ngx_cpymem(b->last, "<hr><pre><a href=\"../\">../</a>" CRLF,
- sizeof("<hr><pre><a href=\"../\">../</a>" CRLF) - 1);
+ b->last = ngx_cpymem(b->last, "<hr/><pre><a href=\"../\">../</a>" CRLF,
+ sizeof("<hr/><pre><a href=\"../\">../</a>" CRLF) - 1);

tp = ngx_timeofday();

@@ -563,7 +560,7 @@ ngx_http_autoindex_handler(ngx_http_request_t *r)

/* TODO: free temporary pool */

- b->last = ngx_cpymem(b->last, "</pre><hr>", sizeof("</pre><hr>") - 1);
+ b->last = ngx_cpymem(b->last, "</pre><hr/>", sizeof("</pre><hr/>") - 1);

b->last = ngx_cpymem(b->last, tail, sizeof(tail) - 1);

--
1.7.4.1

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Add autoindex_css_file option

Clément Bœsch 2217 February 20, 2011 12:04PM

Re: [PATCH] Add autoindex_css_file option

Clément Bœsch 672 February 20, 2011 12:10PM

Re: [PATCH] Add autoindex_css_file option

Maxim Dounin 663 February 20, 2011 01:26PM

Re: [PATCH] Add autoindex_css_file option

Clément Bœsch 625 February 20, 2011 03:48PM

Re: [PATCH] Add autoindex_css_file option

Maxim Dounin 632 February 20, 2011 07:10PM

Re: [PATCH] Add autoindex_css_file option

Clément Bœsch 694 February 20, 2011 07:22PM

Re: [PATCH] Add autoindex_css_file option

Maxim Dounin 804 February 21, 2011 06:02AM

Re: [PATCH] Add autoindex_css_file option

Adrian Perez 664 February 21, 2011 07:40AM

Re: [PATCH] Add autoindex_css_file option

Clément Bœsch 658 February 23, 2011 04:22AM

Re: [PATCH] Add autoindex_css_file option

Clément Bœsch 822 March 03, 2011 07:58PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 70
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready