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
9a108233
Commit
9a108233
authored
Dec 18, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
https: move TLS receive function and remove non-TLS one
parent
dcd5ac97
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
67 deletions
+44
-67
modules/access/http/h2conn.c
modules/access/http/h2conn.c
+44
-0
modules/access/http/transport.c
modules/access/http/transport.c
+0
-56
modules/access/http/transport.h
modules/access/http/transport.h
+0
-11
No files found.
modules/access/http/h2conn.c
View file @
9a108233
...
...
@@ -23,8 +23,12 @@
#endif
#include <assert.h>
#include <errno.h>
#include <inttypes.h>
#include <stdlib.h>
#ifdef HAVE_POLL
# include <poll.h>
#endif
#include <vlc_common.h>
#include <vlc_block.h>
#include <vlc_interrupt.h>
...
...
@@ -504,6 +508,46 @@ static const struct vlc_h2_parser_cbs vlc_h2_conn_callbacks =
vlc_h2_stream_reset
,
};
/**
* Receives TLS data.
*
* Receives bytes from the peer through a TLS session.
* @note This may be a cancellation point.
* The caller is responsible for serializing reads on a given connection.
*/
static
ssize_t
vlc_https_recv
(
vlc_tls_t
*
tls
,
void
*
buf
,
size_t
len
)
{
struct
pollfd
ufd
;
size_t
count
=
0
;
ufd
.
fd
=
tls
->
fd
;
ufd
.
events
=
POLLIN
;
while
(
count
<
len
)
{
int
canc
=
vlc_savecancel
();
ssize_t
val
=
tls
->
recv
(
tls
,
(
char
*
)
buf
+
count
,
len
-
count
);
vlc_restorecancel
(
canc
);
if
(
val
==
0
)
break
;
if
(
val
>=
0
)
{
count
+=
val
;
continue
;
}
if
(
errno
!=
EINTR
&&
errno
!=
EAGAIN
)
return
count
?
(
ssize_t
)
count
:
-
1
;
poll
(
&
ufd
,
1
,
-
1
);
}
return
count
;
}
/**
* Receives an HTTP/2 frame through TLS.
*
...
...
modules/access/http/transport.c
View file @
9a108233
...
...
@@ -36,62 +36,6 @@
#include "transport.h"
ssize_t
vlc_https_recv
(
vlc_tls_t
*
tls
,
void
*
buf
,
size_t
len
)
{
struct
pollfd
ufd
;
size_t
count
=
0
;
ufd
.
fd
=
tls
->
fd
;
ufd
.
events
=
POLLIN
;
while
(
count
<
len
)
{
int
canc
=
vlc_savecancel
();
ssize_t
val
=
tls
->
recv
(
tls
,
(
char
*
)
buf
+
count
,
len
-
count
);
vlc_restorecancel
(
canc
);
if
(
val
==
0
)
break
;
if
(
val
>=
0
)
{
count
+=
val
;
continue
;
}
if
(
errno
!=
EINTR
&&
errno
!=
EAGAIN
)
return
-
1
;
poll
(
&
ufd
,
1
,
-
1
);
}
return
count
;
}
ssize_t
vlc_http_recv
(
int
fd
,
void
*
buf
,
size_t
len
)
{
unsigned
count
=
0
;
while
(
count
<
len
)
{
ssize_t
val
=
recv
(
fd
,
(
char
*
)
buf
+
count
,
len
-
count
,
MSG_WAITALL
);
if
(
val
==
0
)
break
;
if
(
val
>=
0
)
{
count
+=
val
;
continue
;
}
if
(
errno
!=
EINTR
)
return
-
1
;
}
return
count
;
}
static
void
cleanup_addrinfo
(
void
*
data
)
{
freeaddrinfo
(
data
);
...
...
modules/access/http/transport.h
View file @
9a108233
...
...
@@ -27,17 +27,6 @@
struct
vlc_tls
;
struct
vlc_tls_creds
;
ssize_t
vlc_http_recv
(
int
fd
,
void
*
buf
,
size_t
len
);
/**
* Receives TLS data.
*
* Receives bytes from the peer through a TLS session.
* @note This may be a cancellation point.
* The caller is responsible for serializing reads on a given connection.
*/
ssize_t
vlc_https_recv
(
struct
vlc_tls
*
tls
,
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