From 60f7388cb4fbbfda24adc1f7659b545e912fcc39 Mon Sep 17 00:00:00 2001 From: borisneubert <> Date: Sat, 6 Jun 2015 06:54:05 +0000 Subject: [PATCH] 02_HTTPSRV: require trailing slash in infix to foster integration of TabletUI git-svn-id: https://svn.fhem.de/fhem/trunk@8700 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 2 ++ fhem/FHEM/02_HTTPSRV.pm | 15 ++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 01f813de4..79efdb915 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,7 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - change: 02_HTTPSRV: require trailing slash in infix to foster + integration of TabletUI - feature: 59_Weather: polish translations (Lukasz) - changed: 57_CALVIEW.pm: code cleanup - bugfix: 30_pilight_*: restore (StateFn), trigger changes twice diff --git a/fhem/FHEM/02_HTTPSRV.pm b/fhem/FHEM/02_HTTPSRV.pm index eb44b3316..3a13ec07b 100644 --- a/fhem/FHEM/02_HTTPSRV.pm +++ b/fhem/FHEM/02_HTTPSRV.pm @@ -63,6 +63,9 @@ HTTPSRV_Define($$) { return "Usage: define HTTPSRV " if(int(@a) != 5); my $name= $a[0]; my $infix= $a[2]; + if($infix !~ m-/$-) { + $infix = "$infix/"; + } my $directory= $a[3]; my $friendlyname= $a[4]; @@ -114,7 +117,7 @@ sub HTTPSRV_CGI() { my ($request) = @_; # /$infix/filename - if($request =~ m,^(/[^/]+)(/(.*)?)?$,) { + if($request =~ m,^(/[^/]+/)((.*)?)?$,) { my $link= $1; my $filename= $3; my $name; @@ -180,7 +183,7 @@ sub HTTPSRV_CGI() {

HTTPSRV

    Provides a mini HTTP server plugin for FHEMWEB. It serves files from a given directory. - It optionally accepts a query string to set readings of this device if an attribute allows the given reading

    + It optionally accepts a query string to set readings of this device if an attribute allows the given reading.

    HTTPSRV is an extension to FHEMWEB. You must install FHEMWEB to use HTTPSRV.

    @@ -191,14 +194,16 @@ sub HTTPSRV_CGI() { Defines the HTTP server. <infix> is the portion behind the FHEMWEB base URL (usually http://hostname:8083/fhem), <directory> is the absolute path the - files are served from, and <friendlyname> is the name displayed in the side menu of FHEMWEB.

    + files are served from, and <friendlyname> is the name displayed in the side menu of + FHEMWEB. <infix> should contain a trailing slash, which is automatically added to + the definition if it is missing in the define statement.

    Example:

      - define myJSFrontend HTTPSRV jsf /usr/share/jsfrontend My little frontend
      + define myJSFrontend HTTPSRV jsf /usr/share/jsfrontend/ My little frontend
      or
      - define kindleweb HTTPSRV kindle /opt/fhem/kindle Kindle Web
      + define kindleweb HTTPSRV kindle /opt/fhem/kindle/ Kindle Web
      attr kindleweb readings KindleBatt