Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
ba354a8c
Commit
ba354a8c
authored
May 21, 2012
by
Samuel Pitoiset
Committed by
Martin Storsjö
May 22, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http: Add http_shutdown() for ending writing of posts
Signed-off-by:
Martin Storsjö
<
martin@martin.st
>
parent
4a9ca935
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
+19
-2
http.c
libavformat/http.c
+19
-2
No files found.
libavformat/http.c
View file @
ba354a8c
...
@@ -51,6 +51,7 @@ typedef struct {
...
@@ -51,6 +51,7 @@ typedef struct {
char
*
headers
;
char
*
headers
;
int
willclose
;
/**< Set if the server correctly handles Connection: close and will close the connection after feeding us the content. */
int
willclose
;
/**< Set if the server correctly handles Connection: close and will close the connection after feeding us the content. */
int
chunked_post
;
int
chunked_post
;
int
end_chunked_post
;
/**< A flag which indicates if the end of chunked encoding has been sent. */
}
HTTPContext
;
}
HTTPContext
;
#define OFFSET(x) offsetof(HTTPContext, x)
#define OFFSET(x) offsetof(HTTPContext, x)
...
@@ -415,6 +416,7 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
...
@@ -415,6 +416,7 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
s
->
off
=
0
;
s
->
off
=
0
;
s
->
filesize
=
-
1
;
s
->
filesize
=
-
1
;
s
->
willclose
=
0
;
s
->
willclose
=
0
;
s
->
end_chunked_post
=
0
;
if
(
post
)
{
if
(
post
)
{
/* Pretend that it did work. We didn't read any header yet, since
/* Pretend that it did work. We didn't read any header yet, since
* we've still to send the POST data, but the code calling this
* we've still to send the POST data, but the code calling this
...
@@ -512,16 +514,30 @@ static int http_write(URLContext *h, const uint8_t *buf, int size)
...
@@ -512,16 +514,30 @@ static int http_write(URLContext *h, const uint8_t *buf, int size)
return
size
;
return
size
;
}
}
static
int
http_
close
(
URLContext
*
h
)
static
int
http_
shutdown
(
URLContext
*
h
,
int
flags
)
{
{
int
ret
=
0
;
int
ret
=
0
;
char
footer
[]
=
"0
\r\n\r\n
"
;
char
footer
[]
=
"0
\r\n\r\n
"
;
HTTPContext
*
s
=
h
->
priv_data
;
HTTPContext
*
s
=
h
->
priv_data
;
/* signal end of chunked encoding if used */
/* signal end of chunked encoding if used */
if
((
h
->
flags
&
AVIO_FLAG_WRITE
)
&&
s
->
chunked_post
)
{
if
((
flags
&
AVIO_FLAG_WRITE
)
&&
s
->
chunked_post
)
{
ret
=
ffurl_write
(
s
->
hd
,
footer
,
sizeof
(
footer
)
-
1
);
ret
=
ffurl_write
(
s
->
hd
,
footer
,
sizeof
(
footer
)
-
1
);
ret
=
ret
>
0
?
0
:
ret
;
ret
=
ret
>
0
?
0
:
ret
;
s
->
end_chunked_post
=
1
;
}
return
ret
;
}
static
int
http_close
(
URLContext
*
h
)
{
int
ret
=
0
;
HTTPContext
*
s
=
h
->
priv_data
;
if
(
!
s
->
end_chunked_post
)
{
/* Close the write direction by sending the end of chunked encoding. */
ret
=
http_shutdown
(
h
,
h
->
flags
);
}
}
if
(
s
->
hd
)
if
(
s
->
hd
)
...
@@ -581,6 +597,7 @@ URLProtocol ff_http_protocol = {
...
@@ -581,6 +597,7 @@ URLProtocol ff_http_protocol = {
.
url_seek
=
http_seek
,
.
url_seek
=
http_seek
,
.
url_close
=
http_close
,
.
url_close
=
http_close
,
.
url_get_file_handle
=
http_get_file_handle
,
.
url_get_file_handle
=
http_get_file_handle
,
.
url_shutdown
=
http_shutdown
,
.
priv_data_size
=
sizeof
(
HTTPContext
),
.
priv_data_size
=
sizeof
(
HTTPContext
),
.
priv_data_class
=
&
http_context_class
,
.
priv_data_class
=
&
http_context_class
,
.
flags
=
URL_PROTOCOL_FLAG_NETWORK
,
.
flags
=
URL_PROTOCOL_FLAG_NETWORK
,
...
...
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