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
1da3d402
Commit
1da3d402
authored
17 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
convert test case 540 to use a custom Host: header as well
parent
1da3192d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/data/test540
+4
-4
4 additions, 4 deletions
tests/data/test540
tests/libtest/lib540.c
+22
-5
22 additions, 5 deletions
tests/libtest/lib540.c
with
26 additions
and
9 deletions
tests/data/test540
+
4
−
4
View file @
1da3d402
...
...
@@ -52,7 +52,7 @@ crypto
HTTP proxy auth Digest multi API re-using connection
</name>
<command>
http://test.remote.server.com/path/540 http://%HOSTIP:%HTTPPORT silly:person
http://test.remote.server.com/path/540 http://%HOSTIP:%HTTPPORT silly:person
custom.set.host.name
</command>
</client>
...
...
@@ -63,24 +63,24 @@ http://test.remote.server.com/path/540 http://%HOSTIP:%HTTPPORT silly:person
</strip>
<protocol>
GET http://test.remote.server.com/path/540 HTTP/1.1
Host: test.remote.server.com
Pragma: no-cache
Accept: */*
Proxy-Connection: Keep-Alive
Host: custom.set.host.name
GET http://test.remote.server.com/path/540 HTTP/1.1
Proxy-Authorization: Digest username="silly", realm="weirdorealm", nonce="12345", uri="/path/540", response="ca507dcf189196b6a5374d3233042261"
Host: test.remote.server.com
Pragma: no-cache
Accept: */*
Proxy-Connection: Keep-Alive
Host: custom.set.host.name
GET http://test.remote.server.com/path/540 HTTP/1.1
Proxy-Authorization: Digest username="silly", realm="weirdorealm", nonce="12345", uri="/path/540", response="ca507dcf189196b6a5374d3233042261"
Host: test.remote.server.com
Pragma: no-cache
Accept: */*
Proxy-Connection: Keep-Alive
Host: custom.set.host.name
</protocol>
</verify>
...
...
This diff is collapsed.
Click to expand it.
tests/libtest/lib540.c
+
22
−
5
View file @
1da3d402
...
...
@@ -13,14 +13,17 @@
* argv1 = URL
* argv2 = proxy
* argv3 = proxyuser:password
* argv4 = host name to use for the custom Host: header
*/
#include
"test.h"
#define PROXY arg2
#define PROXYUSERPWD arg3
#define HOST test_argv[4]
static
void
init
(
CURLM
*
cm
,
const
char
*
url
,
const
char
*
userpwd
)
static
void
init
(
CURLM
*
cm
,
const
char
*
url
,
const
char
*
userpwd
,
struct
curl_slist
*
headers
)
{
CURL
*
eh
=
curl_easy_init
();
...
...
@@ -30,11 +33,13 @@ static void init(CURLM *cm, const char* url, const char* userpwd)
curl_easy_setopt
(
eh
,
CURLOPT_PROXYAUTH
,
CURLAUTH_ANY
);
curl_easy_setopt
(
eh
,
CURLOPT_VERBOSE
,
1
);
curl_easy_setopt
(
eh
,
CURLOPT_HEADER
,
1
);
curl_easy_setopt
(
eh
,
CURLOPT_HTTPHEADER
,
headers
);
/* custom Host: */
curl_multi_add_handle
(
cm
,
eh
);
}
static
int
loop
(
CURLM
*
cm
,
const
char
*
url
,
const
char
*
userpwd
)
static
int
loop
(
CURLM
*
cm
,
const
char
*
url
,
const
char
*
userpwd
,
struct
curl_slist
*
headers
)
{
CURLMsg
*
msg
;
long
L
;
...
...
@@ -42,7 +47,7 @@ static int loop(CURLM *cm, const char* url, const char* userpwd)
fd_set
R
,
W
,
E
;
struct
timeval
T
;
init
(
cm
,
url
,
userpwd
);
init
(
cm
,
url
,
userpwd
,
headers
);
while
(
U
)
{
while
(
CURLM_CALL_MULTI_PERFORM
==
curl_multi_perform
(
cm
,
&
U
));
...
...
@@ -102,18 +107,30 @@ static int loop(CURLM *cm, const char* url, const char* userpwd)
int
test
(
char
*
URL
)
{
CURLM
*
cm
;
struct
curl_slist
*
headers
=
NULL
;
char
buffer
[
246
];
/* naively fixed-size */
if
(
test_argc
<
4
)
return
99
;
sprintf
(
buffer
,
"Host: %s"
,
HOST
);
/* now add a custom Host: header */
headers
=
curl_slist_append
(
headers
,
buffer
);
curl_global_init
(
CURL_GLOBAL_ALL
);
cm
=
curl_multi_init
();
loop
(
cm
,
URL
,
PROXYUSERPWD
);
loop
(
cm
,
URL
,
PROXYUSERPWD
,
headers
);
fprintf
(
stderr
,
"lib540: now we do the request again
\n
"
);
loop
(
cm
,
URL
,
PROXYUSERPWD
);
loop
(
cm
,
URL
,
PROXYUSERPWD
,
headers
);
curl_multi_cleanup
(
cm
);
curl_global_cleanup
();
curl_slist_free_all
(
headers
);
return
EXIT_SUCCESS
;
}
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