Documentation Source Text

Check-in [e4391f7f58]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:In althttpd, if the requested file is not found, look for the "not-found.html" file in the same directory and use it instead.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e4391f7f58028b5c3dc778dd73e90c9395f03b42
User & Date: drh 2012-06-19 14:08:50
Context
2012-06-19
15:00
Althttpd changes: Make Redirect() much faster by avoiding timeouts. When a document it not found, search the either path for a not-found.html file to display and redirect to that file. check-in: 8ad926dff3 user: drh tags: trunk
14:08
In althttpd, if the requested file is not found, look for the "not-found.html" file in the same directory and use it instead. check-in: e4391f7f58 user: drh tags: trunk
2012-06-17
23:53
Fix an issue with the chroot jail. At the ability to 404 certain Referer values. check-in: cf0aea0254 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to misc/althttpd.c.

1147
1148
1149
1150
1151
1152
1153







1154
1155
1156
1157
1158
1159
1160
  while( zScript[i] ){
    while( zScript[i] && zScript[i]!='/' ){
      zLine[i+1] = zScript[i];
      i++;
    }
    zLine[i+1] = 0;
    if( stat(zLine,&statbuf)!=0 ){







      NotFound(__LINE__);
    }
    if( S_ISREG(statbuf.st_mode) ){
      if( access(zLine,R_OK) ){
        NotFound(__LINE__);
      }
      zRealScript = StrDup(&zLine[1]);







>
>
>
>
>
>
>







1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
  while( zScript[i] ){
    while( zScript[i] && zScript[i]!='/' ){
      zLine[i+1] = zScript[i];
      i++;
    }
    zLine[i+1] = 0;
    if( stat(zLine,&statbuf)!=0 ){
      while( i>0 && zLine[i]!='/' ){ i--; }
      strcpy(&zLine[i], "/not-found.html");
      if( stat(zLine,&statbuf)==0 && S_ISREG(statbuf.st_mode)
          && access(zLine,R_OK)==0 ){
        zRealScript = StrDup(&zLine[1]);
        break;
      }
      NotFound(__LINE__);
    }
    if( S_ISREG(statbuf.st_mode) ){
      if( access(zLine,R_OK) ){
        NotFound(__LINE__);
      }
      zRealScript = StrDup(&zLine[1]);