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
2c114258
Commit
2c114258
authored
21 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
first attempt to support stale=true
parent
a2ea0abf
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/http_digest.c
+30
-10
30 additions, 10 deletions
lib/http_digest.c
with
30 additions
and
10 deletions
lib/http_digest.c
+
30
−
10
View file @
2c114258
...
...
@@ -57,6 +57,7 @@ CURLdigest Curl_input_digest(struct connectdata *conn,
{
bool
more
=
TRUE
;
struct
SessionHandle
*
data
=
conn
->
data
;
bool
before
=
FALSE
;
/* got a nonce before */
/* skip initial whitespaces */
while
(
*
header
&&
isspace
((
int
)
*
header
))
...
...
@@ -65,6 +66,10 @@ CURLdigest Curl_input_digest(struct connectdata *conn,
if
(
checkprefix
(
"Digest"
,
header
))
{
header
+=
strlen
(
"Digest"
);
/* If we already have received a nonce, keep that in mind */
if
(
data
->
state
.
digest
.
nonce
)
before
=
TRUE
;
/* clear off any former leftovers and init to defaults */
Curl_digest_cleanup
(
data
);
...
...
@@ -82,6 +87,10 @@ CURLdigest Curl_input_digest(struct connectdata *conn,
if
(
strequal
(
value
,
"nonce"
))
{
data
->
state
.
digest
.
nonce
=
strdup
(
content
);
}
else
if
(
strequal
(
value
,
"stale"
))
{
if
(
strequal
(
content
,
"true"
))
data
->
state
.
digest
.
stale
=
TRUE
;
}
else
if
(
strequal
(
value
,
"cnonce"
))
{
data
->
state
.
digest
.
cnonce
=
strdup
(
content
);
}
...
...
@@ -106,7 +115,14 @@ CURLdigest Curl_input_digest(struct connectdata *conn,
/* allow the list to be comma-separated */
header
++
;
}
/* We had a nonce since before, and we got another one now without
'stale=true'. This means we provided bad credentials in the previous
request */
if
(
before
&&
!
data
->
state
.
digest
.
stale
)
return
CURLDIGEST_BAD
;
/* We got this header without a nonce, that's a bad Digest line! */
if
(
!
data
->
state
.
digest
.
nonce
)
return
CURLDIGEST_BAD
;
}
...
...
@@ -213,19 +229,23 @@ CURLcode Curl_output_digest(struct connectdata *conn,
void
Curl_digest_cleanup
(
struct
SessionHandle
*
data
)
{
if
(
data
->
state
.
digest
.
nonce
)
free
(
data
->
state
.
digest
.
nonce
);
data
->
state
.
digest
.
nonce
=
NULL
;
struct
digestdata
*
d
=
&
data
->
state
.
digest
;
if
(
d
->
nonce
)
free
(
d
->
nonce
);
d
->
nonce
=
NULL
;
if
(
d
->
cnonce
)
free
(
d
->
cnonce
);
d
->
cnonce
=
NULL
;
if
(
d
ata
->
state
.
digest
.
cnonce
)
free
(
d
ata
->
state
.
digest
.
cnonce
);
d
ata
->
state
.
digest
.
cnonce
=
NULL
;
if
(
d
->
realm
)
free
(
d
->
realm
);
d
->
realm
=
NULL
;
if
(
data
->
state
.
digest
.
realm
)
free
(
data
->
state
.
digest
.
realm
);
data
->
state
.
digest
.
realm
=
NULL
;
d
->
algo
=
CURLDIGESTALGO_MD5
;
/* default algorithm */
d
ata
->
sta
te
.
digest
.
algo
=
CURLDIGESTALGO_MD5
;
/* default algorithm
*/
d
->
sta
le
=
FALSE
;
/* default means normal, not stale
*/
}
#endif
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