Skip to content

[fix-finder] Remove stale bare // TODO and dead code in AuthDigestSession.HA2 method #11400

@github-actions

Description

@github-actions

Problem

AuthDigestSession.cs contains a bare // TODO comment (no description, no issue reference) with dead commented-out code inside an empty if block. This has been there since the file was adapted from Mono's System.Net.DigestClient and serves no purpose — the block does nothing at runtime.

Location

  • File: src/Mono.Android/Xamarin.Android.Net/AuthDigestSession.cs
  • Lines: 116–119

Current Code

string? HA2 (HttpURLConnection webRequest)
{
    var uri = new Uri (webRequest.URL?.ToString ()!);
    string ha2 = $"{webRequest.RequestMethod}:{uri.PathAndQuery}";
    if (QOP == "auth-int") {
        // TODO
        // ha2 += String.Format (":{0}", hentity);
    }
    return HashToHexString (ha2);
}

Suggested Fix

Remove the empty if (QOP == "auth-int") block entirely (including the bare // TODO and commented-out code) and add a brief comment explaining that auth-int QOP is not supported. The block currently does nothing — auth-int QOP silently falls through to the same behavior as auth mode. RFC 7616 auth-int requires hashing the entity body which is not available at this point, and auth-int is extremely rarely used by servers in practice.

string? HA2 (HttpURLConnection webRequest)
{
    var uri = new Uri (webRequest.URL?.ToString ()!);
    string ha2 = $"{webRequest.RequestMethod}:{uri.PathAndQuery}";
    // Note: auth-int QOP (RFC 7616) is not supported; it would require
    // hashing the entity body which is not available here.
    return HashToHexString (ha2);
}

Guidelines

  • Keep the existing formatting style (tabs, Mono style braces)
  • Do not change any other code in the file — this is a minimal dead code removal
  • Do not add #nullable enable or fix other issues in this PR (keep it focused)

Acceptance Criteria

  • The bare // TODO comment on line 117 is removed
  • The commented-out dead code on line 118 is removed
  • The empty if (QOP == "auth-int") block (lines 116–119) is removed
  • A brief comment is added explaining that auth-int QOP is not supported
  • All tests pass
  • No new warnings introduced

Generated by Nightly Fix Finder · ● 2.6M ·

  • expires on May 25, 2026, 9:44 PM UTC

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions