Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | When serving static content that has extra elements on the end of the URI, return a 301 to redirect to the base document, so that relative hyperlinks in the document will be correct. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
1682f2225f525430f4b2b2b4d055e249 |
User & Date: | drh 2013-12-16 14:39:54.637 |
Context
2013-12-16
| ||
17:01 | Improvements to the althttpd logic that redirects to the base document when there are surplus pathname elements in the request URI. (check-in: 452b6e3c75 user: drh tags: trunk) | |
14:39 | When serving static content that has extra elements on the end of the URI, return a 301 to redirect to the base document, so that relative hyperlinks in the document will be correct. (check-in: 1682f2225f user: drh tags: trunk) | |
2013-12-14
| ||
14:42 | Update the change log with SQLITE_DETERMINISTIC. (check-in: 5bc4dbf151 user: drh tags: trunk) | |
Changes
Changes to misc/althttpd.c.
︙ | ︙ | |||
489 490 491 492 493 494 495 | nOut += printf("Location: %s://%s%s%s\r\n", zHttp, zServerName, zPath, zQuerySuffix); }else{ nOut += printf("Location: %s://%s:%s%s%s\r\n", zHttp, zServerName, zServerPort, zPath, zQuerySuffix); } if( finish ){ | | | 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 | nOut += printf("Location: %s://%s%s%s\r\n", zHttp, zServerName, zPath, zQuerySuffix); }else{ nOut += printf("Location: %s://%s:%s%s%s\r\n", zHttp, zServerName, zServerPort, zPath, zQuerySuffix); } if( finish ){ nOut += printf("Content-length: 0\r\n"); nOut += printf("\r\n"); MakeLogEntry(0); } fflush(stdout); } /* |
︙ | ︙ | |||
1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 | */ if( useTimeout ) alarm(60*5); while( (c = getc(in))!=EOF ){ putc(c,stdout); nOut++; } fclose(in); }else{ /* If it isn't executable then it ** must a simple file that needs to be copied to output. */ const char *zContentType = GetMimeType(zFile, lenFile); if( zTmpNam ) unlink(zTmpNam); | > > > > > > > > > > > > > > > > | 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 | */ if( useTimeout ) alarm(60*5); while( (c = getc(in))!=EOF ){ putc(c,stdout); nOut++; } fclose(in); }else if( zScript[lenFile-1]!=0 ){ /* The URI refers to a non-executable file so it is static content. But /* there are extra terms in the URI past the end of the content. We need ** to redirected to that relative URLs in the content will be right. */ StartResponse("301 Moved Permanently"); if( zServerPort==0 || zServerPort[0]==0 || strcmp(zServerPort,"80")==0 ){ nOut += printf("Location: %s://%s%s\r\n", zHttp, zServerName, zFile+1); }else{ nOut += printf("Location: %s://%s:%s%s\r\n", zHttp, zServerName, zServerPort, zFile+1); } nOut += printf("Content-length: 0\r\n"); nOut += printf("\r\n"); MakeLogEntry(0); fflush(stdout); }else{ /* If it isn't executable then it ** must a simple file that needs to be copied to output. */ const char *zContentType = GetMimeType(zFile, lenFile); if( zTmpNam ) unlink(zTmpNam); |
︙ | ︙ |