Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Add the --stopper option to the "ui" and "server" commands on windows. The argument is the name of a file, which if it exists, causes the server to abort upon receiving the next inbound TCP connection. Use this to shut down fossil servers running as a windows service. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
23c0d16718b1b0853fac8d5099bbd298 |
| User & Date: | drh 2010-01-18 22:23:48.000 |
Context
|
2010-01-19
| ||
| 14:15 | Show the edited user id in annotations. ... (check-in: e7efca9ee9 user: drh tags: trunk) | |
|
2010-01-18
| ||
| 22:23 | Add the --stopper option to the "ui" and "server" commands on windows. The argument is the name of a file, which if it exists, causes the server to abort upon receiving the next inbound TCP connection. Use this to shut down fossil servers running as a windows service. ... (check-in: 23c0d16718 user: drh tags: trunk) | |
| 21:46 | Remove some weird control character that somehow snuck into the [/doc/tip/www/theory1.wiki] document. ... (check-in: d8aa59fc17 user: drh tags: trunk) | |
Changes
Changes to src/main.c.
| ︙ | ︙ | |||
820 821 822 823 824 825 826 827 828 829 830 831 832 833 |
** the web server.
*/
void cmd_webserver(void){
int iPort, mxPort;
const char *zPort;
char *zBrowser;
char *zBrowserCmd = 0;
g.thTrace = find_option("th-trace", 0, 0)!=0;
if( g.thTrace ){
blob_zero(&g.thLog);
}
zPort = find_option("port", "P", 1);
if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
| > > > > > | 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 |
** the web server.
*/
void cmd_webserver(void){
int iPort, mxPort;
const char *zPort;
char *zBrowser;
char *zBrowserCmd = 0;
#ifdef __MINGW32__
const char *zStopperFile; /* Name of file used to terminate server */
zStopperFile = find_option("stopper", 0, 1);
#endif
g.thTrace = find_option("th-trace", 0, 0)!=0;
if( g.thTrace ){
blob_zero(&g.thLog);
}
zPort = find_option("port", "P", 1);
if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
|
| ︙ | ︙ | |||
883 884 885 886 887 888 889 |
#else
/* Win32 implementation */
if( g.argv[1][0]=='u' ){
zBrowser = db_get("web-browser", "start");
zBrowserCmd = mprintf("%s http://127.0.0.1:%%d/", zBrowser);
}
db_close();
| | | 888 889 890 891 892 893 894 895 896 897 |
#else
/* Win32 implementation */
if( g.argv[1][0]=='u' ){
zBrowser = db_get("web-browser", "start");
zBrowserCmd = mprintf("%s http://127.0.0.1:%%d/", zBrowser);
}
db_close();
win32_http_server(iPort, mxPort, zBrowserCmd, zStopperFile);
#endif
}
|
Changes to src/winhttp.c.
| ︙ | ︙ | |||
132 133 134 135 136 137 138 | free(p); } /* ** Start a listening socket and process incoming HTTP requests on ** that socket. */ | | > > > > > | 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
free(p);
}
/*
** Start a listening socket and process incoming HTTP requests on
** that socket.
*/
void win32_http_server(
int mnPort, int mxPort, /* Range of allowed TCP port numbers */
char *zBrowser, /* Command to launch browser. (Or NULL) */
char *zStopper /* Stop server when this file is exists (Or NULL) */
){
WSADATA wd;
SOCKET s = INVALID_SOCKET;
SOCKADDR_IN addr;
int idCnt = 0;
int iPort = mnPort;
if( zStopper ) unlink(zStopper);
if( WSAStartup(MAKEWORD(1,1), &wd) ){
fossil_fatal("unable to initialize winsock");
}
while( iPort<=mxPort ){
s = socket(AF_INET, SOCK_STREAM, 0);
if( s==INVALID_SOCKET ){
fossil_fatal("unable to create a socket");
|
| ︙ | ︙ | |||
185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
for(;;){
SOCKET client;
SOCKADDR_IN client_addr;
HttpRequest *p;
int len = sizeof(client_addr);
client = accept(s, (struct sockaddr*)&client_addr, &len);
if( client==INVALID_SOCKET ){
closesocket(s);
fossil_fatal("error from accept()");
}
p = malloc( sizeof(*p) );
if( p==0 ){
fossil_fatal("out of memory");
| > > > | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
for(;;){
SOCKET client;
SOCKADDR_IN client_addr;
HttpRequest *p;
int len = sizeof(client_addr);
client = accept(s, (struct sockaddr*)&client_addr, &len);
if( zStopper && file_size(zStopper)>=0 ){
break;
}
if( client==INVALID_SOCKET ){
closesocket(s);
fossil_fatal("error from accept()");
}
p = malloc( sizeof(*p) );
if( p==0 ){
fossil_fatal("out of memory");
|
| ︙ | ︙ |