Skip to content

Conversation

JosePineiro
Copy link

Refactor ETag generation to read CRC32 checksum from GZIP file trailer

  • Changed _getEtag() signature to accept File handle instead of byte array
  • Function now seeks to GZIP trailer and extracts CRC32 checksum
  • Added error handling for file operations (seek/read failures)
  • Returns boolean to indicate success/failure of ETag generation
  • Maintains same hex conversion logic for consistent ETag format
  • Simplifies code following DRY principle by eliminating duplicate read file

This refactoring maintains full backward compatibility

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors ETag generation for GZIP files to read the CRC32 checksum directly from the GZIP file trailer instead of requiring a separate byte array parameter. The refactor centralizes file operations within the _getEtag function and adds proper error handling while maintaining the same ETag format.

Key changes:

  • Modified _getEtag() function signature to accept a File handle and return boolean success status
  • Consolidated GZIP trailer reading logic into the _getEtag function with error handling
  • Updated calling code to use the new function signature and handle return status

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/ESPAsyncWebServer.h Updated _getEtag function signature to accept File parameter and return boolean
src/AsyncWebServerRequest.cpp Refactored _getEtag implementation to handle file operations internally with error handling
src/WebResponses.cpp Updated to use new _getEtag function and handle boolean return value
Comments suppressed due to low confidence (1)

@mathieucarbou
Copy link
Member

@JosePineiro could you please rebase and fix the conflicts in this PR ? I will merge it after, thanks!

@mathieucarbou mathieucarbou marked this pull request as draft August 4, 2025 18:53
@JosePineiro
Copy link
Author

@JosePineiro could you please rebase and fix the conflicts in this PR ? I will merge it after, thanks!

Please give me three days.

@mathieucarbou
Copy link
Member

@JosePineiro : some conflicts still remain ;-)

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.

2 participants