Skip to content

Conversation

@davlgd
Copy link
Contributor

@davlgd davlgd commented Nov 17, 2025

This PR removes the "skip gzip if static file" behavior by adding two features:

  • If content was precompressed, serves the .gz variant
  • If gzip compression is enabled and file under a thresold, lazy compression
    • It's compressed one
    • After that it's served as precompressed files

I've added tests and a documentation example for this. Feel free to tell me if you need some adjusments or a different behavior

Fix #20859

@davlgd davlgd force-pushed the davlgd-veb-static-gzip branch from 01439a6 to 4694483 Compare November 17, 2025 12:03
@davlgd
Copy link
Contributor Author

davlgd commented Nov 17, 2025

@spytheman Thanks for the review. I've implemented fixes in dedicated commits to make it easier for you to see changes, I'll squash when it will be ok for you.

  • 1 commits for minor changes
  • 1 commit for read-only management

Let me know if you see any better way to test read-only for windows (I don't have a Windows system here to check)

@davlgd davlgd requested a review from spytheman November 17, 2025 12:06
@spytheman
Copy link
Member

@davlgd thank you 🙇🏻 .

I'll squash when it will be ok for you.

There is no need to squash them manually, the repo is set to squash changes automatically before they are merged in master.

@spytheman
Copy link
Member

Let me know if you see any better way to test read-only for windows (I don't have a Windows system here to check)

Skipping the readonly test on windows (as you did) is perfectly fine and acceptable - most people will not run web servers on that OS, and will probably not have a readonly filesystem either.

@davlgd davlgd force-pushed the davlgd-veb-static-gzip branch from 4694483 to 9884cdd Compare November 17, 2025 13:40
@davlgd davlgd requested a review from spytheman November 18, 2025 17:02
* master:
  cgen: fix dump(ptr_to_fixed_array_value) - it now returns the argument directly (thanks @tankf33der) (vlang#25764)
  type_resolver: clear option flag if present in comptime $for (fix vlang#25761) (vlang#25763)
  db.sqlite: update windows version to https://sqlite.org/2025/sqlite-amalgamation-3510000.zip (vlang#25766)
  builder,pref: add  `-file-list` support (implement feature vlang#25707) (vlang#25749)
  transformer: transform ArrayInit into a function call for C and native backends (part 1)
  doc: cleanup grammar issues in doc/docs.md
  parser: allow using `a`, `b` and `it` as var names, when using the builtin array methods (fix vlang#25729) (vlang#25755)
  v.builder: improve diagnostic information for a failed build_thirdparty_obj_file
  veb: fix gzip middleware decode/encode (fix vlang#20865) (fix vlang#25753) (vlang#25754)
  strconv: fix handling of subnormal numbers like `'1.23e-308'.f64()` (fix vlang#25751) (vlang#25752)
  crypto.blake2b,crypto.blake2s: add `@[direct_array_access]` to hot functions (vlang#25750)
Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

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

Excellent work @davlgd .
Thank you very much 🙇🏻 .

@spytheman spytheman merged commit a51e6e0 into vlang:master Nov 19, 2025
82 of 96 checks passed
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.

x.vweb: add gzip compression support for static files

2 participants