not support "HEAD" http request #3870

Closed
opened 2025-11-02 05:29:02 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @gonboy on GitHub (Aug 29, 2019).

sometime, I want use gitea as file web server.
so need to download it. if not support HEAD to get the file size.
so can't calc the left time

Originally created by @gonboy on GitHub (Aug 29, 2019). sometime, I want use gitea as file web server. so need to download it. if not support HEAD to get the file size. so can't calc the left time
GiteaMirror added the type/proposalissue/confirmed labels 2025-11-02 05:29:02 -06:00
Author
Owner

@sapk commented on GitHub (Aug 29, 2019):

Can you provide a example url on try.gitea ?

@sapk commented on GitHub (Aug 29, 2019): Can you provide a example url on try.gitea ?
Author
Owner

@bwenrich commented on GitHub (Sep 1, 2019):

If I understand correctly, the intention is to determine the size of the object that would be sent, so a client application could generate a progress-bar of the download progress.

My quick testing shows that Gitea didn't provide the "Content-Length" attribute in the HTTP response header, so the client does not know the response size in advance.

# Example from an arbitrary file on try.gitea.io
$ curl --head https://try.gitea.io/gitea/gitea/src/branch/master/README.md
HTTP/2 200
content-type: text/html; charset=UTF-8
date: Sun, 01 Sep 2019 03:01:40 GMT
set-cookie: lang=en-US; Path=/; Max-Age=2147483647
set-cookie: i_like_gitea=<<removed>>; Path=/; HttpOnly
set-cookie: _csrf=<<removed>>; Path=/; Expires=Mon, 02 Sep 2019 03:01:40 GMT; HttpOnly
x-frame-options: SAMEORIGIN
# Example from a generic Apache server
$ curl --head https://domain.example.com/README.md
HTTP/1.1 200 OK
Date: Sun, 01 Sep 2019 03:04:17 GMT
Last-Modified: Sun, 18 Aug 2019 02:25:17 GMT
Accept-Ranges: bytes
Content-Length: 5934
content-type: text/html; charset=UTF-8

The Content-Length attribute is not mandatory for HTTP HEAD or HTTP GET, but could be useful in some cases.

@bwenrich commented on GitHub (Sep 1, 2019): If I understand correctly, the intention is to determine the size of the object that would be sent, so a client application could generate a progress-bar of the download progress. My quick testing shows that Gitea didn't provide the "Content-Length" attribute in the HTTP response header, so the client does not know the response size in advance. ``` # Example from an arbitrary file on try.gitea.io $ curl --head https://try.gitea.io/gitea/gitea/src/branch/master/README.md HTTP/2 200 content-type: text/html; charset=UTF-8 date: Sun, 01 Sep 2019 03:01:40 GMT set-cookie: lang=en-US; Path=/; Max-Age=2147483647 set-cookie: i_like_gitea=<<removed>>; Path=/; HttpOnly set-cookie: _csrf=<<removed>>; Path=/; Expires=Mon, 02 Sep 2019 03:01:40 GMT; HttpOnly x-frame-options: SAMEORIGIN ``` ``` # Example from a generic Apache server $ curl --head https://domain.example.com/README.md HTTP/1.1 200 OK Date: Sun, 01 Sep 2019 03:04:17 GMT Last-Modified: Sun, 18 Aug 2019 02:25:17 GMT Accept-Ranges: bytes Content-Length: 5934 content-type: text/html; charset=UTF-8 ``` The Content-Length attribute is not mandatory for HTTP HEAD or HTTP GET, but could be useful in some cases.
Author
Owner

@stale[bot] commented on GitHub (Oct 31, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Oct 31, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@6543 commented on GitHub (Feb 5, 2021):

did https://github.com/go-gitea/gitea/pull/14541 close this issue?

@6543 commented on GitHub (Feb 5, 2021): did https://github.com/go-gitea/gitea/pull/14541 close this issue?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3870