Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
768bfe3d
Commit
768bfe3d
authored
Feb 24, 2004
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* http.c: "Transfer-Encoding: chunked" support. (Tested with only one URL).
parent
5fc35373
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
1 deletion
+59
-1
modules/access/http.c
modules/access/http.c
+59
-1
No files found.
modules/access/http.c
View file @
768bfe3d
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* http.c: HTTP input module
* http.c: HTTP input module
*****************************************************************************
*****************************************************************************
* Copyright (C) 2001-2004 VideoLAN
* Copyright (C) 2001-2004 VideoLAN
* $Id: http.c,v 1.5
8 2004/02/02 11:14:32
fenrir Exp $
* $Id: http.c,v 1.5
9 2004/02/24 16:31:46
fenrir Exp $
*
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Christophe Massiot <massiot@via.ecp.fr>
* Christophe Massiot <massiot@via.ecp.fr>
...
@@ -106,6 +106,8 @@ struct access_sys_t
...
@@ -106,6 +106,8 @@ struct access_sys_t
char
*
psz_mime
;
char
*
psz_mime
;
char
*
psz_location
;
char
*
psz_location
;
vlc_bool_t
b_chunked
;
int64_t
i_chunk
;
int64_t
i_tell
;
int64_t
i_tell
;
int64_t
i_size
;
int64_t
i_size
;
};
};
...
@@ -398,11 +400,57 @@ static ssize_t Read( input_thread_t * p_input, byte_t * p_buffer, size_t i_len )
...
@@ -398,11 +400,57 @@ static ssize_t Read( input_thread_t * p_input, byte_t * p_buffer, size_t i_len )
return
0
;
return
0
;
}
}
}
}
if
(
p_sys
->
b_chunked
)
{
if
(
p_sys
->
i_chunk
<
0
)
{
return
0
;
}
if
(
p_sys
->
i_chunk
<=
0
)
{
char
*
psz
=
net_Gets
(
VLC_OBJECT
(
p_input
),
p_sys
->
fd
);
/* read the chunk header */
if
(
psz
==
NULL
)
{
msg_Dbg
(
p_input
,
"failed reading chunk-header line"
);
return
-
1
;
}
p_sys
->
i_chunk
=
strtoll
(
psz
,
NULL
,
16
);
free
(
psz
);
if
(
p_sys
->
i_chunk
<=
0
)
/* eof */
{
p_sys
->
i_chunk
=
-
1
;
return
0
;
}
}
if
(
i_len
>
p_sys
->
i_chunk
)
{
i_len
=
p_sys
->
i_chunk
;
}
}
i_read
=
net_Read
(
p_input
,
p_sys
->
fd
,
p_buffer
,
i_len
,
VLC_FALSE
);
i_read
=
net_Read
(
p_input
,
p_sys
->
fd
,
p_buffer
,
i_len
,
VLC_FALSE
);
if
(
i_read
>
0
)
if
(
i_read
>
0
)
{
{
p_sys
->
i_tell
+=
i_read
;
p_sys
->
i_tell
+=
i_read
;
if
(
p_sys
->
b_chunked
)
{
p_sys
->
i_chunk
-=
i_read
;
if
(
p_sys
->
i_chunk
<=
0
)
{
/* read the empty line */
char
*
psz
=
net_Gets
(
VLC_OBJECT
(
p_input
),
p_sys
->
fd
);
if
(
psz
)
{
free
(
psz
);
}
}
}
}
}
return
i_read
;
return
i_read
;
}
}
...
@@ -471,6 +519,8 @@ static int Connect( input_thread_t *p_input, vlc_bool_t *pb_seekable,
...
@@ -471,6 +519,8 @@ static int Connect( input_thread_t *p_input, vlc_bool_t *pb_seekable,
p_sys
->
psz_location
=
NULL
;
p_sys
->
psz_location
=
NULL
;
p_sys
->
psz_mime
=
NULL
;
p_sys
->
psz_mime
=
NULL
;
p_sys
->
b_chunked
=
VLC_FALSE
;
p_sys
->
i_chunk
=
0
;
p_sys
->
i_size
=
-
1
;
p_sys
->
i_size
=
-
1
;
p_sys
->
i_tell
=
i_tell
;
p_sys
->
i_tell
=
i_tell
;
...
@@ -622,6 +672,14 @@ static int Connect( input_thread_t *p_input, vlc_bool_t *pb_seekable,
...
@@ -622,6 +672,14 @@ static int Connect( input_thread_t *p_input, vlc_bool_t *pb_seekable,
p_sys
->
psz_mime
=
strdup
(
p
);
p_sys
->
psz_mime
=
strdup
(
p
);
msg_Dbg
(
p_input
,
"Content-Type: %s"
,
p_sys
->
psz_mime
);
msg_Dbg
(
p_input
,
"Content-Type: %s"
,
p_sys
->
psz_mime
);
}
}
else
if
(
!
strcasecmp
(
psz
,
"Transfer-Encoding"
)
)
{
msg_Dbg
(
p_input
,
"Transfer-Encoding: %s"
,
p
);
if
(
!
strncasecmp
(
p
,
"chunked"
,
7
)
)
{
p_sys
->
b_chunked
=
VLC_TRUE
;
}
}
free
(
psz
);
free
(
psz
);
}
}
...
...
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