Embassy icon indicating copy to clipboard operation
Embassy copied to clipboard

Empty request data is never read

Open ilyapuchka opened this issue 7 years ago • 2 comments

When POST request is received by the server it is natural to attempt to read its body data. But when no data is sent or empty data is sent in request body then data reader closure is never called resulting in request never complete. There is no other way except attempting to read data to know if any data is sent at all. https://github.com/envoy/Embassy/pull/65 adds test that demonstrates this issue

ilyapuchka avatar Nov 22 '18 20:11 ilyapuchka

environ["HTTP_CONTENT_LENGTH"] is nil when there is no request body:

if environ["HTTP_CONTENT_LENGTH"] != nil {
    DataReader.read(input) { data in
        ...
        handler()
    }
} else {
    handler()
}

sa-spag avatar Jan 14 '19 17:01 sa-spag

good thankyou

kunimei avatar Feb 19 '23 15:02 kunimei