You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
forgejo/routers
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>
3 years ago
..
admin Update docs and comments to remove macaron (#14491) 3 years ago
api/v1 [API] GetRelease by tag only return release (#14397) 3 years ago
dev Display ui time with customize time location (#7792) 5 years ago
events Add EventSource support (#11235) 4 years ago
org Move macaron to chi (#14293) 3 years ago
private Move macaron to chi (#14293) 3 years ago
repo Add Content-Length header to HEAD requests (#14542) 3 years ago
routes Adding Chi's GetHead middleware (#14541) 3 years ago
user Honor REGISTER_MANUAL_CONFIRM when doing openid registration (#14548) 3 years ago
utils Return the full rejection message and errors in flash errors (#13221) 4 years ago
home.go [Feature] add precise search type for Elastic Search (#12869) 3 years ago
init.go Print usefull error if SQLite is used in settings but not supported (#14476) 3 years ago
install.go Move middlewares to web/middleware (#14480) 3 years ago
metrics.go Move metrics from macaron to chi (#13601) 4 years ago
swagger_json.go Move macaron to chi (#14293) 3 years ago