karlheyes / icecast-kh

KH branch of icecast
GNU General Public License v2.0
297 stars 105 forks source link

Server: header does not honour server-id #439

Closed dicksnippe closed 7 months ago

dicksnippe commented 7 months ago

In version 2.4.0-kh17 the handling of HTTP response headers was changed. This was done to allow for custom headers to be injected via the xml http-headers block. However, it appears that this broke the setting of the Server header. Before, icecast would respond with something like this: Server: Icecast 2.4.0-kh15 Since kh17, the server responds with this: Server: Icecast

Also, before kh17 it used to be possible to use something like this in the config file: <server-id>Foo</server-id which would result in the server responding with Server: Foo

Now setting a specific Server header can be done post kh17, using a http-headers block:

<http-headers>
  <header name="Server" value="Foo" />
</http-headers>

However, this does not allow for the automatic injection of the running version (e.g. 2.4.0-kh17) in the Server header. Attached is a very simpleminded patch against kh22 to include the running version in the Server header. However, this does not do anything in regard to <server-id>

Regards, Dick.

diff -Nurp icecast-tls-2.4.0-kh22.cs8_64.org/src/params.c icecast-tls-2.4.0-kh22.cs8_64/src/params.c
--- icecast-tls-2.4.0-kh22.cs8_64.org/src/params.c      2023-07-04 22:36:53.000000000 +0200
+++ icecast-tls-2.4.0-kh22.cs8_64/src/params.c  2023-11-16 16:28:05.460488899 +0100
@@ -507,7 +507,7 @@ refbuf_t *ice_params_complete (ice_param

 ice_config_http_header_t default_headers[] =
 {
-    { .hdr = { .status = "2*",          .name = "Server",               .value = "Icecast" } },
+    { .hdr = { .status = "2*",          .name = "Server",               .value = PACKAGE_STRING } },
     { .hdr = { .status = "[234]*",      .name = "Connection",           .value = "Close",
                                         .callback = _connection_hdr } },
     { .hdr = { .status = "2*",          .name = "Pragma",               .value = "no-cache" } },
karlheyes commented 7 months ago

thanks for the report, will issue a fix shortly. Needs a callback really.

karl