`response/xexpr` should respect `current-unescaped-tags`
Nobody has claimed this yet.
- Dominant language
- Racket
- Stars
- 99
- Forks
- 48
- PR merge metrics
- No merged PRs in 30d
Description
Because https://github.com/racket/web-server/blob/8d9c0f72bf4dd43784f50e810d8359d29485f6fd/web-server-lib/web-server/http/xexpr.rkt#L30 is a function, when it is called any parameterized change to current-unescaped-tags is completely ignored or must be set at a much more global level, which is undesirable.
Example:
(define (start req)
(parameterize ([current-unescaped-tags html-unescaped-tags])
(response/xexpr
`(html (head (script "let x = 1 < 2;"))))))
When run, the above will fail because it will convert the < to < when that isn't the intention. I'd recommend changing the output function to first capture - and then reuse - the value:
(let ([unescaped-tags (current-unescaped-tags)])
(λ (out)
(parameterize ([current-unescaped-tags unescaped-tags])
(write-bytes preamble out)
(write-xexpr xexpr out))))
But there may be something a bit lower level that could work as well.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at web-server-lib/web-server/http/xexpr.rkt around line 30 and inspect how response/xexpr captures current-unescaped-tags before invoking its output function. Reproduce the example from the issue, then verify that a parameterized current-unescaped-tags value is honored when the response is written.
Written by the indexing model from the issue text.
Assessment
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100