Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
spr0cketeer
Icecast-Server
Commits
5a8d0d16
Commit
5a8d0d16
authored
Nov 20, 2014
by
Philipp Schafft
🦁
Browse files
(sync with my branch) support vhosting on aliases
svn path=/icecast/trunk/icecast/; revision=19336
parent
1a3fd18c
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/cfgfile.c
View file @
5a8d0d16
...
@@ -300,6 +300,7 @@ void config_clear(ice_config_t *c)
...
@@ -300,6 +300,7 @@ void config_clear(ice_config_t *c)
xmlFree
(
alias
->
source
);
xmlFree
(
alias
->
source
);
xmlFree
(
alias
->
destination
);
xmlFree
(
alias
->
destination
);
xmlFree
(
alias
->
bind_address
);
xmlFree
(
alias
->
bind_address
);
xmlFree
(
alias
->
vhost
);
free
(
alias
);
free
(
alias
);
alias
=
nextalias
;
alias
=
nextalias
;
}
}
...
@@ -1199,6 +1200,7 @@ static void _parse_paths(xmlDocPtr doc, xmlNodePtr node,
...
@@ -1199,6 +1200,7 @@ static void _parse_paths(xmlDocPtr doc, xmlNodePtr node,
else
else
alias
->
port
=
-
1
;
alias
->
port
=
-
1
;
alias
->
bind_address
=
(
char
*
)
xmlGetProp
(
node
,
XMLSTR
(
"bind-address"
));
alias
->
bind_address
=
(
char
*
)
xmlGetProp
(
node
,
XMLSTR
(
"bind-address"
));
alias
->
vhost
=
(
char
*
)
xmlGetProp
(
node
,
XMLSTR
(
"vhost"
));
current
=
configuration
->
aliases
;
current
=
configuration
->
aliases
;
last
=
NULL
;
last
=
NULL
;
while
(
current
)
{
while
(
current
)
{
...
...
src/cfgfile.h
View file @
5a8d0d16
...
@@ -125,6 +125,7 @@ typedef struct _aliases {
...
@@ -125,6 +125,7 @@ typedef struct _aliases {
char
*
destination
;
char
*
destination
;
int
port
;
int
port
;
char
*
bind_address
;
char
*
bind_address
;
char
*
vhost
;
struct
_aliases
*
next
;
struct
_aliases
*
next
;
}
aliases
;
}
aliases
;
...
...
src/connection.c
View file @
5a8d0d16
...
@@ -1142,6 +1142,9 @@ static void _handle_get_request (client_t *client, char *passed_uri)
...
@@ -1142,6 +1142,9 @@ static void _handle_get_request (client_t *client, char *passed_uri)
ice_config_t
*
config
;
ice_config_t
*
config
;
char
*
uri
=
passed_uri
;
char
*
uri
=
passed_uri
;
listener_t
*
listen_sock
;
listener_t
*
listen_sock
;
const
char
*
http_host
=
httpp_getvar
(
client
->
parser
,
"host"
);
char
*
vhost
;
char
*
vhost_colon
;
config
=
config_get_config
();
config
=
config_get_config
();
...
@@ -1164,14 +1167,27 @@ static void _handle_get_request (client_t *client, char *passed_uri)
...
@@ -1164,14 +1167,27 @@ static void _handle_get_request (client_t *client, char *passed_uri)
/* TODO: add GUID-xxxxxx */
/* TODO: add GUID-xxxxxx */
/* Handle aliases */
/* Handle aliases */
while
(
alias
)
{
if
(
http_host
)
{
if
(
strcmp
(
uri
,
alias
->
source
)
==
0
&&
(
alias
->
port
==
-
1
||
alias
->
port
==
serverport
)
&&
(
alias
->
bind_address
==
NULL
||
(
serverhost
!=
NULL
&&
strcmp
(
alias
->
bind_address
,
serverhost
)
==
0
)))
{
vhost
=
strdup
(
http_host
);
if
(
vhost
)
{
vhost_colon
=
strstr
(
vhost
,
":"
);
if
(
vhost_colon
)
*
vhost_colon
=
0
;
}
}
while
(
alias
)
{
if
(
strcmp
(
uri
,
alias
->
source
)
==
0
&&
(
alias
->
port
==
-
1
||
alias
->
port
==
serverport
)
&&
(
alias
->
bind_address
==
NULL
||
(
serverhost
!=
NULL
&&
strcmp
(
alias
->
bind_address
,
serverhost
)
==
0
))
&&
(
alias
->
vhost
==
NULL
||
(
vhost
!=
NULL
&&
strcmp
(
alias
->
vhost
,
vhost
)
==
0
))
)
{
uri
=
strdup
(
alias
->
destination
);
uri
=
strdup
(
alias
->
destination
);
ICECAST_LOG_DEBUG
(
"alias has made %s into %s"
,
passed_uri
,
uri
);
ICECAST_LOG_DEBUG
(
"alias has made %s into %s"
,
passed_uri
,
uri
);
break
;
break
;
}
}
alias
=
alias
->
next
;
alias
=
alias
->
next
;
}
}
if
(
vhost
)
free
(
vhost
);
config_release_config
();
config_release_config
();
stats_event_inc
(
NULL
,
"client_connections"
);
stats_event_inc
(
NULL
,
"client_connections"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment