Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Improved redirect handling in althttpd.c |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
c4dcea55cdba427518875f1128ce2bb5 |
User & Date: | drh 2018-01-30 17:06:27.179 |
Context
2018-01-30
| ||
23:44 | Remove an unused variable from althttpd.c. (check-in: 94b9b95bee user: drh tags: trunk) | |
17:06 | Improved redirect handling in althttpd.c (check-in: c4dcea55cd user: drh tags: trunk) | |
2018-01-29
| ||
18:38 | Add documentation for the zipfile() aggregate function. (check-in: 1582bada14 user: dan tags: trunk) | |
Changes
Changes to misc/althttpd.c.
︙ | ︙ | |||
466 467 468 469 470 471 472 | /* ** Compare two ETag values. Return 0 if they match and non-zero if they differ. ** ** The one on the left might be a NULL pointer and it might be quoted. */ static int CompareEtags(const char *zA, const char *zB){ | < | 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | /* ** Compare two ETag values. Return 0 if they match and non-zero if they differ. ** ** The one on the left might be a NULL pointer and it might be quoted. */ static int CompareEtags(const char *zA, const char *zB){ if( zA==0 ) return 1; if( zA[0]=='"' ){ int lenB = (int)strlen(zB); if( strncmp(zA+1, zB, lenB)==0 && zA[lenB+1]=='"' ) return 0; } return strcmp(zA, zB); } |
︙ | ︙ | |||
1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 | /* Read and process the first line of the header returned by the ** CGI script. */ if( useTimeout ) alarm(15); while( fgets(zLine,sizeof(zLine),in) && !isspace(zLine[0]) ){ if( strncasecmp(zLine,"Location:",9)==0 ){ int i; RemoveNewline(zLine); z = &zLine[10]; while( isspace(*z) ){ z++; } | > < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < | 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 | /* Read and process the first line of the header returned by the ** CGI script. */ if( useTimeout ) alarm(15); while( fgets(zLine,sizeof(zLine),in) && !isspace(zLine[0]) ){ if( strncasecmp(zLine,"Location:",9)==0 ){ int i; StartResponse("302 Redirect"); RemoveNewline(zLine); z = &zLine[10]; while( isspace(*z) ){ z++; } nOut += printf("Location: %s\r\n",z); }else if( strncasecmp(zLine,"Status:",7)==0 ){ int i; for(i=7; isspace(zLine[i]); i++){} nOut += printf("%s %s", zProtocol, &zLine[i]); strncpy(zReplyStatus, &zLine[i], 3); zReplyStatus[3] = 0; statusSent = 1; |
︙ | ︙ | |||
1712 1713 1714 1715 1716 1717 1718 | ** actual content file name, report that as a 404 error. */ NotFound(__LINE__); /* LOG: Excess URI content past static file name */ }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); | < | 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 | ** actual content file name, report that as a 404 error. */ NotFound(__LINE__); /* LOG: Excess URI content past static file name */ }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); char zETag[100]; if( zTmpNam ) unlink(zTmpNam); sprintf(zETag, "m%xs%x", (int)statbuf.st_mtime, (int)statbuf.st_size); if( CompareEtags(zIfNoneMatch,zETag)==0 ){ StartResponse("304 Not Modified"); nOut += printf("Cache-Control: max-age=%d\r\n", mxAge); |
︙ | ︙ |