0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-15 22:41:44 +01:00
gitea/routers/repo
Farid AYOUJIL f72ce26326
Add Content-Length header to HEAD requests (#14542)
* Add Content-Length header to HEAD requests

This change adds the header Content-Length to HEAD HTTP requests.

The previous behaviour was blocking some Windows executables (i.e
bitsadmin.exe) from downloading files hosted in Gitea.

This along with PR #14541, makes the web server compliant with HTTP RFC 2616 which states
"The methods GET and HEAD MUST be supported by all general-purpose servers"
and
"The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response."

This should also respond to issues #8030 and #14532.

* This change adds the header Content-Length to HEAD HTTP requests

Pass the Size of the content as a parameter to ServeData() instead of
calculating it using ioutil.ReadAll(reader) --> this call is dangerous
and can result in a denial of service.

* Add Content-Length header to HEAD requests

Quick fix for imported dependency not used.

* Check if size is positiv int ...

Co-authored-by: zeripath <art27@cantab.net>
2021-02-05 21:10:40 +01:00
..
activity.go Add top author stats to activity page (#9615) 2020-01-20 12:07:30 +02:00
attachment.go Add Content-Length header to HEAD requests (#14542) 2021-02-05 21:10:40 +01:00
blame.go Show dropdown with all statuses for commit (#13977) 2020-12-20 11:13:12 +08:00
branch.go [API] Add pagination to ListBranches (#14524) 2021-02-03 20:06:13 +01:00
commit.go Show dropdown with all statuses for commit (#13977) 2020-12-20 11:13:12 +08:00
compare.go [API] Add pagination to ListBranches (#14524) 2021-02-03 20:06:13 +01:00
download.go Add Content-Length header to HEAD requests (#14542) 2021-02-05 21:10:40 +01:00
editor.go enhancement: add signoff option in commit form (#14516) 2021-01-29 16:57:45 +08:00
editor_test.go Add Close() method to gogitRepository (#8901) 2019-11-13 07:01:19 +00:00
http.go Move macaron to chi (#14293) 2021-01-26 16:36:53 +01:00
issue.go [API] Add pagination to ListBranches (#14524) 2021-02-03 20:06:13 +01:00
issue_dependency.go Fix wrong permissions check when issues/prs shared operations (#9885) 2020-01-20 13:00:32 +01:00
issue_label.go Move macaron to chi (#14293) 2021-01-26 16:36:53 +01:00
issue_label_test.go Move macaron to chi (#14293) 2021-01-26 16:36:53 +01:00
issue_lock.go Move macaron to chi (#14293) 2021-01-26 16:36:53 +01:00
issue_stopwatch.go Display current stopwatch in navbar (#14122) 2021-01-21 15:51:52 +01:00
issue_test.go Refactor combine label comments with tests (#13619) 2020-11-20 17:29:09 -05:00
issue_timetrack.go Move macaron to chi (#14293) 2021-01-26 16:36:53 +01:00
issue_watch.go Fix PR/issue redirects when having external tracker (#9339) 2019-12-14 01:53:32 +01:00
lfs.go Display SVG files as images instead of text (#14101) 2021-01-12 22:45:19 -05:00
main_test.go Unit tests for wiki routers (#3022) 2017-11-30 17:52:15 +02:00
middlewares.go Add gitea-vet (#10948) 2020-04-05 07:20:50 +01:00
migrate.go Move macaron to chi (#14293) 2021-01-26 16:36:53 +01:00
milestone.go Move macaron to chi (#14293) 2021-01-26 16:36:53 +01:00
projects.go Move macaron to chi (#14293) 2021-01-26 16:36:53 +01:00
projects_test.go KanBan: be able to set default board (#14147) 2021-01-15 22:29:32 +02:00
pull.go Move middlewares to web/middleware (#14480) 2021-01-30 10:55:53 +02:00
pull_review.go Move macaron to chi (#14293) 2021-01-26 16:36:53 +01:00
release.go Move macaron to chi (#14293) 2021-01-26 16:36:53 +01:00
release_test.go Move macaron to chi (#14293) 2021-01-26 16:36:53 +01:00
repo.go Move macaron to chi (#14293) 2021-01-26 16:36:53 +01:00
search.go [Feature] add precise search type for Elastic Search (#12869) 2021-01-27 12:00:35 +02:00
setting.go Move macaron to chi (#14293) 2021-01-26 16:36:53 +01:00
setting_protected_branch.go Move macaron to chi (#14293) 2021-01-26 16:36:53 +01:00
settings_test.go Move macaron to chi (#14293) 2021-01-26 16:36:53 +01:00
topic.go Add API endpoint for accessing repo topics (#7963) 2019-09-03 23:46:24 +08:00
view.go Fix lfs file viewer (#14568) 2021-02-05 02:29:42 +01:00
webhook.go Move macaron to chi (#14293) 2021-01-26 16:36:53 +01:00
wiki.go Move macaron to chi (#14293) 2021-01-26 16:36:53 +01:00
wiki_test.go Move macaron to chi (#14293) 2021-01-26 16:36:53 +01:00