Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Steve Lhomme
VLC
Commits
99f3e549
Commit
99f3e549
authored
Nov 07, 2002
by
gbazin
Browse files
* modules/access/http.c: don't crash, but complain on non http/1.x streams.
parent
85071f34
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/access/http.c
View file @
99f3e549
...
...
@@ -2,7 +2,7 @@
* http.c: HTTP access plug-in
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: http.c,v 1.
5
2002/1
0
/07
21:58:40 massiot
Exp $
* $Id: http.c,v 1.
6
2002/1
1
/07
16:54:39 gbazin
Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
...
...
@@ -96,7 +96,7 @@ static int HTTPConnect( input_thread_t * p_input, off_t i_tell )
module_t
*
p_network
;
char
psz_buffer
[
256
];
byte_t
*
psz_parser
;
int
i_returncode
,
i
;
int
i_returncode
,
i
,
i_size
;
char
*
psz_return_alpha
;
/* Find an appropriate network module */
...
...
@@ -160,24 +160,33 @@ static int HTTPConnect( input_thread_t * p_input, off_t i_tell )
#define MAX_LINE 1024
/* get the returncode */
if
(
input_Peek
(
p_input
,
&
psz_parser
,
MAX_LINE
)
<=
0
)
if
(
(
i_size
=
input_Peek
(
p_input
,
&
psz_parser
,
MAX_LINE
)
)
<=
0
)
{
msg_Err
(
p_input
,
"not enough data"
);
input_FDNetworkClose
(
p_input
);
return
(
-
1
);
}
if
(
!
strncmp
(
psz_parser
,
"HTTP/1."
,
strlen
(
"HTTP/1."
)
)
)
if
(
(
i_size
>=
sizeof
(
"HTTP/1."
)
+
1
)
&&
!
strncmp
(
psz_parser
,
"HTTP/1."
,
sizeof
(
"HTTP/1."
)
-
1
)
)
{
psz_parser
+=
s
trlen
(
"HTTP
1."
)
+
2
;
psz_parser
+=
s
izeof
(
"HTTP
/
1."
)
+
1
;
i_returncode
=
atoi
(
(
char
*
)
psz_parser
);
msg_Dbg
(
p_input
,
"HTTP server replied: %i"
,
i_returncode
);
psz_parser
+=
4
;
for
(
i
=
0
;
psz_parser
[
i
]
!=
'\r'
||
psz_parser
[
i
+
1
]
!=
'\n'
;
i
++
)
i_size
-=
(
sizeof
(
"HTTP/1."
)
+
5
);
for
(
i
=
0
;
(
i
<
i_size
-
1
)
&&
((
psz_parser
[
i
]
!=
'\r'
)
||
(
psz_parser
[
i
+
1
]
!=
'\n'
));
i
++
)
{
;
}
/* check we actually parsed something */
if
(
(
i
==
i_size
-
1
)
&&
(
psz_parser
[
i
+
1
]
!=
'\n'
)
)
{
msg_Err
(
p_input
,
"stream not compliant with HTTP/1.x"
);
return
-
1
;
}
psz_return_alpha
=
malloc
(
i
+
1
);
memcpy
(
psz_return_alpha
,
psz_parser
,
i
);
psz_return_alpha
[
i
]
=
'\0'
;
...
...
@@ -187,7 +196,7 @@ static int HTTPConnect( input_thread_t * p_input, off_t i_tell )
msg_Err
(
p_input
,
"invalid http reply"
);
return
-
1
;
}
if
(
i_returncode
>=
400
)
/* something is wrong */
{
msg_Err
(
p_input
,
"%i %s"
,
i_returncode
,
...
...
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