Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
ed2aa87e
Commit
ed2aa87e
authored
15 years ago
by
Yang Tse
Browse files
Options
Downloads
Patches
Plain Diff
Set socket option SO_REUSEADDR=true on stunnel accept'ing port
parent
f0826974
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/httpsserver.pl
+35
-11
35 additions, 11 deletions
tests/httpsserver.pl
with
35 additions
and
11 deletions
tests/httpsserver.pl
+
35
−
11
View file @
ed2aa87e
...
...
@@ -23,6 +23,15 @@ my $proto='https';
my
$stuncert
;
my
$ver_major
;
my
$ver_minor
;
my
$stunnel_version
;
my
$socketopt
;
my
$cmd
;
#***************************************************************************
# Process command line options
#
while
(
@ARGV
)
{
if
(
$ARGV
[
0
]
eq
"
-v
")
{
$verbose
=
1
;
...
...
@@ -69,8 +78,6 @@ my $ssltext = uc($proto) ." SSL/TLS:";
#***************************************************************************
# Find out version info for the given stunnel binary
#
my
$ver_major
;
my
$ver_minor
;
foreach
my
$veropt
(('
-version
',
'
-V
'))
{
foreach
my
$verstr
(
qx($stunnel $veropt 2>&1)
)
{
if
(
$verstr
=~
/^stunnel (\d+)\.(\d+) on /
)
{
...
...
@@ -81,7 +88,7 @@ foreach my $veropt (('-version', '-V')) {
}
last
if
(
$ver_major
);
}
if
(
!
$ver_major
)
{
if
(
(
!
$ver_major
)
||
(
!
$ver_minor
))
{
if
(
-
x
"
$stunnel
"
&&
!
-
d
"
$stunnel
")
{
print
"
$ssltext
Unknown stunnel version
\n
";
}
...
...
@@ -90,15 +97,26 @@ if(!$ver_major) {
}
exit
1
;
}
$stunnel_version
=
(
100
*$ver_major
)
+
$ver_minor
;
#***************************************************************************
#
Build command to execute depending on stunnel
version
#
Verify minimmum stunnel required
version
#
my
$cmd
;
if
(
$ver_major
<
4
)
{
# stunnel version less than 4.00
$cmd
=
"
$stunnel
-p
$certfile
-P
$pidfile
-d
$port
-r
$target_port
-f
";
$cmd
.=
"
-D
$loglevel
>
$logfile
2>&1
";
if
(
$stunnel_version
<
310
)
{
print
"
$ssltext
Unsupported stunnel version
$ver_major
.
$ver_minor
\n
";
}
#***************************************************************************
# Build command to execute for stunnel 3.X versions
#
if
(
$stunnel_version
<
400
)
{
if
(
$stunnel_version
>=
319
)
{
$socketopt
=
"
-O a:SO_REUSEADDR=1
";
}
$cmd
=
"
$stunnel
-p
$certfile
-P
$pidfile
";
$cmd
.=
"
-d
$port
-r
$target_port
-f -D
$loglevel
";
$cmd
.=
(
$socketopt
)
?
"
$socketopt
"
:
"";
$cmd
.=
"
>
$logfile
2>&1
";
if
(
$verbose
)
{
print
uc
(
$proto
)
.
"
server (stunnel
$ver_major
.
$ver_minor
)
\n
";
print
"
cmd:
$cmd
\n
";
...
...
@@ -110,8 +128,12 @@ if($ver_major < 4) {
print
"
connect to port:
$target_port
\n
";
}
}
else
{
# stunnel version 4.00 or later
#***************************************************************************
# Build command to execute for stunnel 4.00 and newer
#
if
(
$stunnel_version
>=
400
)
{
$socketopt
=
"
a:SO_REUSEADDR=1
";
$cmd
=
"
$stunnel
$conffile
";
$cmd
.=
"
>
$logfile
2>&1
";
# stunnel configuration file
...
...
@@ -122,6 +144,7 @@ else {
pid =
$pidfile
debug =
$loglevel
output =
$logfile
socket =
$socketopt
foreground = yes
[curltest]
...
...
@@ -145,6 +168,7 @@ else {
print
"
pid =
$pidfile
\n
";
print
"
debug =
$loglevel
\n
";
print
"
output =
$logfile
\n
";
print
"
socket =
$socketopt
\n
";
print
"
foreground = yes
\n
";
print
"
\n
";
print
"
[curltest]
\n
";
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment