{"action":"created","issue":{"url":"https://api.github.com/repos/akka/akka-http/issues/377","repository_url":"https://api.github.com/repos/akka/akka-http","labels_url":"https://api.github.com/repos/akka/akka-http/issues/377/labels{/name}","comments_url":"https://api.github.com/repos/akka/akka-http/issues/377/comments","events_url":"https://api.github.com/repos/akka/akka-http/issues/377/events","html_url":"https://github.com/akka/akka-http/issues/377","id":181786700,"number":377,"title":"Allow access to Content-Length header in response to HEAD request","user":{"login":"filosganga","id":108663,"avatar_url":"https://avatars0.githubusercontent.com/u/108663?v=3","gravatar_id":"","url":"https://api.github.com/users/filosganga","html_url":"https://github.com/filosganga","followers_url":"https://api.github.com/users/filosganga/followers","following_url":"https://api.github.com/users/filosganga/following{/other_user}","gists_url":"https://api.github.com/users/filosganga/gists{/gist_id}","starred_url":"https://api.github.com/users/filosganga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/filosganga/subscriptions","organizations_url":"https://api.github.com/users/filosganga/orgs","repos_url":"https://api.github.com/users/filosganga/repos","events_url":"https://api.github.com/users/filosganga/events{/privacy}","received_events_url":"https://api.github.com/users/filosganga/received_events","type":"User","site_admin":false},"labels":[{"id":430145635,"url":"https://api.github.com/repos/akka/akka-http/labels/1%20-%20triaged","name":"1 - triaged","color":"5319e7","default":false},{"id":427494660,"url":"https://api.github.com/repos/akka/akka-http/labels/community","name":"community","color":"128A0C","default":false},{"id":436861101,"url":"https://api.github.com/repos/akka/akka-http/labels/t:client","name":"t:client","color":"cccccc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2016-10-07T23:22:10Z","updated_at":"2017-03-17T14:28:23Z","closed_at":null,"body":"According to the [HTTP headers documentation](http://doc.akka.io/docs/akka/2.4.11/scala/http/common/http-model.html#HTTP_Headers), the `Content-Length` header is not added to the response headers collection. It is part of the HTTP entity. \n\nIt seems to be a correct behaviour in case of a GET request. Unfortunately, it does not work at all in the case of a HEAD request. Some API (eg AWS S3) uses the HEAD request to obtain information about the GET request. In particular, the S3 API return the object `Content-Length` in response to a HEAD request.\n\nAccording to the HTTP specification:\n\n> The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. **The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request**. This method can be used for obtaining metainformation about the entity implied by the request without transferring the entity-body itself. This method is often used for testing hypertext links for validity, accessibility, and recent modification.\n\nI think the default behaviour should be to return all the response headers or at least be configurable.\n\nEDIT:\nI would like to describe the problem I am facing better. I would like to implement S3 client able to do a multipart download. It will be implemented by executing a set of GET request with the `Range` header to fetch a part of the object to download. \n\nTo implement this mechanism, I need to obtain the full object length as a first step. In S3 it is doable by making a HEAD request to the same object, that would return all the metadata for the object itself by mean of HTTP response headers, included the `Content-Length`.\n\nAkka HTTP client does strip the `Content-Length` header from the HTTP response in  [HttpMessageParser](https://github.com/akka/akka-http/blob/d0b7829dc6d7091cf106dd9b51c4980c82729e70/akka-http-core/src/main/scala/akka/http/impl/engine/parsing/HttpMessageParser.scala#L139) so it is impossible to access this information in any way.\n\nHope it will help.\n"},"comment":{"url":"https://api.github.com/repos/akka/akka-http/issues/comments/287368754","html_url":"https://github.com/akka/akka-http/issues/377#issuecomment-287368754","issue_url":"https://api.github.com/repos/akka/akka-http/issues/377","id":287368754,"user":{"login":"filosganga","id":108663,"avatar_url":"https://avatars0.githubusercontent.com/u/108663?v=3","gravatar_id":"","url":"https://api.github.com/users/filosganga","html_url":"https://github.com/filosganga","followers_url":"https://api.github.com/users/filosganga/followers","following_url":"https://api.github.com/users/filosganga/following{/other_user}","gists_url":"https://api.github.com/users/filosganga/gists{/gist_id}","starred_url":"https://api.github.com/users/filosganga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/filosganga/subscriptions","organizations_url":"https://api.github.com/users/filosganga/orgs","repos_url":"https://api.github.com/users/filosganga/repos","events_url":"https://api.github.com/users/filosganga/events{/privacy}","received_events_url":"https://api.github.com/users/filosganga/received_events","type":"User","site_admin":false},"created_at":"2017-03-17T14:28:23Z","updated_at":"2017-03-17T14:28:23Z","body":"@cheerx not really as I did not have any time. I will try to dedicate it some time next week."}}
{"actor":{"display_login":"filosganga"}}