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
a79cc76f
Commit
a79cc76f
authored
Jan 07, 2016
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
https: fix proxy URL parsing, improve coverage
parent
8a9a8d9f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
13 deletions
+39
-13
modules/access/http/tunnel.c
modules/access/http/tunnel.c
+2
-2
modules/access/http/tunnel_test.c
modules/access/http/tunnel_test.c
+37
-11
No files found.
modules/access/http/tunnel.c
View file @
a79cc76f
...
...
@@ -125,11 +125,11 @@ vlc_tls_t *vlc_https_connect_proxy(vlc_tls_creds_t *creds,
vlc_tls_t
*
session
=
NULL
;
bool
ptwo
=
false
;
#if TLS_OVER_TLS
if
(
strcasecmp
(
url
.
psz_protocol
,
"https"
))
if
(
!
strcasecmp
(
url
.
psz_protocol
,
"https"
))
session
=
vlc_https_connect
(
creds
,
url
.
psz_host
,
url
.
i_port
,
&
ptwo
);
else
#endif
if
(
strcasecmp
(
url
.
psz_protocol
,
"http"
))
if
(
!
strcasecmp
(
url
.
psz_protocol
,
"http"
))
session
=
vlc_http_connect
(
creds
?
creds
->
p_parent
:
NULL
,
url
.
psz_host
,
url
.
i_port
);
else
...
...
modules/access/http/tunnel_test.c
View file @
a79cc76f
...
...
@@ -99,11 +99,11 @@ static void *proxy_thread(void *data)
vlc_assert_unreachable
();
}
int
main
(
void
)
static
int
server_socket
(
unsigned
*
port
)
{
int
l
fd
=
socket
(
PF_INET6
,
SOCK_STREAM
|
SOCK_CLOEXEC
,
IPPROTO_TCP
);
if
(
l
fd
==
-
1
)
return
77
;
int
fd
=
socket
(
PF_INET6
,
SOCK_STREAM
|
SOCK_CLOEXEC
,
IPPROTO_TCP
);
if
(
fd
==
-
1
)
return
-
1
;
struct
sockaddr_in6
addr
=
{
.
sin6_family
=
AF_INET6
,
...
...
@@ -114,27 +114,53 @@ int main(void)
};
socklen_t
addrlen
=
sizeof
(
addr
);
if
(
bind
(
l
fd
,
(
struct
sockaddr
*
)
&
addr
,
addrlen
)
||
listen
(
lfd
,
255
))
if
(
bind
(
fd
,
(
struct
sockaddr
*
)
&
addr
,
addrlen
)
||
getsockname
(
fd
,
&
addr
,
&
addrlen
))
{
close
(
l
fd
);
return
77
;
close
(
fd
);
return
-
1
;
}
*
port
=
ntohs
(
addr
.
sin6_port
);
return
fd
;
}
int
main
(
void
)
{
char
*
url
;
unsigned
port
;
bool
two
;
getsockname
(
lfd
,
&
addr
,
&
addrlen
);
if
(
asprintf
(
&
url
,
"https://[::1]:%u"
,
ntohs
(
addr
.
sin6_port
))
<
0
)
/* Test bad URLs */
vlc_https_connect_proxy
(
NULL
,
"www.example.com"
,
0
,
&
two
,
"/test"
);
vlc_https_connect_proxy
(
NULL
,
"www.example.com"
,
0
,
&
two
,
"ftp://proxy.example.com/"
);
int
lfd
=
server_socket
(
&
port
);
if
(
lfd
==
-
1
)
return
77
;
if
(
asprintf
(
&
url
,
"http://[::1]:%u"
,
port
)
<
0
)
url
=
NULL
;
assert
(
url
!=
NULL
);
vlc_thread_t
th
;
/* Test connection failure */
vlc_https_connect_proxy
(
NULL
,
"www.example.com"
,
0
,
&
two
,
url
);
if
(
listen
(
lfd
,
255
))
{
close
(
lfd
);
return
77
;
}
vlc_thread_t
th
;
if
(
vlc_clone
(
&
th
,
proxy_thread
,
(
void
*
)(
intptr_t
)
lfd
,
VLC_THREAD_PRIORITY_LOW
))
assert
(
!
"Thread error"
);
/* Test proxy error */
vlc_https_connect_proxy
(
NULL
,
"www.example.com"
,
0
,
&
two
,
url
);
vlc_cancel
(
th
);
...
...
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