Skip to content

Commit

Permalink
Parse user:password in icy source when needed, set default user to ""…
Browse files Browse the repository at this point in the history
… in output.shoutcast.
  • Loading branch information
toots committed Jan 10, 2017
1 parent deaf607 commit 472b6a5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scripts/shoutcast.liq
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
def output.shoutcast(
~id="output.shoutcast",~start=true,
~host="localhost",~port=8000,
~user="source",~password="hackme",
~user="",~password="hackme",
~genre="Misc",~url="http://liquidsoap.fm",
~name="Liquidsoap Radio!",~public=true,
~icy_id=1, ~format="",~dj={""},
Expand Down
12 changes: 11 additions & 1 deletion src/harbor/harbor.camlp4
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,14 @@ struct
Websocket.to_string (`Close (Some (n, msg)))

let parse_icy_request_line ~port h r =
let auth_data =
Pcre.split ~pat:":" r
in
let requested_user,password =
match auth_data with
| user :: password :: _ -> user,password
| _ -> "", r
in
duppy s =
try
duppy_return (find_source "/" (port-1))
Expand All @@ -302,7 +310,9 @@ struct
(* Authentication can be blocking. *)
duppy_exec
let user,auth_f = s#login in
if auth_f user r then
let user = if requested_user = "" then
user else requested_user in
if auth_f user password then
duppy_return
(`Shout,"/",`Icy)
else
Expand Down

0 comments on commit 472b6a5

Please sign in to comment.