Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
8a3360d1
Commit
8a3360d1
authored
Mar 12, 2012
by
Martin Storsjö
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
httpauth: Parse the stale field in digest auth
Signed-off-by:
Martin Storsjö
<
martin@martin.st
>
parent
7103c835
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
httpauth.c
libavformat/httpauth.c
+10
-0
httpauth.h
libavformat/httpauth.h
+7
-0
No files found.
libavformat/httpauth.c
View file @
8a3360d1
...
...
@@ -57,6 +57,9 @@ static void handle_digest_params(HTTPAuthState *state, const char *key,
}
else
if
(
!
strncmp
(
key
,
"qop="
,
key_len
))
{
*
dest
=
digest
->
qop
;
*
dest_len
=
sizeof
(
digest
->
qop
);
}
else
if
(
!
strncmp
(
key
,
"stale="
,
key_len
))
{
*
dest
=
digest
->
stale
;
*
dest_len
=
sizeof
(
digest
->
stale
);
}
}
...
...
@@ -93,6 +96,7 @@ void ff_http_auth_handle_header(HTTPAuthState *state, const char *key,
state
->
auth_type
<=
HTTP_AUTH_BASIC
)
{
state
->
auth_type
=
HTTP_AUTH_BASIC
;
state
->
realm
[
0
]
=
0
;
state
->
stale
=
0
;
ff_parse_key_value
(
p
,
(
ff_parse_key_val_cb
)
handle_basic_params
,
state
);
}
else
if
(
av_stristart
(
value
,
"Digest "
,
&
p
)
&&
...
...
@@ -100,10 +104,13 @@ void ff_http_auth_handle_header(HTTPAuthState *state, const char *key,
state
->
auth_type
=
HTTP_AUTH_DIGEST
;
memset
(
&
state
->
digest_params
,
0
,
sizeof
(
DigestParams
));
state
->
realm
[
0
]
=
0
;
state
->
stale
=
0
;
ff_parse_key_value
(
p
,
(
ff_parse_key_val_cb
)
handle_digest_params
,
state
);
choose_qop
(
state
->
digest_params
.
qop
,
sizeof
(
state
->
digest_params
.
qop
));
if
(
!
av_strcasecmp
(
state
->
digest_params
.
stale
,
"true"
))
state
->
stale
=
1
;
}
}
else
if
(
!
strcmp
(
key
,
"Authentication-Info"
))
{
ff_parse_key_value
(
value
,
(
ff_parse_key_val_cb
)
handle_digest_update
,
...
...
@@ -237,6 +244,9 @@ char *ff_http_auth_create_response(HTTPAuthState *state, const char *auth,
{
char
*
authstr
=
NULL
;
/* Clear the stale flag, we assume the auth is ok now. It is reset
* by the server headers if there's a new issue. */
state
->
stale
=
0
;
if
(
!
auth
||
!
strchr
(
auth
,
':'
))
return
NULL
;
...
...
libavformat/httpauth.h
View file @
8a3360d1
...
...
@@ -41,6 +41,9 @@ typedef struct {
char
opaque
[
300
];
/**< A server-specified string that should be
* included in authentication responses, not
* included in the actual digest calculation. */
char
stale
[
10
];
/**< The server indicated that the auth was ok,
* but needs to be redone with a new, non-stale
* nonce. */
int
nc
;
/**< Nonce count, the number of earlier replies
* where this particular nonce has been used. */
}
DigestParams
;
...
...
@@ -62,6 +65,10 @@ typedef struct {
* The parameters specifiec to digest authentication.
*/
DigestParams
digest_params
;
/**
* Auth ok, but needs to be resent with a new nonce.
*/
int
stale
;
}
HTTPAuthState
;
void
ff_http_auth_handle_header
(
HTTPAuthState
*
state
,
const
char
*
key
,
...
...
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