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
Xiph.Org
Icecast-Server
Commits
f9c3fc91
Commit
f9c3fc91
authored
Oct 17, 2007
by
Karl Heyes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updates to range header handling. closes
#1246
,
#810
svn path=/icecast/trunk/icecast/; revision=14006
parent
55b5b7eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
src/fserve.c
src/fserve.c
+8
-1
No files found.
src/fserve.c
View file @
f9c3fc91
...
...
@@ -33,6 +33,7 @@
#include <winsock2.h>
#include <windows.h>
#define snprintf _snprintf
#define strncasecmp _strnicmp
#define S_ISREG(mode) ((mode) & _S_IFREG)
#endif
...
...
@@ -501,8 +502,12 @@ int fserve_client_create (client_t *httpclient, const char *path)
content_length
=
(
int64_t
)
file_buf
.
st_size
;
range
=
httpp_getvar
(
httpclient
->
parser
,
"range"
);
/* full http range handling is currently not done but we deal with the common case */
if
(
range
!=
NULL
)
{
ret
=
sscanf
(
range
,
"bytes="
FORMAT_INT64
"-"
,
&
rangenumber
);
ret
=
0
;
if
(
strncasecmp
(
range
,
"bytes="
,
6
)
==
0
)
ret
=
sscanf
(
range
+
6
,
FORMAT_INT64
"-"
,
&
rangenumber
);
if
(
ret
!=
1
)
{
/* format not correct, so lets just assume
we start from the beginning */
...
...
@@ -542,6 +547,7 @@ int fserve_client_create (client_t *httpclient, const char *path)
bytes
=
snprintf
(
httpclient
->
refbuf
->
data
,
BUFSIZE
,
"HTTP/1.1 206 Partial Content
\r\n
"
"Date: %s
\r\n
"
"Accept-Ranges: bytes
\r\n
"
"Content-Length: "
FORMAT_INT64
"
\r\n
"
"Content-Range: bytes "
FORMAT_INT64
\
"-"
FORMAT_INT64
"/"
FORMAT_INT64
"
\r\n
"
...
...
@@ -567,6 +573,7 @@ int fserve_client_create (client_t *httpclient, const char *path)
httpclient
->
respcode
=
200
;
bytes
=
snprintf
(
httpclient
->
refbuf
->
data
,
BUFSIZE
,
"HTTP/1.0 200 OK
\r\n
"
"Accept-Ranges: bytes
\r\n
"
"Content-Length: "
FORMAT_INT64
"
\r\n
"
"Content-Type: %s
\r\n\r\n
"
,
content_length
,
...
...
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