bryancall opened a new pull request, #12768:
URL: https://github.com/apache/trafficserver/pull/12768

   ## Summary
   When a plugin or internal code modifies the Host header via MIME layer 
functions (e.g., `mime_field_value_set`), the HTTPHdr cached host info becomes 
stale. The cached `m_host_length` doesn't match the new value, causing 
`host_get()` to return incorrect data with garbage characters appended.
   
   **Symptom**: SNI warnings in diags.log showing garbage characters appended 
to hostnames:
   ```
   WARNING: SNI (mysterio.yahoo.com^R) not in certificate
   WARNING: SNI (mysterio.yahoo.compYpeZhV) not in certificate
   ```
   
   ## Root Cause
   HTTPHdr caches host info in `_fill_target_cache()` but MIME layer 
modifications bypass HTTPHdr, leaving `m_target_cached` true with stale 
`m_host_length`.
   
   ## Fix
   Detect staleness by caching both the host value pointer and raw length. On 
access, compare current MIMEField values against cached values. If either 
differs, the value was modified and we refill the cache.
   
   This approach:
   - Keeps cache logic entirely within HTTPHdr (clean separation)
   - Doesn't modify MIMEHdrImpl (safe for disk cache format)
   - Detects all modification paths including plugin API calls
   
   ## Testing
   Added comprehensive unit tests covering host header modifications with 
various scenarios including port handling (47 assertions).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to