Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
Icecast-Server
Commits
a466900a
Commit
a466900a
authored
Jun 18, 2018
by
Philipp Schafft
🦁
Browse files
Feature: Allow POST for admin requests
parent
44ebc3cf
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/admin.c
View file @
a466900a
...
...
@@ -52,7 +52,7 @@
/* Helper macros */
#define COMMAND_REQUIRE(client,name,var) \
do { \
(var) = httpp_get_
query_
param((client)->parser, (name)); \
(var) = httpp_get_param((client)->parser, (name)); \
if((var) == NULL) { \
client_send_error_by_id(client, ICECAST_ERROR_ADMIN_MISSING_PARAMETER); \
return; \
...
...
@@ -60,7 +60,7 @@
} while(0);
#define COMMAND_OPTIONAL(client,name,var) \
(var) = httpp_get_
query_
param((client)->parser, (name))
(var) = httpp_get_param((client)->parser, (name))
/* special commands */
#define COMMAND_ERROR ADMIN_COMMAND_ERROR
...
...
@@ -502,7 +502,7 @@ void admin_handle_request(client_t *client, const char *uri)
}
}
mount
=
httpp_get_query_param
(
client
->
parser
,
"mount"
);
COMMAND_OPTIONAL
(
client
,
"mount"
,
mount
);
/* Find mountpoint source */
if
(
mount
!=
NULL
)
{
...
...
@@ -543,6 +543,7 @@ void admin_handle_request(client_t *client, const char *uri)
switch
(
client
->
parser
->
req_type
)
{
case
httpp_req_get
:
case
httpp_req_post
:
handler
->
function
(
client
,
source
,
format
);
break
;
case
httpp_req_options
:
...
...
common
@
9bfb3a34
Compare
fca416b1
...
9bfb3a34
Subproject commit fc
a
41
6b126cb842034ac3468362c044895975b5
a
Subproject commit
9bfb3a34
fc41
cc8e0075328d7d6527bd84eb40b
a
src/connection.c
View file @
a466900a
...
...
@@ -82,6 +82,8 @@ typedef struct client_queue_tag {
int
stream_offset
;
int
shoutcast
;
char
*
shoutcast_mount
;
char
*
bodybuffer
;
size_t
bodybufferlen
;
int
tried_body
;
struct
client_queue_tag
*
next
;
}
client_queue_t
;
...
...
@@ -634,7 +636,28 @@ static void process_request_body_queue (void)
ICECAST_LOG_DEBUG
(
"Got client %p in body queue."
,
client
);
res
=
client_body_skip
(
client
);
if
(
client
->
parser
->
req_type
==
httpp_req_post
)
{
if
(
node
->
bodybuffer
==
NULL
&&
client
->
request_body_read
==
0
)
{
if
(
client
->
request_body_length
<
0
)
{
node
->
bodybufferlen
=
body_size_limit
;
node
->
bodybuffer
=
malloc
(
node
->
bodybufferlen
);
}
else
if
(
client
->
request_body_length
<=
(
ssize_t
)
body_size_limit
)
{
node
->
bodybufferlen
=
client
->
request_body_length
;
node
->
bodybuffer
=
malloc
(
node
->
bodybufferlen
);
}
}
}
if
(
node
->
bodybuffer
)
{
res
=
client_body_slurp
(
client
,
node
->
bodybuffer
,
&
(
node
->
bodybufferlen
));
if
(
res
==
CLIENT_SLURP_SUCCESS
)
{
httpp_parse_postdata
(
client
->
parser
,
node
->
bodybuffer
,
node
->
bodybufferlen
);
free
(
node
->
bodybuffer
);
node
->
bodybuffer
=
NULL
;
}
}
else
{
res
=
client_body_skip
(
client
);
}
if
(
res
!=
CLIENT_SLURP_NEEDS_MORE_DATA
||
client
->
con
->
con_time
<=
timeout
||
client
->
request_body_read
>=
body_size_limit
)
{
ICECAST_LOG_DEBUG
(
"Putting client %p back in connection queue."
,
client
);
...
...
@@ -1612,6 +1635,7 @@ static void _handle_connection(void)
if
(
node
->
shoutcast_mount
&&
strcmp
(
rawuri
,
"/admin.cgi"
)
==
0
)
httpp_set_query_param
(
client
->
parser
,
"mount"
,
node
->
shoutcast_mount
);
free
(
node
->
bodybuffer
);
free
(
node
->
shoutcast_mount
);
free
(
node
);
...
...
Write
Preview
Supports
Markdown
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