Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Improvements to standalone mode in althttpd.c. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
a970d449c6c82ea34e5f2ea906ee018f |
User & Date: | drh 2013-07-16 22:15:57.754 |
Context
2013-07-17
| ||
00:17 | Tweaks to the text describing the hazards of upgrading to the NGQP. (check-in: 232b584bda user: drh tags: trunk) | |
2013-07-16
| ||
22:15 | Improvements to standalone mode in althttpd.c. (check-in: a970d449c6 user: drh tags: trunk) | |
2013-07-15
| ||
17:11 | The log file for althttpd is now RFC-4180 CSV. Cherry-pick merge from check-in [52bfa21f48e14a29]. (check-in: 93ba1a8d9d user: drh tags: trunk) | |
Changes
Changes to misc/althttpd.c.
︙ | ︙ | |||
140 141 142 143 144 145 146 147 148 149 150 151 152 153 | static time_t beginTime; /* Time when this process starts */ static int closeConnection = 0; /* True to send Connection: close in reply */ static int nRequest = 0; /* Number of requests processed */ static int omitLog = 0; /* Do not make logfile entries if true */ static int useHttps = 0; /* True to use HTTPS: instead of HTTP: */ static char *zHttp = "http"; /* http or https */ static int useTimeout = 1; /* True to use times */ static int ipv6Only = 0; /* Use IPv6 only */ static int ipv4Only = 0; /* Use IPv4 only */ /* ** Double any double-quote characters in a string. */ static char *Escape(char *z){ | > | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | static time_t beginTime; /* Time when this process starts */ static int closeConnection = 0; /* True to send Connection: close in reply */ static int nRequest = 0; /* Number of requests processed */ static int omitLog = 0; /* Do not make logfile entries if true */ static int useHttps = 0; /* True to use HTTPS: instead of HTTP: */ static char *zHttp = "http"; /* http or https */ static int useTimeout = 1; /* True to use times */ static int standalone = 0; /* Run as a standalone server (no inetd) */ static int ipv6Only = 0; /* Use IPv6 only */ static int ipv4Only = 0; /* Use IPv4 only */ /* ** Double any double-quote characters in a string. */ static char *Escape(char *z){ |
︙ | ︙ | |||
1147 1148 1149 1150 1151 1152 1153 | } } strcpy(&zLine[i], ".website"); } if( stat(zLine,&statbuf) || !S_ISDIR(statbuf.st_mode) ){ sprintf(zLine, "%s/default.website", zRoot); if( stat(zLine,&statbuf) || !S_ISDIR(statbuf.st_mode) ){ | > > > | | | | | 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 | } } strcpy(&zLine[i], ".website"); } if( stat(zLine,&statbuf) || !S_ISDIR(statbuf.st_mode) ){ sprintf(zLine, "%s/default.website", zRoot); if( stat(zLine,&statbuf) || !S_ISDIR(statbuf.st_mode) ){ if( standalone ){ sprintf(zLine, "%s\n", zRoot); }else{ NotFound(__LINE__); } } } zHome = StrDup(zLine); /* Change directories to the root of the HTTP filesystem */ if( chdir(zHome)!=0 ){ char zBuf[1000]; Malfunction(__LINE__, "cannot chdir to [%s] from [%s]", |
︙ | ︙ | |||
1604 1605 1606 1607 1608 1609 1610 | int nErr = 0, fd; close(0); fd = dup(connection); if( fd!=0 ) nErr++; close(1); fd = dup(connection); if( fd!=1 ) nErr++; | < < < | 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 | int nErr = 0, fd; close(0); fd = dup(connection); if( fd!=0 ) nErr++; close(1); fd = dup(connection); if( fd!=1 ) nErr++; close(connection); return nErr; } } } /* Bury dead children */ while( (child = waitpid(0, 0, WNOHANG))>0 ){ |
︙ | ︙ | |||
1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 | }else if( strcmp(z,"-logfile")==0 ){ zLogFile = zArg; }else if( strcmp(z,"-https")==0 ){ useHttps = atoi(zArg); zHttp = useHttps ? "http" : "https"; }else if( strcmp(z, "-port")==0 ){ zPort = zArg; }else if( strcmp(z, "-family")==0 ){ if( strcmp(zArg, "ipv4")==0 ){ ipv4Only = 1; }else if( strcmp(zArg, "ipv6")==0 ){ ipv6Only = 1; }else{ Malfunction(__LINE__, "unknown IP protocol: [%s]", zArg); | > | 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 | }else if( strcmp(z,"-logfile")==0 ){ zLogFile = zArg; }else if( strcmp(z,"-https")==0 ){ useHttps = atoi(zArg); zHttp = useHttps ? "http" : "https"; }else if( strcmp(z, "-port")==0 ){ zPort = zArg; standalone = 1; }else if( strcmp(z, "-family")==0 ){ if( strcmp(zArg, "ipv4")==0 ){ ipv4Only = 1; }else if( strcmp(zArg, "ipv6")==0 ){ ipv6Only = 1; }else{ Malfunction(__LINE__, "unknown IP protocol: [%s]", zArg); |
︙ | ︙ | |||
1675 1676 1677 1678 1679 1680 1681 | }else{ Malfunction(__LINE__, "unknown argument: [%s]", z); } argv += 2; argc -= 2; } if( zRoot==0 ){ | > > > | > | 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 | }else{ Malfunction(__LINE__, "unknown argument: [%s]", z); } argv += 2; argc -= 2; } if( zRoot==0 ){ if( standalone ){ zRoot = "."; }else{ Malfunction(__LINE__, "no --root specified"); } } /* Change directories to the root of the HTTP filesystem. Then ** create a chroot jail there. */ if( chdir(zRoot)!=0 ){ Malfunction(__LINE__, "cannot change to directory [%s]", zRoot); |
︙ | ︙ |