http_response: fix move assign operator not moving file_info. #157
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue I've been experiencing, leading to an error with static file serving as the client will receive
net::ERR_CONTENT_LENGTH_MISMATCH
.My example project's main file:
The error happens because of this check failing to recognize that the given response is of static type:
https://github.com/CrowCpp/crow/blob/189e0709b14e2c782f9dd94609bfd3af1212e1df/include/crow/http_connection.h#L398-L403
The function
is_static_type
checks for apath
insidefile_info
which is set byset_static_file_info
:https://github.com/CrowCpp/crow/blob/189e0709b14e2c782f9dd94609bfd3af1212e1df/include/crow/http_response.h#L182-L185
The check returns
false
because after moving the response,file_info
isn't being moved along with it, leading to an emptypath
:https://github.com/CrowCpp/crow/blob/189e0709b14e2c782f9dd94609bfd3af1212e1df/include/crow/http_response.h#L84-L91
This is leading to a response with an empty body but a specific
Content-Length
being set, leading to the given error on the client's side.Signed-off-by: Luca Schlecker [email protected]