| | @@ -518,10 +518,11 @@ |
| 518 | 518 | const char *zBrowser, /* Command to launch browser. (Or NULL) */ |
| 519 | 519 | const char *zStopper, /* Stop server when this file is exists (Or NULL) */ |
| 520 | 520 | const char *zBaseUrl, /* The --baseurl option, or NULL */ |
| 521 | 521 | const char *zNotFound, /* The --notfound option, or NULL */ |
| 522 | 522 | const char *zFileGlob, /* The --fileglob option, or NULL */ |
| 523 | + const char *zExtRoot, /* The --extroot option, or NULL */ |
| 523 | 524 | const char *zIpAddr, /* Bind to this IP address, if not NULL */ |
| 524 | 525 | int flags /* One or more HTTP_SERVER_ flags */ |
| 525 | 526 | ){ |
| 526 | 527 | HANDLE hStoppedEvent; |
| 527 | 528 | WSADATA wd; |
| | @@ -547,10 +548,13 @@ |
| 547 | 548 | blob_appendf(&options, " --notfound %s", zNotFound); |
| 548 | 549 | } |
| 549 | 550 | if( zFileGlob ){ |
| 550 | 551 | blob_appendf(&options, " --files-urlenc %T", zFileGlob); |
| 551 | 552 | } |
| 553 | + if( zExtRoot ){ |
| 554 | + blob_appendf(&options, " --extroot %s", zExtRoot); |
| 555 | + } |
| 552 | 556 | if( g.useLocalauth ){ |
| 553 | 557 | blob_appendf(&options, " --localauth"); |
| 554 | 558 | } |
| 555 | 559 | if( g.thTrace ){ |
| 556 | 560 | blob_appendf(&options, " --th-trace"); |
| | @@ -695,20 +699,21 @@ |
| 695 | 699 | struct HttpService { |
| 696 | 700 | int port; /* Port on which the http server should run */ |
| 697 | 701 | const char *zBaseUrl; /* The --baseurl option, or NULL */ |
| 698 | 702 | const char *zNotFound; /* The --notfound option, or NULL */ |
| 699 | 703 | const char *zFileGlob; /* The --files option, or NULL */ |
| 704 | + const char *zExtRoot; /* The --extroot option, or NULL */ |
| 700 | 705 | int flags; /* One or more HTTP_SERVER_ flags */ |
| 701 | 706 | int isRunningAsService; /* Are we running as a service ? */ |
| 702 | 707 | const wchar_t *zServiceName;/* Name of the service */ |
| 703 | 708 | DualSocket s; /* Sockets on which the http server listens */ |
| 704 | 709 | }; |
| 705 | 710 | |
| 706 | 711 | /* |
| 707 | 712 | ** Variables used for running as windows service. |
| 708 | 713 | */ |
| 709 | | -static HttpService hsData = {8080, NULL, NULL, NULL, 0, 0, NULL, |
| 714 | +static HttpService hsData = {8080, NULL, NULL, NULL, NULL, 0, 0, NULL, |
| 710 | 715 | {INVALID_SOCKET, INVALID_SOCKET}}; |
| 711 | 716 | static SERVICE_STATUS ssStatus; |
| 712 | 717 | static SERVICE_STATUS_HANDLE sshStatusHandle; |
| 713 | 718 | |
| 714 | 719 | /* |
| | @@ -844,11 +849,11 @@ |
| 844 | 849 | win32_report_service_status(SERVICE_START_PENDING, NO_ERROR, 3000); |
| 845 | 850 | |
| 846 | 851 | /* Execute the http server */ |
| 847 | 852 | win32_http_server(hsData.port, hsData.port, |
| 848 | 853 | NULL, NULL, hsData.zBaseUrl, hsData.zNotFound, |
| 849 | | - hsData.zFileGlob, 0, hsData.flags); |
| 854 | + hsData.zFileGlob, hsData.zExtRoot, 0, hsData.flags); |
| 850 | 855 | |
| 851 | 856 | /* Service has stopped now. */ |
| 852 | 857 | win32_report_service_status(SERVICE_STOPPED, NO_ERROR, 0); |
| 853 | 858 | return; |
| 854 | 859 | } |
| | @@ -874,10 +879,11 @@ |
| 874 | 879 | int win32_http_service( |
| 875 | 880 | int nPort, /* TCP port number */ |
| 876 | 881 | const char *zBaseUrl, /* The --baseurl option, or NULL */ |
| 877 | 882 | const char *zNotFound, /* The --notfound option, or NULL */ |
| 878 | 883 | const char *zFileGlob, /* The --files option, or NULL */ |
| 884 | + const char *zExtRoot, /* The --extroot option, or NULL */ |
| 879 | 885 | int flags /* One or more HTTP_SERVER_ flags */ |
| 880 | 886 | ){ |
| 881 | 887 | /* Define the service table. */ |
| 882 | 888 | SERVICE_TABLE_ENTRYW ServiceTable[] = |
| 883 | 889 | {{L"", (LPSERVICE_MAIN_FUNCTIONW)win32_http_service_main}, {NULL, NULL}}; |
| | @@ -885,10 +891,11 @@ |
| 885 | 891 | /* Initialize the HttpService structure. */ |
| 886 | 892 | hsData.port = nPort; |
| 887 | 893 | hsData.zBaseUrl = zBaseUrl; |
| 888 | 894 | hsData.zNotFound = zNotFound; |
| 889 | 895 | hsData.zFileGlob = zFileGlob; |
| 896 | + hsData.zExtRoot = zExtRoot; |
| 890 | 897 | hsData.flags = flags; |
| 891 | 898 | |
| 892 | 899 | if( GetStdHandle(STD_INPUT_HANDLE)!=NULL ){ return 1; } |
| 893 | 900 | |
| 894 | 901 | /* Try to start the control dispatcher thread for the service. */ |
| 895 | 902 | |