Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RELIC: Implement Lazy Loading for Header Parsing to Avoid Unnecessary Validation #10

Open
klkucaj opened this issue Dec 9, 2024 · 0 comments · May be fixed by #17
Open

RELIC: Implement Lazy Loading for Header Parsing to Avoid Unnecessary Validation #10

klkucaj opened this issue Dec 9, 2024 · 0 comments · May be fixed by #17
Assignees
Labels
enhancement New feature or request

Comments

@klkucaj
Copy link
Collaborator

klkucaj commented Dec 9, 2024

Is your feature request related to a problem? Please describe.
Currently, headers such as Accept-Language are parsed and validated eagerly, even if the request handler does not actually read or use them. This can lead to unnecessary rejections of requests with invalid headers, even though those headers are irrelevant to the processing logic. This behavior might not align with how other server frameworks handle unused headers, as they may only parse or validate headers on demand.

Describe the solution you'd like
Implement lazy loading for header parsing and validation. Instead of parsing all headers upfront, headers should only be parsed or validated when explicitly accessed by the request handler. This approach can:

  • Improve performance by skipping unnecessary work.
  • Avoid rejecting requests for irrelevant headers.
  • Provide behavior more in line with other server frameworks.

Describe alternatives you've considered

  1. Eager Parsing with Error Suppression: Continue parsing headers eagerly but suppress validation errors for unused headers. However, this might lead to silent failures and make debugging harder.
  2. Selective Parsing via Configuration: Allow developers to configure which headers to validate. This adds complexity and requires developers to be proactive about configurations.

Additional context
The current behavior raises questions about the wisdom of rejecting requests based on irrelevant headers. This issue aligns with making the framework more efficient and user-friendly. Lazy loading is a common pattern used in many frameworks to avoid unnecessary overhead.

Feedback: serverpod/serverpod#2744 (comment)

@klkucaj klkucaj added the enhancement New feature or request label Dec 9, 2024
@SandPod SandPod transferred this issue from serverpod/serverpod Dec 16, 2024
@SandPod SandPod moved this to Next 🌟 in Serverpod Roadmap Dec 16, 2024
@SandPod SandPod moved this from Next 🌟 to Now 🔥 in Serverpod Roadmap Dec 18, 2024
@SandPod SandPod moved this to Now 🔥 in Relic Roadmap Dec 18, 2024
@klkucaj klkucaj self-assigned this Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Now 🔥
Development

Successfully merging a pull request may close this issue.

1 participant