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
9911e583
Commit
9911e583
authored
Dec 19, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
https: add non-TLS support to connection manager
parent
c8f672ff
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
17 deletions
+62
-17
modules/access/http/access.c
modules/access/http/access.c
+3
-4
modules/access/http/connmgr.c
modules/access/http/connmgr.c
+49
-4
modules/access/http/connmgr.h
modules/access/http/connmgr.h
+4
-4
modules/access/http/file.c
modules/access/http/file.c
+2
-2
modules/access/http/file_test.c
modules/access/http/file_test.c
+4
-3
No files found.
modules/access/http/access.c
View file @
9911e583
...
...
@@ -130,7 +130,7 @@ static int Open(vlc_object_t *obj)
sys
->
manager
=
NULL
;
sys
->
file
=
NULL
;
sys
->
manager
=
vlc_http_mgr_create
(
obj
);
sys
->
manager
=
vlc_http_mgr_create
(
obj
,
var_InheritBool
(
obj
,
"http2"
)
);
if
(
sys
->
manager
==
NULL
)
goto
error
;
...
...
@@ -203,7 +203,6 @@ vlc_module_begin()
add_shortcut
(
"https"
)
set_callbacks
(
Open
,
Close
)
// TODO: force HTTP/2 over TCP
//add_bool("http2", false, N_("HTTP 2.0"),
// N_("Negotiate HTTP version 2.0"), true)
add_bool
(
"http2"
,
false
,
N_
(
"Force HTTP/2"
),
N_
(
"Force HTTP version 2.0 over TCP."
),
true
)
vlc_module_end
()
modules/access/http/connmgr.c
View file @
9911e583
...
...
@@ -135,6 +135,7 @@ struct vlc_http_mgr
vlc_object_t
*
obj
;
vlc_tls_creds_t
*
creds
;
struct
vlc_http_conn
*
conn
;
bool
use_h2c
;
};
static
struct
vlc_http_conn
*
vlc_http_mgr_find
(
struct
vlc_http_mgr
*
mgr
,
...
...
@@ -180,10 +181,13 @@ struct vlc_http_msg *vlc_http_mgr_reuse(struct vlc_http_mgr *mgr,
return
NULL
;
}
struct
vlc_http_msg
*
vlc_https_request
(
struct
vlc_http_mgr
*
mgr
,
const
char
*
host
,
unsigned
port
,
const
struct
vlc_http_msg
*
req
)
st
atic
st
ruct
vlc_http_msg
*
vlc_https_request
(
struct
vlc_http_mgr
*
mgr
,
const
char
*
host
,
unsigned
port
,
const
struct
vlc_http_msg
*
req
)
{
if
(
mgr
->
creds
==
NULL
&&
mgr
->
conn
!=
NULL
)
return
NULL
;
/* switch from HTTP to HTTPS not implemented */
if
(
mgr
->
creds
==
NULL
)
{
/* First TLS connection: load x509 credentials */
mgr
->
creds
=
vlc_tls_ClientCreate
(
mgr
->
obj
);
...
...
@@ -226,7 +230,47 @@ struct vlc_http_msg *vlc_https_request(struct vlc_http_mgr *mgr,
return
vlc_http_mgr_reuse
(
mgr
,
host
,
port
,
req
);
}
struct
vlc_http_mgr
*
vlc_http_mgr_create
(
vlc_object_t
*
obj
)
static
struct
vlc_http_msg
*
vlc_http_request
(
struct
vlc_http_mgr
*
mgr
,
const
char
*
host
,
unsigned
port
,
const
struct
vlc_http_msg
*
req
)
{
if
(
mgr
->
creds
!=
NULL
&&
mgr
->
conn
!=
NULL
)
return
NULL
;
/* switch from HTTPS to HTTP not implemented */
struct
vlc_http_msg
*
resp
=
vlc_http_mgr_reuse
(
mgr
,
host
,
port
,
req
);
if
(
resp
!=
NULL
)
return
resp
;
vlc_tls_t
*
tls
=
vlc_http_connect_i11e
(
mgr
->
obj
,
host
,
port
);
if
(
tls
==
NULL
)
return
NULL
;
struct
vlc_http_conn
*
conn
;
if
(
mgr
->
use_h2c
)
conn
=
vlc_h2_conn_create
(
tls
);
else
conn
=
vlc_h1_conn_create
(
tls
);
if
(
unlikely
(
conn
==
NULL
))
{
vlc_tls_Close
(
tls
);
return
NULL
;
}
mgr
->
conn
=
conn
;
return
vlc_http_mgr_reuse
(
mgr
,
host
,
port
,
req
);
}
struct
vlc_http_msg
*
vlc_http_mgr_request
(
struct
vlc_http_mgr
*
mgr
,
bool
https
,
const
char
*
host
,
unsigned
port
,
const
struct
vlc_http_msg
*
m
)
{
return
(
https
?
vlc_https_request
:
vlc_http_request
)(
mgr
,
host
,
port
,
m
);
}
struct
vlc_http_mgr
*
vlc_http_mgr_create
(
vlc_object_t
*
obj
,
bool
h2c
)
{
struct
vlc_http_mgr
*
mgr
=
malloc
(
sizeof
(
*
mgr
));
if
(
unlikely
(
mgr
==
NULL
))
...
...
@@ -235,6 +279,7 @@ struct vlc_http_mgr *vlc_http_mgr_create(vlc_object_t *obj)
mgr
->
obj
=
obj
;
mgr
->
creds
=
NULL
;
mgr
->
conn
=
NULL
;
mgr
->
use_h2c
=
h2c
;
return
mgr
;
}
...
...
modules/access/http/connmgr.h
View file @
9911e583
...
...
@@ -21,9 +21,9 @@
struct
vlc_http_mgr
;
struct
vlc_http_msg
;
struct
vlc_http_msg
*
vlc_http
s_request
(
struct
vlc_http_mgr
*
mgr
,
const
char
*
host
,
unsigned
port
,
const
struct
vlc_http_msg
*
req
);
struct
vlc_http_msg
*
vlc_http
_mgr_request
(
struct
vlc_http_mgr
*
mgr
,
bool
https
,
const
char
*
host
,
unsigned
port
,
const
struct
vlc_http_msg
*
req
);
struct
vlc_http_mgr
*
vlc_http_mgr_create
(
vlc_object_t
*
obj
);
struct
vlc_http_mgr
*
vlc_http_mgr_create
(
vlc_object_t
*
obj
,
bool
try_h2c
);
void
vlc_http_mgr_destroy
(
struct
vlc_http_mgr
*
mgr
);
modules/access/http/file.c
View file @
9911e583
...
...
@@ -121,8 +121,8 @@ static struct vlc_http_msg *vlc_http_file_open(struct vlc_http_file *file,
if
(
unlikely
(
req
==
NULL
))
return
NULL
;
struct
vlc_http_msg
*
resp
=
vlc_http
s_request
(
file
->
manager
,
file
->
host
,
file
->
port
,
req
);
struct
vlc_http_msg
*
resp
=
vlc_http
_mgr_request
(
file
->
manager
,
true
,
file
->
host
,
file
->
port
,
req
);
vlc_http_msg_destroy
(
req
);
resp
=
vlc_http_msg_get_final
(
resp
);
...
...
modules/access/http/file_test.c
View file @
9911e583
...
...
@@ -232,13 +232,14 @@ static const struct vlc_http_stream_cbs stream_callbacks =
static
struct
vlc_http_stream
stream
=
{
&
stream_callbacks
};
struct
vlc_http_msg
*
vlc_http
s_request
(
struct
vlc_http_mgr
*
mgr
,
const
char
*
host
,
unsigned
port
,
const
struct
vlc_http_msg
*
req
)
struct
vlc_http_msg
*
vlc_http
_mgr_request
(
struct
vlc_http_mgr
*
mgr
,
bool
https
,
const
char
*
host
,
unsigned
port
,
const
struct
vlc_http_msg
*
req
)
{
const
char
*
str
;
char
*
end
;
assert
(
https
);
assert
(
mgr
==
NULL
);
assert
(
!
strcmp
(
host
,
"www.example.com"
));
assert
(
port
==
8443
);
...
...
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