]> Git repositories of Nishi - tewi.git/commitdiff
add ServerRoot
authorNishi <nishi@nishi.boats>
Wed, 18 Sep 2024 12:45:02 +0000 (12:45 +0000)
committerNishi <nishi@nishi.boats>
Wed, 18 Sep 2024 12:45:02 +0000 (12:45 +0000)
git-svn-id: file:///raid/svn-personal/tewi/trunk@61 8739d7e6-ffea-ec47-b151-bdff447c6205

Server/config.c
Server/install.nsi
Server/server.c
example-win.conf

index 18957f04c9bd527027f6e12ae5e4937ecc617d49..a61ded1b0754dfe8e3d368723e87cac851dd3f0f 100644 (file)
@@ -232,6 +232,13 @@ int tw_config_read(const char* path) {
                                                        if(current->sslcert != NULL) free(current->sslcert);
                                                        current->sslcert = cm_strdup(r[1]);
                                                }
+                                       } else if(cm_strcaseequ(r[0], "ServerRoot")) {
+                                               if(r[1] == NULL) {
+                                                       cm_log("Config", "Missing path at line %d", ln);
+                                                       stop = 1;
+                                               } else {
+                                                       chdir(r[1]);
+                                               }
                                        } else if(cm_strcaseequ(r[0], "DocumentRoot")) {
                                                if(r[1] == NULL) {
                                                        cm_log("Config", "Missing path at line %d", ln);
index b0a60cff93463474c9111434781d330b1a3beafd..ec67f26cfdec23ed249783667c1e8cc5fb122836 100644 (file)
@@ -13,17 +13,25 @@ Section
        CreateDirectory "$INSTDIR\etc"
        CreateDirectory "$INSTDIR\www"
        CreateDirectory "$INSTDIR\www\icons"
+       CreateDirectory "$INSTDIR\modules"
        CreateDirectory "$INSTDIR\bin"
+       SetOutPath "$INSTDIR"
+       File /oname=LICENSE.txt "../LICENSE"
        SetOutPath "$INSTDIR\bin"
        File "tewi.exe"
+       SetOutPath "$INSTDIR\modules"
+       File "../Module/*.dll"
        SetOutPath "$INSTDIR\etc"
-       File /oname=tewi.conf.default "../example-win.conf"
+       SetOverWrite off
+       File /oname=tewi.conf "../example-win.conf"
        SetOutPath "$INSTDIR\www"
        File /oname=index.html "../itworks.html"
        SetOutPath "$INSTDIR\www\icons"
        File "../Icons/*.png"
+       SetOverWrite on
 
        CreateDirectory "$SMPROGRAMS\Tewi HTTPd"
+       CreateShortcut "$SMPROGRAMS\Tewi HTTPd\License.lnk" "$INSTDIR\LICENSE.txt" ""
        CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Start Tewi HTTPd.lnk" "$INSTDIR\bin\tewi.exe" ""
        CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Start Tewi HTTPd (verbose).lnk" "$INSTDIR\bin\tewi.exe" "-v"
        CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Uninstall Tewi HTTPd.lnk" "$INSTDIR\uninstall.exe" ""
@@ -32,8 +40,6 @@ Section
        WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "UninstallString" '"$INSTDIR\uninstall.exe"'
 
        WriteUninstaller "$INSTDIR\uninstall.exe"
-
-       MessageBox MB_ICONEXCLAMATION|MB_OK "Example config is installed as $INSTDIR\etc\tewi.conf.default,$\r$\nBut Tewi HTTPd will try to use $INSTDIR\etc\tewi.conf."
 SectionEnd
 
 Section "Uninstall"
index 7fa31c4dc0e8770124b0acd5f5b85b5fb735f15a..330ad678eccaa6cb1c0e196baff5a0665bee4cf9 100644 (file)
@@ -482,6 +482,7 @@ void tw_server_pass(int sock, bool ssl, int port, SOCKADDR addr) {
                                        tw_http_error(s, sock, 403, name, port);
                                } else if(S_ISDIR(st.st_mode)) {
                                        if(req.path[strlen(req.path) - 1] != '/') {
+                                               cm_log("Server", "Accessing directory without the slash at the end");
                                                char* headers[3] = {"Location", cm_strcat(req.path, "/"), NULL};
                                                _tw_process_page(s, sock, tw_http_status(308), NULL, NULL, NULL, 0, headers, 0, 0);
                                                free(headers[1]);
index a92b5d0b4e4cbe91c24b60f7eda0611680fcbb49..490402a3623ff385142382943d9199e8fc28ac18 100644 (file)
@@ -1,29 +1,31 @@
-# $Id$
-# This is an example config
-
-Listen 80
-#ListenSSL 443
-
-#SSLKey key.pem
-#SSLCertificate cert.pem
-
-MIMEType all application/octet-stream
-MIMEType .html text/html
-MIMEType .txt text/plain
-MIMEType .png image/png
-
-Icon all /icons/unknown.png
-Icon text/* /icons/text.png
-Icon image/* /icons/image.png
-Icon misc/dir /icons/folder.png
-Icon misc/parent /icons/parent.png
-
-DirectoryIndex index.html
-
-Readme README
-
-DocumentRoot C:/Tewi/www
-
-BeginDirectory C:/Tewi/www
-       Allow all
-EndDirectory
+# $Id$\r
+# This is an example config\r
+\r
+ServerRoot C:/Tewi\r
+\r
+Listen 80\r
+#ListenSSL 443\r
+\r
+#SSLKey key.pem\r
+#SSLCertificate cert.pem\r
+\r
+MIMEType all application/octet-stream\r
+MIMEType .html text/html\r
+MIMEType .txt text/plain\r
+MIMEType .png image/png\r
+\r
+Icon all /icons/unknown.png\r
+Icon text/* /icons/text.png\r
+Icon image/* /icons/image.png\r
+Icon misc/dir /icons/folder.png\r
+Icon misc/parent /icons/parent.png\r
+\r
+DirectoryIndex index.html\r
+\r
+Readme README\r
+\r
+DocumentRoot C:/Tewi/www\r
+\r
+BeginDirectory C:/Tewi/www\r
+       Allow all\r
+EndDirectory\r