Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
Icecast-Server
Commits
b2b618c6
Commit
b2b618c6
authored
Mar 08, 2003
by
Michael Smith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for shoutcast login protocol (ewww...)
svn path=/trunk/httpp/; revision=4444
parent
f65d8859
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
10 deletions
+78
-10
News
News
+3
-0
src/connection.c
src/connection.c
+33
-8
src/httpp/httpp.c
src/httpp/httpp.c
+40
-2
src/httpp/httpp.h
src/httpp/httpp.h
+2
-0
No files found.
News
View file @
b2b618c6
2003-03-09
Support for shoutcast source protocol added.
2003-03-08
Started implementing generic admin interface. Supports (so far):
- dynamic configuration of mount fallbacks
...
...
src/connection.c
View file @
b2b618c6
...
...
@@ -424,6 +424,20 @@ static int _check_pass_http(http_parser_t *parser,
return
1
;
}
static
int
_check_pass_icy
(
http_parser_t
*
parser
,
char
*
correctpass
)
{
char
*
password
;
password
=
httpp_getvar
(
parser
,
HTTPP_VAR_ICYPASSWORD
);
if
(
!
password
)
return
0
;
if
(
strcmp
(
password
,
correctpass
))
return
0
;
else
return
1
;
}
static
int
_check_pass_ice
(
http_parser_t
*
parser
,
char
*
correctpass
)
{
char
*
password
;
...
...
@@ -469,6 +483,7 @@ int connection_check_source_pass(http_parser_t *parser, char *mount)
char
*
user
=
"source"
;
int
ret
;
int
ice_login
=
config
->
ice_login
;
char
*
protocol
;
mount_proxy
*
mountinfo
=
config
->
mounts
;
thread_mutex_lock
(
&
(
config_locks
()
->
mounts_lock
));
...
...
@@ -492,14 +507,19 @@ int connection_check_source_pass(http_parser_t *parser, char *mount)
return
0
;
}
ret
=
_check_pass_http
(
parser
,
user
,
pass
);
if
(
!
ret
&&
ice_login
)
{
ret
=
_check_pass_ice
(
parser
,
pass
);
if
(
ret
)
WARN0
(
"Source is using deprecated icecast login"
);
protocol
=
httpp_getvar
(
parser
,
"HTTP_VAR_PROTOCOL"
);
if
(
protocol
!=
NULL
&&
!
strcmp
(
protocol
,
"ICY"
))
{
ret
=
_check_pass_icy
(
parser
,
pass
);
}
else
{
ret
=
_check_pass_http
(
parser
,
user
,
pass
);
if
(
!
ret
&&
ice_login
)
{
ret
=
_check_pass_ice
(
parser
,
pass
);
if
(
ret
)
WARN0
(
"Source is using deprecated icecast login"
);
}
}
return
ret
;
}
...
...
@@ -849,7 +869,12 @@ static void *_handle_connection(void *arg)
}
free
(
uri
);
}
else
{
}
else
if
(
httpp_parse_icy
(
parser
,
header
,
strlen
(
header
)))
{
/* TODO: Map incoming icy connections to /icy_0, etc. */
_handle_source_request
(
con
,
parser
,
"/"
);
}
else
{
ERROR0
(
"HTTP request parsing failed"
);
connection_close
(
con
);
httpp_destroy
(
parser
);
...
...
src/httpp/httpp.c
View file @
b2b618c6
...
...
@@ -270,6 +270,42 @@ static void parse_query(http_parser_t *parser, char *query)
}
}
/* The old shoutcast procotol. Don't look at this, it's really nasty */
int
httpp_parse_icy
(
http_parser_t
*
parser
,
char
*
http_data
,
unsigned
long
len
)
{
char
*
data
;
char
*
line
[
MAX_HEADERS
];
int
lines
;
if
(
http_data
==
NULL
)
return
0
;
data
=
malloc
(
len
+
1
);
memcpy
(
data
,
http_data
,
len
);
data
[
len
]
=
0
;
lines
=
split_headers
(
data
,
len
,
line
);
/* Now, this protocol looks like:
* sourcepassword\n
* headers: as normal\n"
* \n
*/
parser
->
req_type
=
httpp_req_source
;
httpp_setvar
(
parser
,
HTTPP_VAR_URI
,
"/"
);
httpp_setvar
(
parser
,
HTTPP_VAR_ICYPASSWORD
,
line
[
0
]);
httpp_setvar
(
parser
,
HTTPP_VAR_PROTOCOL
,
"ICY"
);
/* This protocol is evil */
httpp_setvar
(
parser
,
HTTPP_VAR_VERSION
,
"666"
);
parse_headers
(
parser
,
line
,
lines
);
free
(
data
);
return
1
;
}
int
httpp_parse
(
http_parser_t
*
parser
,
char
*
http_data
,
unsigned
long
len
)
{
char
*
data
,
*
tmp
;
...
...
@@ -348,8 +384,10 @@ int httpp_parse(http_parser_t *parser, char *http_data, unsigned long len)
}
parser
->
uri
=
strdup
(
uri
);
}
else
parser
->
uri
=
NULL
;
}
else
{
free
(
data
);
return
0
;
}
if
((
version
!=
NULL
)
&&
((
tmp
=
strchr
(
version
,
'/'
))
!=
NULL
))
{
tmp
[
0
]
=
'\0'
;
...
...
src/httpp/httpp.h
View file @
b2b618c6
...
...
@@ -14,6 +14,7 @@
#define HTTPP_VAR_REQ_TYPE "__req_type"
#define HTTPP_VAR_ERROR_MESSAGE "__errormessage"
#define HTTPP_VAR_ERROR_CODE "__errorcode"
#define HTTPP_VAR_ICYPASSWORD "__icy_password"
typedef
enum
httpp_request_type_tag
{
httpp_req_none
,
httpp_req_get
,
httpp_req_post
,
httpp_req_head
,
...
...
@@ -40,6 +41,7 @@ typedef struct http_parser_tag {
http_parser_t
*
httpp_create_parser
(
void
);
void
httpp_initialize
(
http_parser_t
*
parser
,
http_varlist_t
*
defaults
);
int
httpp_parse
(
http_parser_t
*
parser
,
char
*
http_data
,
unsigned
long
len
);
int
httpp_parse_icy
(
http_parser_t
*
parser
,
char
*
http_data
,
unsigned
long
len
);
int
httpp_parse_response
(
http_parser_t
*
parser
,
char
*
http_data
,
unsigned
long
len
,
char
*
uri
);
void
httpp_setvar
(
http_parser_t
*
parser
,
char
*
name
,
char
*
value
);
char
*
httpp_getvar
(
http_parser_t
*
parser
,
char
*
name
);
...
...
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