-
-
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
Fix HEAD method for robots.txt #30603
Conversation
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.
HEAD requests by definition should not have a body, e.g. no Content-Length
or Content-Length: 0
only. As per MDN:
Warning: A response to a HEAD method should not have a body. If it has one anyway, that body must be ignored: any representation headers that might describe the erroneous body are instead assumed to describe the response which a similar GET request would have received.
Are you sure? Would you like to learn it first before putting a change request? https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD |
Ah, |
@wxiaoguang why are you dismissing without answering my question? That's rude. |
I think the question has been answered and the concern has been addressed. All are standard. |
Ok, I think we should enable HEAD methods on all these GET methods defined in |
Actually no. Because most dynamic route handlers do not support HEAD. Golang standard library only handles "file serving". |
Blocks should be dismissed by their author only, unless the author is unresponsive, then it's fine when someone else dismisses it. |
Yeah, it would be needed to be coded there. But I see we can maybe enable it for |
TBH I was a little unhappy about that change request, I also felt a little rude of it too. Because, it seems that you didn't really look into it (your referred document also said the "content-length" could exist). Hopefully you could also understand my feeling.
If and only if the handlers really support HEAD method. |
My conclusion is that it's a waste of server resources to send So a proper HEAD implementation would be a custom implementation and not that wasteful thing that golang does. |
Backport #30603 by @wxiaoguang Fix #30601 ``` ~$ curl --head localhost:3000/robots.txt HTTP/1.1 200 OK Accept-Ranges: bytes Cache-Control: max-age=0, private, must-revalidate Content-Length: 5 Content-Type: text/plain; charset=utf-8 Last-Modified: Wed, 19 Jul 2023 04:56:12 GMT X-Gitea-Debug: RUN_MODE=dev Date: Fri, 19 Apr 2024 12:59:44 GMT ``` Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* giteaofficial/main: [skip ci] Updated licenses and gitignores Use correct hash for "git update-index" (go-gitea#30626) Fix repo home UI when there is no repo description (go-gitea#30552) Fix dropdown text ellipsis (go-gitea#30628) fix(api): refactor branch and tag existence checks (go-gitea#30618) Add --skip-db option to dump command (go-gitea#30613) Fix flash on dashboard (go-gitea#30572) chore: use errors.New to replace fmt.Errorf with no parameters will much better (go-gitea#30621) Fix issue comment form and quick-submit (go-gitea#30623) Use maintained gziphandler (go-gitea#30592) [skip ci] Updated translations via Crowdin Fix package list performance (go-gitea#30520) Clarify permission "HasAccess" behavior (go-gitea#30585) Fix links in PyPI Simple Repository API page (go-gitea#30594) Use action user as the trigger user of schedules (go-gitea#30581) Fix commit file status parser (go-gitea#30602) Fix HEAD method for robots.txt (go-gitea#30603)
Fix #30601