<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>The way I achieved this at NTS Radio was to edit the xslt views for the website part.</div><div><br></div><div>Although, if a feature such as this were to land, I think it'd make sense to have it as an exposed-url option, rather than a exposed-port option.<br><br><div>– Micheil</div></div><div><br>On 22 Mar 2015, at 03:10, Damien Garrido <<a href="mailto:damien.garrido.work@gmail.com">damien.garrido.work@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><span style="font-size:12.8000001907349px">Hello,</span><div><br style="font-size:12.8000001907349px"><div dir="ltr" style="font-size:12.8000001907349px"><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:13px">I didn't want to have to choose between Icecast running on port 80 and all my Apache virtual hosts, running also on port 80, on my sole external IP address.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:13px">I didn't want either to open port 8000 on my firewall because I wanted all users being able to reach Icecast even the ones behind enterprise firewalls.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:13px">So I managed to run Apache 2.2 listening on port 80 and Icecast 2.3.2 listening on port 8000 on the same host.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:13px">I added a new virtual host <a href="http://radio.domain.com/" target="_blank">radio.domain.com</a> (listening on port 80) which is routing the Icecast traffic to/from the local Icecast server (listening on port 8000):</p><pre style="white-space:pre-wrap;margin-top:0px;padding:5px;border:0px;font-size:13px;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;word-wrap:normal;background-color:rgb(238,238,238)"><code style="margin:0px;padding:0px;border:0px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;white-space:inherit"><VirtualHost *:80>
ServerName <a href="http://radio.domain.com/" target="_blank">radio.domain.com</a>
ServerAdmin <a href="mailto:hostmaster@domain.com" target="_blank">hostmaster@domain.com</a>
ProxyPreserveHost On
ProxyPass / <a href="http://localhost:8000/" target="_blank">http://localhost:8000/</a>
ProxyPassReverse / <a href="http://localhost:8000/" target="_blank">http://localhost:8000/</a>
</VirtualHost>
</code></pre><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:13px">I was then able to connect audio clients like VLC/Winamp to Icecast mount points using addresses like <code style="margin:0px;padding:1px 5px;border:0px;font-size:13px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;white-space:pre-wrap;background-color:rgb(238,238,238)"><a href="http://radio.domain.com/my_stream" target="_blank">http://radio.domain.com/my_stream</a></code>.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:13px">However, when connecting to the Icecast virtual host <code style="margin:0px;padding:1px 5px;border:0px;font-size:13px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;white-space:pre-wrap;background-color:rgb(238,238,238)"><a href="http://radio.domain.com/" target="_blank">http://radio.domain.com/</a></code> web page, the m3u and the xspf files where still exposing the URL <code style="margin:0px;padding:1px 5px;border:0px;font-size:13px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;white-space:pre-wrap;background-color:rgb(238,238,238)"><a href="http://radio.domain.com:8000/my_stream" target="_blank">http://radio.domain.com:8000/my_stream</a></code> with that annoying port 8000. Then people downloading those files weren't able to connect to the Icecast server because they were trying to connect on the wrong port. The same was occuring with the YP updates on<a href="http://dir.xiph.org/" target="_blank">dir.xiph.org</a>.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:13px">I then downloaded the Icecast 2.3.2 source code, and modified it to add a new option:</p><pre style="white-space:pre-wrap;margin-top:0px;padding:5px;border:0px;font-size:13px;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;word-wrap:normal;background-color:rgb(238,238,238)"><code style="margin:0px;padding:0px;border:0px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;white-space:inherit"><exposed-port>80</exposed-port></code></pre><div><span style="font-size:15px;line-height:13px;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif">If this option is present in the Icecast configuration file, then m3u/xspf files as well as YP updates will use that port number.</span><br></div><div><span style="font-size:15px;line-height:13px;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif"><br></span></div><div><p style="margin:0px 0px 1em;padding:0px;border:0px;clear:both"><span style="font-size:15px;line-height:13px;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif">The below patch is for Icecast version 2.3.2:</span><br></p><p style="border:0px;font-family:'Lucida Sans Unicode','Lucida Grande',sans-serif;line-height:18px;margin:0px 0px 18px;padding:0px;vertical-align:baseline;color:rgb(114,114,114);font-size:12px"><code style="border:0px;font-weight:inherit;font-style:inherit;font-family:Monaco,Consolas,'Andale Mono','DejaVu Sans Mono',monospace;margin:0px;padding:0px;vertical-align:baseline">diff --git a/src/cfgfile.c b/src/cfgfile.c<br>index 5eac93d..42d917f 100644<br>--- a/src/cfgfile.c<br>+++ b/src/cfgfile.c<br>@@ -436,6 +436,10 @@ static void _parse_root(xmlDocPtr doc, xmlNodePtr node,<br>configuration->mimetypes_fn = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);<br>} else if (xmlStrcmp (node->name, XMLSTR("listen-socket")) == 0) {<br>_parse_listen_socket(doc, node->xmlChildrenNode, configuration);<br>+ } else if (xmlStrcmp (node->name, XMLSTR("exposed-port")) == 0) {<br>+ tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);<br>+ configuration->exposed_port = atoi(tmp);<br>+ if (tmp) xmlFree(tmp);<br>} else if (xmlStrcmp (node->name, XMLSTR("port")) == 0) {<br>tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);<br>configuration->port = atoi(tmp);<br>@@ -801,6 +805,12 @@ static void _parse_listen_socket(xmlDocPtr doc, xmlNodePtr node,<br>listener->port = atoi(tmp);<br>if(tmp) xmlFree(tmp);<br>}<br>+ else if (xmlStrcmp (node->name, XMLSTR("exposed-port")) == 0) {<br>+ tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);<br>+ if(configuration->exposed_port == 0)<br>+ configuration->exposed_port = atoi(tmp);<br>+ if(tmp) xmlFree(tmp);<br>+ }<br>else if (xmlStrcmp (node->name, XMLSTR("ssl")) == 0) {<br>tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);<br>listener->ssl = atoi(tmp);<br>diff --git a/src/cfgfile.h b/src/cfgfile.h<br>index fa5aa69..44a5bea 100644<br>--- a/src/cfgfile.h<br>+++ b/src/cfgfile.h<br>@@ -138,6 +138,7 @@ typedef struct ice_config_tag</code></p><code style="border:0px;font-family:Monaco,Consolas,'Andale Mono','DejaVu Sans Mono',monospace;line-height:18px;margin:0px;padding:0px;vertical-align:baseline;color:rgb(114,114,114);font-size:12px"><p style="border:0px;font-weight:inherit;font-style:inherit;font-family:inherit;margin:0px 0px 18px;padding:0px;vertical-align:baseline">char *hostname;<br>int port;<br>+ int exposed_port;<br>char *mimetypes_fn;</p><p style="border:0px;font-weight:inherit;font-style:inherit;font-family:inherit;margin:0px 0px 18px;padding:0px;vertical-align:baseline">listener_t *listen_sock;<br>diff --git a/src/fserve.c b/src/fserve.c<br>index 724aaaf..3f50472 100644<br>--- a/src/fserve.c<br>+++ b/src/fserve.c<br>@@ -443,7 +443,7 @@ int fserve_client_create (client_t *httpclient, const char *path)<br>"HTTP/1.0 200 OK\r\n"<br>"Content-Type: audio/x-mpegurl\r\n\r\n"<br>"<a href="http://%s:%d%s\r\n">http://%s:%d%s\r\n</a>",<br>- config->hostname, config->port,<br>+ config->hostname, ( config->exposed_port ? config->exposed_port : config->port ),<br>sourceuri<br>);<br>config_release_config();<br>diff --git a/src/icecast b/src/icecast<br>new file mode 100755<br>index 0000000..7e4f612<br>Binary files /dev/null and b/src/icecast differ<br>diff --git a/src/source.c b/src/source.c<br>index 02bfc74..b838799 100644<br>--- a/src/source.c<br>+++ b/src/source.c<br>@@ -579,7 +579,7 @@ static void source_init (source_t *source)<br>listenurl = malloc (listen_url_size);<br>memset (listenurl, '00', listen_url_size);<br>snprintf (listenurl, listen_url_size, "<a href="http://%s:%d%s">http://%s:%d%s</a>",<br>- config->hostname, config->port, source->mount);<br>+ config->hostname, ( config->exposed_port ? config->exposed_port : config->port ), source->mount);<br>config_release_config();</p><p style="border:0px;font-weight:inherit;font-style:inherit;font-family:inherit;margin:0px 0px 18px;padding:0px;vertical-align:baseline">str = httpp_getvar(source->parser, "ice-audio-info");<br>diff --git a/src/yp.c b/src/yp.c<br>index 4470d47..e3acb5f 100644<br>--- a/src/yp.c<br>+++ b/src/yp.c<br>@@ -584,12 +584,12 @@ static ypdata_t *create_yp_entry (const char *mount)<br>if (url == NULL)<br>break;<br>config = config_get_config();<br>- ret = snprintf (url, len, "<a href="http://%s:%d%s">http://%s:%d%s</a>", config->hostname, config->port, mount);<br>+ ret = snprintf (url, len, "<a href="http://%s:%d%s">http://%s:%d%s</a>", config->hostname, ( config->exposed_port ? config->exposed_port : config->port ), mount);<br>if (ret >= (signed)len)<br>{<br>s = realloc (url, ++ret);<br>if (s) url = s;<br>- snprintf (url, ret, "<a href="http://%s:%d%s">http://%s:%d%s</a>", config->hostname, config->port, mount);<br>+ snprintf (url, ret, "<a href="http://%s:%d%s">http://%s:%d%s</a>", config->hostname, ( config->exposed_port ? config->exposed_port : config->port ), mount);<br>}</p></code><p style="border:0px;font-family:'Lucida Sans Unicode','Lucida Grande',sans-serif;line-height:18px;margin:0px 0px 18px;padding:0px;vertical-align:baseline;color:rgb(114,114,114);font-size:12px"><code style="border:0px;font-weight:inherit;font-style:inherit;font-family:Monaco,Consolas,'Andale Mono','DejaVu Sans Mono',monospace;margin:0px;padding:0px;vertical-align:baseline">mountproxy = config_find_mount (config, mount);</code></p></div></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Damien Garrido<br></div><div>Dev (C/C++/PHP/Perl/Python)</div><div>Ops (on Debian/Ubuntu)</div></div></div>
</div></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Icecast-dev mailing list</span><br><span><a href="mailto:Icecast-dev@xiph.org">Icecast-dev@xiph.org</a></span><br><span><a href="http://lists.xiph.org/mailman/listinfo/icecast-dev">http://lists.xiph.org/mailman/listinfo/icecast-dev</a></span><br></div></blockquote></body></html>