From 57d82a07d51f4034af4d464cd35053ae2fb22ccd Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Mon, 19 Jun 2006 05:02:16 +0000 Subject: [PATCH] 302 directory requests to the index page, closing ticket #157 --- src/configfile.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/configfile.c b/src/configfile.c index bb5145ee..9e41a30f 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -338,10 +338,15 @@ void config_handler(WS_CONNINFO *pwsc) { return; } - /* this should really return a 302:Found */ + /* this is quite broken, but will work */ stat(resolved_path,&sb); - if(sb.st_mode & S_IFDIR) - strcat(resolved_path,"/index.html"); + if(sb.st_mode & S_IFDIR) { + ws_addresponseheader(pwsc,"Location","/index.html"); + ws_returnerror(pwsc,302,"Moved"); + config_set_status(pwsc,0,NULL); + pwsc->close=1; + return; + } DPRINTF(E_DBG,L_CONF|L_WS,"Thread %d: Preparing to serve %s\n", pwsc->threadno, resolved_path);