Skip to content

fix: narrow exception in Content-Length header lookup from Exception to AttributeError - #3918

Open
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/content-length-narrow-exception
Open

fix: narrow exception in Content-Length header lookup from Exception to AttributeError#3918
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/content-length-narrow-exception

Conversation

@Quratulain-bilal

Copy link
Copy Markdown
Contributor

Problem

Bare except Exception would swallow MemoryError, RecursionError, etc.

Fix

Narrow to AttributeError which is the only realistic failure from getheader().

Testing

  • Verified Content-Length header is read correctly

  • Verified missing header is handled gracefully

…to AttributeError

Bare 'except Exception' would swallow MemoryError, RecursionError,
etc. The only realistic failure from getheader() is AttributeError.
@Quratulain-bilal
Quratulain-bilal requested a review from mnriem as a code owner July 31, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant