-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Use route rather than use thus reducing the number of stack frames #15301
Conversation
Simplify the web.go FCGI path by moving the req.URL.Path fix-up to listener Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
…stack Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
// this png is very likely to always be below the limit for gzip so it doesn't need to pass through gzip | ||
routes.Get("/apple-touch-icon.png", func(w http.ResponseWriter, req *http.Request) { | ||
http.Redirect(w, req, path.Join(setting.StaticURLPrefix, "img/apple-touch-icon.png"), 301) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can probably nuke that route and make it use a <link>
tag to directly link to the image. I recall this route was only there for some edge case with Firefox, but it should be favoring the SVG icon over this one nowadays.
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Make lgtm work |
after upgrading to this the user-specified avatars won't load.. I'm not sure if that's intentional, it's potentially EDIT: org avatars won't load at all (no matter if user-specified or gravatar) |
Not intentional at all - I thought I'd tested all of this. It might be that it's reverted your recent fix as this was written before it. Do you remember your pr that fixed things? |
No worries.
There was this thing with assets, should I check that? |
looks like custom css still works fine and so do custom so the answer is I don't recal what PR could be the partial cause other than the assets one @zeripath
I am all for it. prometheus metrics look fine, though :D |
Unfortunately there was quite a few prs between this being written and it getting approved - I bet something to do with the assets move is the cause. I should have rechecked before merging. I do think this is really worth doing so fixing the problem rather than reverting this pr should be the aim. |
I have done a quick write-up of the issue so that I don't pollute this PR anymore |
There was a missing * from the avatars routes in go-gitea#15301. Fix go-gitea#15727 Signed-off-by: Andrew Thornton <art27@cantab.net>
Since the move to Chi the number of stack frames has proliferated somewhat catastrophically and we're up to 96 frames with multiple tests of the url outside of a trie which is inefficient.
This PR reduces the number of stack frames by 6 through careful use of Route, moves Captcha into its own router so that it only fires on Captcha routes, similarly for avatars and repo-avatars.
The
robots.txt
,/
andapple-touch-icon.png
are moved out of requiring Contexter.It moves access logger higher in the stack frame because there is no reason why it can't be higher.
Extract from #15186
Contains #15292