add ServerRoot
git-svn-id: file:///raid/svn-personal/tewi/trunk@61 8739d7e6-ffea-ec47-b151-bdff447c6205
This commit is contained in:
parent
b3622fefc5
commit
88f3bf7750
|
@ -232,6 +232,13 @@ int tw_config_read(const char* path) {
|
||||||
if(current->sslcert != NULL) free(current->sslcert);
|
if(current->sslcert != NULL) free(current->sslcert);
|
||||||
current->sslcert = cm_strdup(r[1]);
|
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")) {
|
} else if(cm_strcaseequ(r[0], "DocumentRoot")) {
|
||||||
if(r[1] == NULL) {
|
if(r[1] == NULL) {
|
||||||
cm_log("Config", "Missing path at line %d", ln);
|
cm_log("Config", "Missing path at line %d", ln);
|
||||||
|
|
|
@ -13,17 +13,25 @@ Section
|
||||||
CreateDirectory "$INSTDIR\etc"
|
CreateDirectory "$INSTDIR\etc"
|
||||||
CreateDirectory "$INSTDIR\www"
|
CreateDirectory "$INSTDIR\www"
|
||||||
CreateDirectory "$INSTDIR\www\icons"
|
CreateDirectory "$INSTDIR\www\icons"
|
||||||
|
CreateDirectory "$INSTDIR\modules"
|
||||||
CreateDirectory "$INSTDIR\bin"
|
CreateDirectory "$INSTDIR\bin"
|
||||||
|
SetOutPath "$INSTDIR"
|
||||||
|
File /oname=LICENSE.txt "../LICENSE"
|
||||||
SetOutPath "$INSTDIR\bin"
|
SetOutPath "$INSTDIR\bin"
|
||||||
File "tewi.exe"
|
File "tewi.exe"
|
||||||
|
SetOutPath "$INSTDIR\modules"
|
||||||
|
File "../Module/*.dll"
|
||||||
SetOutPath "$INSTDIR\etc"
|
SetOutPath "$INSTDIR\etc"
|
||||||
File /oname=tewi.conf.default "../example-win.conf"
|
SetOverWrite off
|
||||||
|
File /oname=tewi.conf "../example-win.conf"
|
||||||
SetOutPath "$INSTDIR\www"
|
SetOutPath "$INSTDIR\www"
|
||||||
File /oname=index.html "../itworks.html"
|
File /oname=index.html "../itworks.html"
|
||||||
SetOutPath "$INSTDIR\www\icons"
|
SetOutPath "$INSTDIR\www\icons"
|
||||||
File "../Icons/*.png"
|
File "../Icons/*.png"
|
||||||
|
SetOverWrite on
|
||||||
|
|
||||||
CreateDirectory "$SMPROGRAMS\Tewi HTTPd"
|
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.lnk" "$INSTDIR\bin\tewi.exe" ""
|
||||||
CreateShortcut "$SMPROGRAMS\Tewi HTTPd\Start Tewi HTTPd (verbose).lnk" "$INSTDIR\bin\tewi.exe" "-v"
|
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" ""
|
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"'
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tewi HTTPd" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
||||||
|
|
||||||
WriteUninstaller "$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
|
SectionEnd
|
||||||
|
|
||||||
Section "Uninstall"
|
Section "Uninstall"
|
||||||
|
|
|
@ -482,6 +482,7 @@ void tw_server_pass(int sock, bool ssl, int port, SOCKADDR addr) {
|
||||||
tw_http_error(s, sock, 403, name, port);
|
tw_http_error(s, sock, 403, name, port);
|
||||||
} else if(S_ISDIR(st.st_mode)) {
|
} else if(S_ISDIR(st.st_mode)) {
|
||||||
if(req.path[strlen(req.path) - 1] != '/') {
|
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};
|
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);
|
_tw_process_page(s, sock, tw_http_status(308), NULL, NULL, NULL, 0, headers, 0, 0);
|
||||||
free(headers[1]);
|
free(headers[1]);
|
||||||
|
|
|
@ -1,29 +1,31 @@
|
||||||
# $Id$
|
# $Id$
|
||||||
# This is an example config
|
# This is an example config
|
||||||
|
|
||||||
Listen 80
|
ServerRoot C:/Tewi
|
||||||
#ListenSSL 443
|
|
||||||
|
Listen 80
|
||||||
#SSLKey key.pem
|
#ListenSSL 443
|
||||||
#SSLCertificate cert.pem
|
|
||||||
|
#SSLKey key.pem
|
||||||
MIMEType all application/octet-stream
|
#SSLCertificate cert.pem
|
||||||
MIMEType .html text/html
|
|
||||||
MIMEType .txt text/plain
|
MIMEType all application/octet-stream
|
||||||
MIMEType .png image/png
|
MIMEType .html text/html
|
||||||
|
MIMEType .txt text/plain
|
||||||
Icon all /icons/unknown.png
|
MIMEType .png image/png
|
||||||
Icon text/* /icons/text.png
|
|
||||||
Icon image/* /icons/image.png
|
Icon all /icons/unknown.png
|
||||||
Icon misc/dir /icons/folder.png
|
Icon text/* /icons/text.png
|
||||||
Icon misc/parent /icons/parent.png
|
Icon image/* /icons/image.png
|
||||||
|
Icon misc/dir /icons/folder.png
|
||||||
DirectoryIndex index.html
|
Icon misc/parent /icons/parent.png
|
||||||
|
|
||||||
Readme README
|
DirectoryIndex index.html
|
||||||
|
|
||||||
DocumentRoot C:/Tewi/www
|
Readme README
|
||||||
|
|
||||||
BeginDirectory C:/Tewi/www
|
DocumentRoot C:/Tewi/www
|
||||||
Allow all
|
|
||||||
EndDirectory
|
BeginDirectory C:/Tewi/www
|
||||||
|
Allow all
|
||||||
|
EndDirectory
|
||||||
|
|
Loading…
Reference in New Issue
Block a user