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
e1cfc6b6
Commit
e1cfc6b6
authored
Aug 18, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure SOCKS is only attempted with TCP
parent
c92a7456
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
8 deletions
+31
-8
src/network/tcp.c
src/network/tcp.c
+31
-8
No files found.
src/network/tcp.c
View file @
e1cfc6b6
...
...
@@ -84,8 +84,8 @@ int __net_Connect( vlc_object_t *p_this, const char *psz_host, int i_port,
memset
(
&
hints
,
0
,
sizeof
(
hints
)
);
hints
.
ai_socktype
=
SOCK_STREAM
;
psz_socks
=
var_CreateGetString
(
p_this
,
"socks"
);
if
(
*
psz_socks
&&
*
psz_socks
!=
':'
)
psz_socks
=
var_CreateGet
NonEmpty
String
(
p_this
,
"socks"
);
if
(
psz_socks
!=
NULL
)
{
char
*
psz
=
strchr
(
psz_socks
,
':'
);
...
...
@@ -95,8 +95,32 @@ int __net_Connect( vlc_object_t *p_this, const char *psz_host, int i_port,
psz_realhost
=
psz_socks
;
i_realport
=
(
psz
!=
NULL
)
?
atoi
(
psz
)
:
1080
;
msg_Dbg
(
p_this
,
"net: connecting to %s port %d for %s port %d"
,
msg_Dbg
(
p_this
,
"net: connecting to %s port %d
(SOCKS)
for %s port %d"
,
psz_realhost
,
i_realport
,
psz_host
,
i_port
);
/* We only implement TCP with SOCKS */
switch
(
type
)
{
case
0
:
type
=
SOCK_STREAM
;
case
SOCK_STREAM
:
break
;
default:
msg_Err
(
p_this
,
"Socket type not supported through SOCKS"
);
free
(
psz_socks
);
return
-
1
;
}
switch
(
proto
)
{
case
0
:
proto
=
IPPROTO_TCP
;
case
IPPROTO_TCP
:
break
;
default:
msg_Err
(
p_this
,
"Transport not supported through SOCKS"
);
free
(
psz_socks
);
return
-
1
;
}
}
else
{
...
...
@@ -108,11 +132,12 @@ int __net_Connect( vlc_object_t *p_this, const char *psz_host, int i_port,
}
i_val
=
vlc_getaddrinfo
(
p_this
,
psz_realhost
,
i_realport
,
&
hints
,
&
res
);
free
(
psz_socks
);
if
(
i_val
)
{
msg_Err
(
p_this
,
"cannot resolve %s port %d : %s"
,
psz_realhost
,
i_realport
,
vlc_gai_strerror
(
i_val
)
);
free
(
psz_socks
);
return
-
1
;
}
...
...
@@ -169,7 +194,6 @@ int __net_Connect( vlc_object_t *p_this, const char *psz_host, int i_port,
msg_Dbg
(
p_this
,
"connection aborted"
);
net_Close
(
fd
);
vlc_freeaddrinfo
(
res
);
free
(
psz_socks
);
return
-
1
;
}
...
...
@@ -230,12 +254,12 @@ next_ai: /* failure */
{
msg_Err
(
p_this
,
"Connection to %s port %d failed: %s"
,
psz_host
,
i_port
,
net_strerror
(
i_saved_errno
)
);
free
(
psz_socks
);
return
-
1
;
}
if
(
*
psz_socks
&&
*
psz_socks
!=
':'
)
if
(
psz_socks
!=
NULL
)
{
/* NOTE: psz_socks already free'd! */
char
*
psz_user
=
var_CreateGetString
(
p_this
,
"socks-user"
);
char
*
psz_pwd
=
var_CreateGetString
(
p_this
,
"socks-pwd"
);
...
...
@@ -250,7 +274,6 @@ next_ai: /* failure */
free
(
psz_user
);
free
(
psz_pwd
);
}
free
(
psz_socks
);
return
i_handle
;
}
...
...
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