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
b616c49e
Commit
b616c49e
authored
Dec 18, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
https: move TLS send function and remove dead non-TLS send function
parent
9889e17c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
65 deletions
+42
-65
modules/access/http/h2output.c
modules/access/http/h2output.c
+42
-0
modules/access/http/transport.c
modules/access/http/transport.c
+0
-56
modules/access/http/transport.h
modules/access/http/transport.h
+0
-9
No files found.
modules/access/http/h2output.c
View file @
b616c49e
...
...
@@ -23,7 +23,11 @@
#endif
#include <assert.h>
#include <errno.h>
#include <stdlib.h>
#ifdef HAVE_POLL
# include <poll.h>
#endif
#include <vlc_common.h>
#include <vlc_tls.h>
#include "h2frame.h"
...
...
@@ -172,6 +176,44 @@ static void vlc_h2_output_flush_unlocked(struct vlc_h2_output *out)
}
}
/**
* Sends bytes to a connection.
* @note This may be a cancellation point.
* The caller is responsible for serializing writes on a given connection.
*/
static
ssize_t
vlc_https_send
(
vlc_tls_t
*
tls
,
const
void
*
buf
,
size_t
len
)
{
struct
pollfd
ufd
;
size_t
count
=
0
;
ufd
.
fd
=
tls
->
fd
;
ufd
.
events
=
POLLOUT
;
while
(
count
<
len
)
{
int
canc
=
vlc_savecancel
();
ssize_t
val
=
tls
->
send
(
tls
,
(
char
*
)
buf
+
count
,
len
-
count
);
vlc_restorecancel
(
canc
);
if
(
val
>
0
)
{
count
+=
val
;
continue
;
}
if
(
val
==
0
)
break
;
if
(
errno
!=
EINTR
&&
errno
!=
EAGAIN
)
return
count
?
(
ssize_t
)
count
:
-
1
;
poll
(
&
ufd
,
1
,
-
1
);
}
return
count
;
}
/**
* Sends one HTTP/2 frame through TLS.
*
...
...
modules/access/http/transport.c
View file @
b616c49e
...
...
@@ -92,62 +92,6 @@ ssize_t vlc_http_recv(int fd, void *buf, size_t len)
return
count
;
}
ssize_t
vlc_https_send
(
vlc_tls_t
*
tls
,
const
void
*
buf
,
size_t
len
)
{
struct
pollfd
ufd
;
size_t
count
=
0
;
ufd
.
fd
=
tls
->
fd
;
ufd
.
events
=
POLLOUT
;
while
(
count
<
len
)
{
int
canc
=
vlc_savecancel
();
ssize_t
val
=
tls
->
send
(
tls
,
(
char
*
)
buf
+
count
,
len
-
count
);
vlc_restorecancel
(
canc
);
if
(
val
>
0
)
{
count
+=
val
;
continue
;
}
if
(
val
==
0
)
break
;
if
(
errno
!=
EINTR
&&
errno
!=
EAGAIN
)
return
-
1
;
poll
(
&
ufd
,
1
,
-
1
);
}
return
count
;
}
ssize_t
vlc_http_send
(
int
fd
,
const
void
*
buf
,
size_t
len
)
{
size_t
count
=
0
;
while
(
count
<
len
)
{
ssize_t
val
=
send
(
fd
,
buf
,
len
,
MSG_NOSIGNAL
);
if
(
val
>
0
)
{
count
+=
val
;
continue
;
}
if
(
val
==
0
)
break
;
if
(
errno
!=
EINTR
)
return
-
1
;
}
return
count
;
}
static
void
cleanup_addrinfo
(
void
*
data
)
{
freeaddrinfo
(
data
);
...
...
modules/access/http/transport.h
View file @
b616c49e
...
...
@@ -38,15 +38,6 @@ ssize_t vlc_http_recv(int fd, void *buf, size_t len);
*/
ssize_t
vlc_https_recv
(
struct
vlc_tls
*
tls
,
void
*
buf
,
size_t
len
);
ssize_t
vlc_http_send
(
int
fd
,
const
void
*
buf
,
size_t
len
);
/**
* Sends bytes to a connection.
* @note This may be a cancellation point.
* The caller is responsible for serializing writes on a given connection.
*/
ssize_t
vlc_https_send
(
struct
vlc_tls
*
tls
,
const
void
*
buf
,
size_t
len
);
struct
vlc_tls
*
vlc_https_connect
(
struct
vlc_tls_creds
*
creds
,
const
char
*
name
,
unsigned
port
,
bool
*
restrict
two
);
...
...
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