Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions csharp/autogen/src/HTTP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -570,19 +570,19 @@ private static void AuthenticateProxy(ref Stream stream, Uri uri, IWebProxy prox
throw new ProxyServerAuthenticationException("Stale nonce in Digest authentication attempt.");
break;
case "realm=":
authenticationFieldReply += $", realm=\"{directives[++i]}\"";
authenticationFieldReply += string.Format(", realm=\"{0}\"", directives[++i]);
realm = directives[i];
break;
case "nonce=":
authenticationFieldReply += $", nonce=\"{directives[++i]}\"";
authenticationFieldReply += string.Format(", nonce=\"{0}\"", directives[++i]);
nonce = directives[i];
break;
case "opaque=":
authenticationFieldReply += $", opaque=\"{directives[++i]}\"";
authenticationFieldReply += string.Format(", opaque=\"{0}\"", directives[++i]);
opaque = directives[i];
break;
case "algorithm=":
authenticationFieldReply += $", algorithm={directives[++i]}"; //unquoted; see RFC7616-3.4
authenticationFieldReply += string.Format(", algorithm={0}", directives[++i]); //unquoted; see RFC7616-3.4
algorithm = directives[i];
break;
case "qop=":
Expand All @@ -593,19 +593,19 @@ private static void AuthenticateProxy(ref Stream stream, Uri uri, IWebProxy prox
qops.FirstOrDefault(q => q.ToLowerInvariant() == "auth-int") ??
throw new ProxyServerAuthenticationException(
"Digest authentication's quality-of-protection directive is not supported.");
authenticationFieldReply += $", qop={qop}"; //unquoted; see RFC7616-3.4
authenticationFieldReply += string.Format(", qop={0}", qop); //unquoted; see RFC7616-3.4
}
break;
}
}

string clientNonce = GenerateNonce();
if (qop != null)
authenticationFieldReply += $", cnonce=\"{clientNonce}\"";
authenticationFieldReply += string.Format(", cnonce=\"{0}\"", clientNonce);

string nonceCount = "00000001"; // todo: track nonces and their corresponding nonce counts
if (qop != null)
authenticationFieldReply += $", nc={nonceCount}"; //unquoted; see RFC7616-3.4
authenticationFieldReply += string.Format(", nc={0}", nonceCount); //unquoted; see RFC7616-3.4

Func<string, string> algFunc;
var scratch1 = string.Join(":", credentials.UserName, realm, credentials.Password);
Expand Down Expand Up @@ -643,7 +643,7 @@ private static void AuthenticateProxy(ref Stream stream, Uri uri, IWebProxy prox
: new[] {HA1, nonce, nonceCount, clientNonce, qop, HA2};
var response = algFunc(string.Join(":", array3));

authenticationFieldReply += $", response=\"{response}\"";
authenticationFieldReply += string.Format(", response=\"{0}\"", response);

WriteLine(header, stream);
WriteLine(authenticationFieldReply, stream);
Expand Down