snoe / deedum

A cross platform Gemini browser
GNU General Public License v3.0
128 stars 13 forks source link

Deedum sending duplicate requests? #28

Closed maimere closed 3 years ago

maimere commented 3 years ago

Hello. First of all, thanks for the great app.

While inspecting the access logs of my gemini server, I noticed duplicate responses to the same IP and URL requested, which were sent at the same second.

At first, I thought it was my server's fault (I run a jetforce), eventually sending double responses, but later I realized it happened only with certain IPs.

After spending some time trying different configurations (accessing the server through different clients and proxies available; on mobile or desktop; connecting over 3G, Wifi or cable; requesting static .gmi files or CGI), I realized the double responses only happened when using Deedum. I tested on two Android phones, with same results for any connectivity configuration. (No opportunity to test on iOS devices.)

This makes me think Deedum is actually sending duplicate requests to the server. I only run one server, leaving me incapable of testing on other servers.

Also, I am not familiar to Dart language, so I'm clueless why this happens, and even if it's really a feature instead of an issue!

My regards.

snoe commented 3 years ago

hi @maimere thanks for the report.

The double fetch will happen here, I make the request with a write_shutdown initially because that helped kicked some servers into responding. But then some other servers close the connection (instead of sending the response per spec afaict) so I need to make that second request.

A lot of this was working around jetforce 0.4 and earlier if 0.5+ is more widely spread I can test without the shutdown and see how well that works.

makew0rld commented 3 years ago

if 0.5+ is more widely spread

I believe this is the case.

I'm confused why you'd have to do a second request at all, it's not something I ever had to do with my clients in Go.

snoe commented 3 years ago

(this is from memory). go (properly? as a nicety?) sends a tls disconnect from the client and the old jetforce version would react to that to know when to send the response. dart doesn't send the packet, and being the language that it is, there's not really a seam to do it myself without maybe, possibly using sketchy third party crypto libs not necessarily meant for tls. https://github.com/michael-lazar/jetforce/issues/32

makew0rld commented 3 years ago

Ah okay. But you mention that Go sends this disconnect signal every time, but "some other servers close the connection (instead of sending the response per spec afaict)". I've never experienced specific servers failing in my casual testing with Go. Do you know of any servers that won't work with this write_shutdown? Because if not then this double requesting can be removed.