From gumblex at aosc.io Mon Jan 7 07:17:32 2019 From: gumblex at aosc.io (Dingyuan Wang) Date: Mon, 7 Jan 2019 15:17:32 +0800 Subject: [Icecast-dev] icecast2 HEAD method support Message-ID: <5cacef1b-0215-26f5-be35-3c6c3318bf6a@aosc.io> Hello, Currently sending a HEAD request to an icecast2 server returns a 400. Are there plans to implement HEAD support, in order to simplify server status monitoring for example? From phschafft at de.loewenfelsen.net Mon Jan 7 09:19:59 2019 From: phschafft at de.loewenfelsen.net (Philipp Schafft) Date: Mon, 07 Jan 2019 09:19:59 +0000 Subject: [Icecast-dev] icecast2 HEAD method support In-Reply-To: <5cacef1b-0215-26f5-be35-3c6c3318bf6a@aosc.io> References: <5cacef1b-0215-26f5-be35-3c6c3318bf6a@aosc.io> Message-ID: <1546852799.13817.56.camel@de.loewenfelsen.net> Good morning, On Mon, 2019-01-07 at 15:17 +0800, Dingyuan Wang wrote: > Hello, > > Currently sending a HEAD request to an icecast2 server returns a 400. Yes. This is correct for both 2.4.x and 2.5.x. > Are there plans to implement HEAD support, in order to simplify server > status monitoring for example? There is some discussion on it. Both on IRC as well as on the ticket system. See e.g. here: https://gitlab.xiph.org/xiph/icecast-server/issues/2223 Beside that HEAD would be nice for status checking HEAD has two big disadvantages in reality: * People often argue that it would be less stress for the server to answer a HEAD request on a sourced mountpoint than a GET request. This is not exactly true. What causes most stress to the server is attaching the client to the source. This is needed in both cases. * Because of the stateless nature of HTTP the response to a HEAD request can become invalid even before it reached the client. So the use of HEAD is very limited. Cache validation and server monitoring are the only use cases I know of. The problem however is that people often try to use it to find out about the resource itself. E.g. it has been seen in the wild that people try to use it to find out about the resource's size or content-type to detect which part of their software should do the GET request. This is invalid as per HTTP specs as well as totally broken with anything but perfectly static files. The correct solution for this is that software MUST NOT depend on HEAD request (or the also often seen double-GET pattern). While HEAD would be nice for checking the status of a stream it could get people into a sphere of implementing broken clients. This is why it has not yet been done. There is discussion on if it might be useful to implement HEAD without any source related data. Which would allow status checking but nothing else. There is also discussion on other alternatives: * OPTIONS requests (maybe even OPTIONS requests to the *-resource) (both implemented in current master/2.5.x), * GET request with zero size byte range (someone want to test this with me and document the results?), * Using the old or new admin interface to query for the status of a resource, * Using the STATS interface to get *live* updates on the server's status, * Using events/URL auth to run code in case of a status change. What is the best solution depends on your specific use case. I tried to answer as general as "HEAD request support". I hope my answer will help you. Feel free to join us on IRC[0] or ask again here on the list about your specific problem so we can find a specific solution that works best for you. With best regards, [0] #icecast on freenode, see https://icecast.org/contact/#contact-info -- Philipp Schafft (CEO/Geschäftsführer) Telephon: +49.3535 490 17 92 Löwenfelsen UG (haftungsbeschränkt) Registration number: Bickinger Straße 21 HRB 12308 CB 04916 Herzberg (Elster) VATIN/USt-ID: Germany DE305133015 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 490 bytes Desc: This is a digitally signed message part URL: From gumblex at aosc.io Mon Jan 7 12:13:35 2019 From: gumblex at aosc.io (Dingyuan Wang) Date: Mon, 7 Jan 2019 20:13:35 +0800 Subject: [Icecast-dev] icecast2 HEAD method support In-Reply-To: <1546852799.13817.56.camel@de.loewenfelsen.net> References: <5cacef1b-0215-26f5-be35-3c6c3318bf6a@aosc.io> <1546852799.13817.56.camel@de.loewenfelsen.net> Message-ID: <34a52f9b-e7fe-8249-26e4-edf7db864408@aosc.io> I need to monitor individual stream availability, and parsing XMLs is too much complex. Currently I use: curl -s --max-time 1 -w '%{http_code}' -o /dev/null http://somehost/stream.mp3 | grep -q 200 2019/1/7 17:19, Philipp Schafft: > Good morning, > > On Mon, 2019-01-07 at 15:17 +0800, Dingyuan Wang wrote: >> Hello, >> >> Currently sending a HEAD request to an icecast2 server returns a 400. > > Yes. This is correct for both 2.4.x and 2.5.x. > > >> Are there plans to implement HEAD support, in order to simplify server >> status monitoring for example? > > There is some discussion on it. Both on IRC as well as on the ticket > system. See e.g. here: > https://gitlab.xiph.org/xiph/icecast-server/issues/2223 > > > Beside that HEAD would be nice for status checking HEAD has two big > disadvantages in reality: > * People often argue that it would be less stress for the server > to answer a HEAD request on a sourced mountpoint than a GET > request. This is not exactly true. What causes most stress to > the server is attaching the client to the source. This is needed > in both cases. > * Because of the stateless nature of HTTP the response to a HEAD > request can become invalid even before it reached the client. So > the use of HEAD is very limited. Cache validation and server > monitoring are the only use cases I know of. The problem however > is that people often try to use it to find out about the > resource itself. E.g. it has been seen in the wild that people > try to use it to find out about the resource's size or > content-type to detect which part of their software should do > the GET request. This is invalid as per HTTP specs as well as > totally broken with anything but perfectly static files. The > correct solution for this is that software MUST NOT depend on > HEAD request (or the also often seen double-GET pattern). > > While HEAD would be nice for checking the status of a stream it could > get people into a sphere of implementing broken clients. This is why it > has not yet been done. There is discussion on if it might be useful to > implement HEAD without any source related data. Which would allow status > checking but nothing else. There is also discussion on other > alternatives: > * OPTIONS requests (maybe even OPTIONS requests to the *-resource) > (both implemented in current master/2.5.x), > * GET request with zero size byte range (someone want to test this > with me and document the results?), > * Using the old or new admin interface to query for the status of > a resource, > * Using the STATS interface to get *live* updates on the server's > status, > * Using events/URL auth to run code in case of a status change. > > What is the best solution depends on your specific use case. I tried to > answer as general as "HEAD request support". > > I hope my answer will help you. Feel free to join us on IRC[0] or ask > again here on the list about your specific problem so we can find a > specific solution that works best for you. > > > With best regards, > > [0] #icecast on freenode, see https://icecast.org/contact/#contact-info > From thomas at ruecker.fi Mon Jan 7 12:42:18 2019 From: thomas at ruecker.fi (=?UTF-8?Q?Thomas_B=2e_R=c3=bccker?=) Date: Mon, 7 Jan 2019 12:42:18 +0000 Subject: [Icecast-dev] icecast2 HEAD method support In-Reply-To: <34a52f9b-e7fe-8249-26e4-edf7db864408@aosc.io> References: <5cacef1b-0215-26f5-be35-3c6c3318bf6a@aosc.io> <1546852799.13817.56.camel@de.loewenfelsen.net> <34a52f9b-e7fe-8249-26e4-edf7db864408@aosc.io> Message-ID: Hi, On 1/7/19 12:13 PM, Dingyuan Wang wrote: > I need to monitor individual stream availability, and parsing XMLs is > too much complex. > > Currently I use: > > curl -s --max-time 1 -w '%{http_code}' -o /dev/null > http://somehost/stream.mp3 | grep -q 200 I won't comment on the quality of the above, but how about something like this: curl -s "http://stream.example.org:80/status-json.xsl?mount=/source1.ogg" | jq .icestats.source It's very simple and 'jq' is an extremely powerful yet simple tool. In the above example it will either return the mount information specific JSON *or* 'null' - depending on if the mount is currently running or not. > > 2019/1/7 17:19, Philipp Schafft: >> Good morning, >> >> On Mon, 2019-01-07 at 15:17 +0800, Dingyuan Wang wrote: >>> Hello, >>> >>> Currently sending a HEAD request to an icecast2 server returns a 400. >> >> Yes. This is correct for both 2.4.x and 2.5.x. >> >> >>> Are there plans to implement HEAD support, in order to simplify server >>> status monitoring for example? >> >> There is some discussion on it. Both on IRC as well as on the ticket >> system. See e.g. here: >> https://gitlab.xiph.org/xiph/icecast-server/issues/2223 >> >> >> Beside that HEAD would be nice for status checking HEAD has two big >> disadvantages in reality: >>        * People often argue that it would be less stress for the server >>          to answer a HEAD request on a sourced mountpoint than a GET >>          request. This is not exactly true. What causes most stress to >>          the server is attaching the client to the source. This is >> needed >>          in both cases. >>        * Because of the stateless nature of HTTP the response to a HEAD >>          request can become invalid even before it reached the >> client. So >>          the use of HEAD is very limited. Cache validation and server >>          monitoring are the only use cases I know of. The problem >> however >>          is that people often try to use it to find out about the >>          resource itself. E.g. it has been seen in the wild that people >>          try to use it to find out about the resource's size or >>          content-type to detect which part of their software should do >>          the GET request. This is invalid as per HTTP specs as well as >>          totally broken with anything but perfectly static files. The >>          correct solution for this is that software MUST NOT depend on >>          HEAD request (or the also often seen double-GET pattern). >> >> While HEAD would be nice for checking the status of a stream it could >> get people into a sphere of implementing broken clients. This is why it >> has not yet been done. There is discussion on if it might be useful to >> implement HEAD without any source related data. Which would allow status >> checking but nothing else. There is also discussion on other >> alternatives: >>        * OPTIONS requests (maybe even OPTIONS requests to the >> *-resource) >>          (both implemented in current master/2.5.x), >>        * GET request with zero size byte range (someone want to test >> this >>          with me and document the results?), >>        * Using the old or new admin interface to query for the status of >>          a resource, >>        * Using the STATS interface to get *live* updates on the server's >>          status, >>        * Using events/URL auth to run code in case of a status change. >> >> What is the best solution depends on your specific use case. I tried to >> answer as general as "HEAD request support". >> >> I hope my answer will help you. Feel free to join us on IRC[0] or ask >> again here on the list about your specific problem so we can find a >> specific solution that works best for you. >> >> >> With best regards, >> >> [0] #icecast on freenode, see https://icecast.org/contact/#contact-info >> > Cheers, Thomas