framework icon indicating copy to clipboard operation
framework copied to clipboard

Bug on multiple "onReceive" events

Open jnymous opened this issue 2 years ago • 1 comments

Hi,

Thank you for Fomo, it's a really nice project to work with. Simple and fast :1st_place_medal:

While using Fomo, I found the following bug:

In certain circumstances, e.g. when Fomo sits behind a reverse proxy, 1 request on the same file descriptor is split over multiple onReceive events.

So the first onReceive event gets most of the data, but then a second onReceive event is received with only a part (the rest) of the request.

Fomo is currently not handling this correctly.

I've made a quick fix that checks the onReceive $data for "\r\n\r\n" (2 newlines) that should constitute the end of the HTTP 1.0 GET request, and if not found stores it for the 2nd onReceive request. And only continues the onReceive code when the full request is received.

My change will not work for POST requests (with data), since then other conditions need to be checked, like Content-Length, etc.

So I don't think my change is worth a PR.

jnymous avatar Jan 10 '24 15:01 jnymous

Hello jnymous

Thank you for your suggestion

We will check this option and solve it if possible

amirfaramarzi avatar Jan 10 '24 15:01 amirfaramarzi

Hi jnymous,

The bug was fixed in the new version 💥

amirfaramarzi avatar Jul 12 '24 12:07 amirfaramarzi