Skip to content

Conversation

u5surf
Copy link
Collaborator

@u5surf u5surf commented Jul 18, 2025

Summary

  • Add conditional compilation to handle different request timing fields between nginx and freenginx
  • For freenginx: use r->start_time (unified millisecond timestamp)
  • For nginx: use r->start_sec and r->start_msec (separate fields)
  • Fixes compilation error: 'ngx_http_request_t' has no member named 'start_msec'

Problem

The VTS module failed to build with freenginx because it used r->start_msec which doesn't exist in freenginx. Freenginx has consolidated the timing fields into a single start_time field.

Solution

Added conditional compilation to handle both nginx variants:

#ifdef FREENGINX_VERSION
    ms = (ngx_msec_int_t)(tp->sec * 1000 + tp->msec - r->start_time);
#else
    ms = (ngx_msec_int_t)
             ((tp->sec - r->start_sec) * 1000 + (tp->msec - r->start_msec));
#endif

Test plan

  • Successfully builds with standard nginx (tested)
  • Test with freenginx build
  • Verify timing calculations work correctly in both environments
  • Run existing test suite

🤖 Generated with Claude Code

@u5surf u5surf requested a review from Copilot July 18, 2025 22:28
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 adds compatibility support for the freenginx web server by implementing conditional compilation to handle different request timing field structures between nginx and freenginx. The change resolves a compilation error where freenginx doesn't have the start_msec field that nginx uses.

  • Adds conditional compilation using FREENGINX_VERSION macro to differentiate between nginx and freenginx builds
  • Implements different timing calculation logic for each server variant
  • Maintains backward compatibility with existing nginx installations

- Add conditional compilation to handle different request timing fields
- For freenginx: use r->start_time (unified millisecond timestamp)
- For nginx: use r->start_sec and r->start_msec (separate fields)
- Fixes compilation error: 'ngx_http_request_t' has no member named 'start_msec'

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@u5surf u5surf force-pushed the fix-freenginx-compatibility branch from 27c1e50 to 5b66586 Compare July 18, 2025 23:33
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