Althttpd

Check-in [d5fe16ad7e]
Login

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

Overview
Comment:There is no need to redirect from "http://domain" over to "http://domain/" if there is no path and the only missing part of the URL is the initial /. See forum post 2eae5437cde4b3d7
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d5fe16ad7ef858d7eb96d55642b0069629c3a7af9da583bf09662cd5f54f9931
User & Date: drh 2024-02-21 14:53:16
References
2024-02-21
14:54 Reply: 301 Redirects For URLs not Ending in / ... (artifact: 44a53295cd user: drh)
Context
2024-02-22
03:25
Update docs about -auth file, as per report in /forumpost/3c2f54a9f4. ... (check-in: 4d3ea9a0f7 user: stephan tags: trunk)
2024-02-21
14:53
There is no need to redirect from "http://domain" over to "http://domain/" if there is no path and the only missing part of the URL is the initial /. See forum post 2eae5437cde4b3d7 ... (check-in: d5fe16ad7e user: drh tags: trunk)
2024-02-17
03:22
Replace two stray calls to exit() with althttpd_exit() and remove one unreachable exit(). This hopefully resolves [forum post a86facf2ad|/forumpost/a86facf2ad]. ... (check-in: d4daf4a433 user: stephan tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to althttpd.c.

3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435



3436
3437
3438
3439
3440
3441
3442
        if( access(zLine,R_OK) ) continue;
        break;
      }
      if( jj>=sizeof(azIndex)/sizeof(azIndex[0]) ){
        NotFound(400); /* LOG: URI is a directory w/o index.html */
      }
      zRealScript = StrDup(&zLine[j0]);
      if( zScript[i]==0 ){
        /* If the requested URL does not end with "/" but we had to
        ** append "index.html", then a redirect is necessary.  Otherwise
        ** none of the relative URLs in the delivered document will be
        ** correct. */



        Redirect(zRealScript,301,1,410); /* LOG: redirect to add trailing / */
        return;
      }
      break;
    }
    zLine[j] = zScript[i];
    i++; j++;







|



|
>
>
>







3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
        if( access(zLine,R_OK) ) continue;
        break;
      }
      if( jj>=sizeof(azIndex)/sizeof(azIndex[0]) ){
        NotFound(400); /* LOG: URI is a directory w/o index.html */
      }
      zRealScript = StrDup(&zLine[j0]);
      if( zScript[i]==0 && strcmp(zScript,"/")!=0 ){
        /* If the requested URL does not end with "/" but we had to
        ** append "index.html", then a redirect is necessary.  Otherwise
        ** none of the relative URLs in the delivered document will be
        ** correct.  Except, we don't need to redirect if the URL
        ** consists of just a domain name and nothing else, for
        ** example "http://sqlite.org" without a trailing / does not
        ** need to redirect. */
        Redirect(zRealScript,301,1,410); /* LOG: redirect to add trailing / */
        return;
      }
      break;
    }
    zLine[j] = zScript[i];
    i++; j++;