luckyframework / lucky

A full-featured Crystal web framework that catches bugs for you, runs incredibly fast, and helps you write code that lasts.
https://luckyframework.org
MIT License
2.57k stars 156 forks source link

Investigate closing the response during redirect #1735

Closed jwoertink closed 1 year ago

jwoertink commented 1 year ago

Coming in Crystal 1.7, the HTTP Response will have a built-in redirect method https://github.com/crystal-lang/crystal/pull/12526 I noticed on this PR that after setting the status and header close is called.... I always see these IO errors in my Lucky apps and now I'm wondering if it's because we don't close the response after doing a redirect.

We can see about just adding a context.response.close after the status and header are added, then after Crystal 1.7 is out, we can slowly deprecate away the old code.

https://github.com/luckyframework/lucky/blob/e167dc59093742c4baa72038fbc2b682f3c36f70/src/lucky/redirectable.cr#L121-L126