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
c8f672ff
Commit
c8f672ff
authored
Dec 19, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
https: add vlc_http_connect()
parent
5138d869
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
7 deletions
+71
-7
modules/access/http/connmgr.c
modules/access/http/connmgr.c
+46
-0
modules/access/http/transport.c
modules/access/http/transport.c
+22
-7
modules/access/http/transport.h
modules/access/http/transport.h
+3
-0
No files found.
modules/access/http/connmgr.c
View file @
c8f672ff
...
...
@@ -84,6 +84,52 @@ static vlc_tls_t *vlc_https_connect_i11e(vlc_tls_creds_t *creds,
return
res
;
}
struct
vlc_http_connecting
{
vlc_object_t
*
obj
;
const
char
*
host
;
unsigned
port
;
vlc_sem_t
done
;
};
static
void
*
vlc_http_connect_thread
(
void
*
data
)
{
struct
vlc_http_connecting
*
c
=
data
;
vlc_tls_t
*
tls
;
tls
=
vlc_http_connect
(
c
->
obj
,
c
->
host
,
c
->
port
);
vlc_sem_post
(
&
c
->
done
);
return
tls
;
}
/** Interruptible vlc_http_connect() */
static
vlc_tls_t
*
vlc_http_connect_i11e
(
vlc_object_t
*
obj
,
const
char
*
host
,
unsigned
port
)
{
struct
vlc_http_connecting
c
;
vlc_thread_t
th
;
c
.
obj
=
obj
;
c
.
host
=
host
;
c
.
port
=
port
;
vlc_sem_init
(
&
c
.
done
,
0
);
if
(
vlc_clone
(
&
th
,
vlc_http_connect_thread
,
&
c
,
VLC_THREAD_PRIORITY_INPUT
))
return
NULL
;
void
*
res
;
if
(
vlc_sem_wait_i11e
(
&
c
.
done
))
vlc_cancel
(
th
);
vlc_join
(
th
,
&
res
);
vlc_sem_destroy
(
&
c
.
done
);
if
(
res
==
VLC_THREAD_CANCELED
)
res
=
NULL
;
return
res
;
}
struct
vlc_http_mgr
{
vlc_object_t
*
obj
;
...
...
modules/access/http/transport.c
View file @
c8f672ff
...
...
@@ -96,25 +96,40 @@ static int vlc_tcp_connect(vlc_object_t *obj, const char *name, unsigned port)
vlc_cleanup_pop
();
freeaddrinfo
(
res
);
#ifndef _WIN32
fcntl
(
fd
,
F_SETFL
,
fcntl
(
fd
,
F_GETFL
)
|
O_NONBLOCK
);
#else
ioctlsocket
(
fd
,
FIONBIO
,
&
(
unsigned
long
){
1
});
#endif
return
fd
;
}
vlc_tls_t
*
vlc_http_connect
(
vlc_object_t
*
obj
,
const
char
*
name
,
unsigned
port
)
{
if
(
port
==
0
)
port
=
80
;
int
fd
=
vlc_tcp_connect
(
obj
,
name
,
port
);
if
(
fd
==
-
1
)
return
NULL
;
vlc_tls_t
*
tls
=
vlc_tls_DummyCreate
(
obj
,
fd
);
if
(
tls
==
NULL
)
net_Close
(
fd
);
return
tls
;
}
vlc_tls_t
*
vlc_https_connect
(
vlc_tls_creds_t
*
creds
,
const
char
*
name
,
unsigned
port
,
bool
*
restrict
two
)
{
if
(
port
==
0
)
port
=
443
;
int
fd
=
vlc_tcp_connect
(
VLC_OBJECT
(
creds
)
,
name
,
port
);
int
fd
=
vlc_tcp_connect
(
creds
->
p_parent
,
name
,
port
);
if
(
fd
==
-
1
)
return
NULL
;
#ifndef _WIN32
fcntl
(
fd
,
F_SETFL
,
fcntl
(
fd
,
F_GETFL
)
|
O_NONBLOCK
);
#else
ioctlsocket
(
fd
,
FIONBIO
,
&
(
unsigned
long
){
1
});
#endif
/* TLS with ALPN */
const
char
*
alpn
[]
=
{
"h2"
,
"http/1.1"
,
NULL
};
char
*
alp
;
...
...
modules/access/http/transport.h
View file @
c8f672ff
...
...
@@ -24,11 +24,14 @@
#include <stddef.h>
#include <stdbool.h>
struct
vlc_object_t
;
struct
vlc_tls
;
struct
vlc_tls_creds
;
struct
vlc_tls
*
vlc_https_connect
(
struct
vlc_tls_creds
*
creds
,
const
char
*
name
,
unsigned
port
,
bool
*
restrict
two
);
struct
vlc_tls
*
vlc_http_connect
(
struct
vlc_object_t
*
obj
,
const
char
*
name
,
unsigned
port
);
#endif
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