Skip to content

Fix truncated HTTP version in log field unmarshalling#13236

Open
masaori335 wants to merge 2 commits into
apache:masterfrom
masaori335:asf-master-fix-log-http-version
Open

Fix truncated HTTP version in log field unmarshalling#13236
masaori335 wants to merge 2 commits into
apache:masterfrom
masaori335:asf-master-fix-log-http-version

Conversation

@masaori335
Copy link
Copy Markdown
Contributor

I found LogAccess::unmarshal_http_version has a bug, it's truncated - e.g. "HTTP/1." instead of "HTTP/1.1".
This affects only sshv and csshv. (Clarification: cqpv and sqpv are not affected)

Also, remove several unused marshal/unmarshal functions.

unmarshal_http_version did not advance the buffer pointer past the
minor-version digits before computing the output length, so logged
HTTP versions dropped the minor number ("HTTP/1." instead of
"HTTP/1.1"). This is a regression from apache#11437, which changed val_len
to a pointer subtraction without advancing past the second integer.
These functions have no callers, and several are declared without
ever being defined; none are paired with a log field:

- unmarshal_http_text: no marshal counterpart; referenced only by
  its own declaration and (former) definition.
- marshal_milestone_fmt_squid/_netscape/_date/_time: declared but
  never defined. Only _fmt_sec and _fmt_ms are implemented and used;
  the date/time/netscape/squid formatting happens at unmarshal time.
- unmarshal_client_protocol_stack: declared but never defined or
  wired into any log field.
@masaori335 masaori335 self-assigned this Jun 4, 2026
Copilot AI review requested due to automatic review settings June 4, 2026 01:15
@masaori335 masaori335 added this to the 11.0.0 milestone Jun 4, 2026
Copy link
Copy Markdown
Contributor

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 fixes a log unmarshalling bug in Apache Traffic Server’s logging subsystem where LogAccess::unmarshal_http_version() could truncate the HTTP minor version (e.g. producing HTTP/1. instead of HTTP/1.1), impacting the sshv/csshv log fields. It also removes unused marshal/unmarshal APIs to keep LogAccess leaner.

Changes:

  • Fix LogAccess::unmarshal_http_version() to correctly advance the write pointer after unmarshalling the minor version.
  • Add a unit test that validates the unmarshalled HTTP version preserves both major and minor components.
  • Remove unused LogAccess marshal/unmarshal declarations (and remove the unused unmarshal_http_text() implementation).

Reviewed changes

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

File Description
src/proxy/logging/unit-tests/test_LogAccess.cc Adds a regression test ensuring unmarshal_http_version() renders HTTP/<major>.<minor> without truncation.
src/proxy/logging/LogAccess.cc Fixes the truncation bug by advancing p after writing the minor version; removes unused unmarshal_http_text() implementation.
include/proxy/logging/LogAccess.h Removes unused marshal/unmarshal declarations from the LogAccess interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants