Fix a double free that could happen when the cache was cleared
during config reload and then subsequent XSLT requests would try
to evict the same cache item, because the item name was not set to
NULL in clear_cache_entry.
Previously this was no problem as a cache entry would only be evicted
on load of a new XSLT and that one would immediately fill in the place
of the old one.
The XSLT loader caches the admin path from the config file and
invalidates it by comparing the stored path with the one in the config.
But to the stored path a / is appended, which means the cache would
always invalidate as it never matches.
The URL is constructed considering Protocol, TLS Mode, Host, and Port.
This considers:
- The Host:-header as provided by the client,
- The effective listensocket of the client,
- Global configuration.
This works for:
- Playlist generation,
- Admin authed playlist generation,
- Stats based XSLT.
It also unifies code:
- Default stats values.
Not yet included:
- YP requests.
This generates error pages based on IDs. This allows to reuse errors
and add more advanced information to them.
This patch also makes Icecast send in plain text OR HTML based
on the clients Accept:-string.
There was an error how URIs were handled in our custom XSL loader
that rewrites include URIs to point to admin dir if the include
is not found in the current dir.
The check for the file would not work if the path contains chars
that are usually escaped in URIs, like a space (%20), as we get
a already encoded version of that URI in the loader and did not
decode it before checking the existence of the file.
(Fix#2249)
This switches the behaviour introduced with the last commit
so that now the admin folder is only checked for includes if
in the specified path none is found.
This adds support for including xslt files that are in the admin
directory in an xslt file which is in the webroot, without having to
specify the full path.
For example:
<xsl:include href="includes/head.xsl"/>
will look inside the admin directory (foo/bar/admin/includes/header.xsl)
and include it, if it's found. If not it will as usual look for it in
the directory where the xslt file is located. This enables us to have
common files like the header, footer, json stuff, etc. in the admin
directory, so we don't need to have an extra copy in the web folder.
Note:
The configuration value for the admin directory is requested
every time an xslt is requested (if not in the cache).
Additonally it should be noted that the includes are not cached.
This adds to all responses:
* "Accept-Encoding: identity"
* "Connection: close"
* "Allow: GET, SOURCE" or "Allow: GET" (on admin pages)
This is to generate some infrastructure for Icecast to tell futur
source clients what is supported.
"Upgrade: TLS/1.0" should be added later when upgrade support is present.
See: #2152
This fixes some compiler warnings. The code should be warning free
if gcc with -Wall is used but for the following:
{{{
admin.c: In function 'command_manageauth':
admin.c:790: warning: unused variable 'mountinfo'
}}}
This warning is due <role> migration. See #2123 for more details on
this warning. Please test with care. closes 2063
Please test this very carefully.
Some pointers what should be in the tests (NOT complet list):
- request to 'static' web/ and admin/ pages.
- requests to playlist generation.
- requests to streams.
- requests to admin/ manipulation functions.
- test everything with at least 8kB of extra headers, then reduce in 1kB (or 512B) steps.
- see if response is correct OR 500 is returned.
- run under valgrind or similar to see no buffer overflow or similiar will happen.
- take a cookie!
svn path=/icecast/trunk/icecast/; revision=19300
This is currently not implemented for SOURCE and STATS clients as
I suspect to break them. This needs some more research.
close#1639, see #1870 and #1885.
svn path=/icecast/trunk/icecast/; revision=18464
was very easy for the intermediate files to clash between projects. The newer
libxml2/libxslt/libcurl also were causing some threading issues due to
library initialization
svn path=/icecast/trunk/icecast/; revision=14465