Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
spr0cketeer
Icecast-Server
Commits
a192f696
Commit
a192f696
authored
Oct 26, 2018
by
Philipp Schafft
🦁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: Corrected reported Allow:-header (mostly for 204-responses)
parent
0bdad13f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
3 deletions
+23
-3
src/client.c
src/client.c
+9
-1
src/util.c
src/util.c
+14
-2
No files found.
src/client.c
View file @
a192f696
...
...
@@ -43,6 +43,7 @@
#include "reportxml.h"
#include "refobject.h"
#include "xslt.h"
#include "source.h"
#include "client.h"
#include "auth.h"
...
...
@@ -385,6 +386,7 @@ void client_send_101(client_t *client, reuse_t reuse)
void
client_send_204
(
client_t
*
client
)
{
source_t
*
source
;
ssize_t
ret
;
if
(
!
client
)
...
...
@@ -392,10 +394,16 @@ void client_send_204(client_t *client)
client
->
reuse
=
ICECAST_REUSE_KEEPALIVE
;
/* We get a source_t* here as this is likely a reply to OPTIONS and we want
* to have as much infos as possible in that case.
*/
avl_tree_rlock
(
global
.
source_tree
);
source
=
source_find_mount_raw
(
client
->
uri
);
ret
=
util_http_build_header
(
client
->
refbuf
->
data
,
PER_CLIENT_REFBUF_SIZE
,
0
,
0
,
204
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
client
);
NULL
,
source
,
client
);
avl_tree_unlock
(
global
.
source_tree
);
snprintf
(
client
->
refbuf
->
data
+
ret
,
PER_CLIENT_REFBUF_SIZE
-
ret
,
"Content-Length: 0
\r\n\r\n
"
);
...
...
src/util.c
View file @
a192f696
...
...
@@ -680,6 +680,7 @@ ssize_t util_http_build_header(char * out, size_t len, ssize_t offset,
char
*
extra_headers
;
const
char
*
connection_header
=
"Close"
;
const
char
*
upgrade_header
=
""
;
const
char
*
allow_header
;
if
(
!
out
)
return
-
1
;
...
...
@@ -771,14 +772,25 @@ ssize_t util_http_build_header(char * out, size_t len, ssize_t offset,
else
currenttime_buffer
[
0
]
=
'\0'
;
if
(
client
)
{
if
(
client
->
admin_command
!=
ADMIN_COMMAND_ERROR
)
{
allow_header
=
"GET, POST, OPTIONS"
;
}
else
if
(
source
)
{
allow_header
=
"GET, DELETE, OPTIONS"
;
}
else
{
allow_header
=
"GET, PUT, OPTIONS, SOURCE"
;
}
}
else
{
allow_header
=
"GET, OPTIONS"
;
}
config
=
config_get_config
();
extra_headers
=
_build_headers
(
status
,
config
,
source
);
ret
=
snprintf
(
out
,
len
,
"%sServer: %s
\r\n
Connection: %s
\r\n
Accept-Encoding: identity
\r\n
Allow: %s
\r\n
%s%s%s%s%s%s%s%s"
,
status_buffer
,
config
->
server_id
,
connection_header
,
(
client
&&
client
->
admin_command
==
ADMIN_COMMAND_ERROR
?
"GET, SOURCE, OPTIONS"
:
"GET, OPTIONS"
),
allow_header
,
upgrade_header
,
currenttime_buffer
,
contenttype_buffer
,
...
...
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