Title: Some Router problem with ETag and empty payload Post by: Dany on July 14, 2017, 01:27:09 PM Hello!
I am not sure if i can do what i want ;) but here goes a reproduction instruction (this is using RTC 8.17): The FileServer Demo 1. Change listening port to 90. 2. Insert the following code into the rtcFileProvider.pas file @483 (before the "if Request.Method = 'HEAD' in the CheckDiskFile procedure body...): Code: Response['ETag'] := '"' + MyFileName + '"'; The first request is answered with 200 and the text appears. OK! If i press Ctrl+R another response with status 200 is delivered. OK! If i click the reload button or press enter in the address field a response with status 304 is received. OK! All good. The RTCRouter2 Demo 4. Compile and execute the up the RTCRouter2 Demo. 5. Set Server Address to localhost and Server Port to 90. 6. Start the router. 6. Access the FileServer Demo (still running) using localhost/index.htm (i still use Chrome). The first response is delivered with status 200 and i can see the text. OK. I click the reload button and one response with status 304 is received. OK. However, when i continuously click the reload button the next request get stuck and (pending) is shown in Chromes Network debugger panel. FAIL? TIA for any insights! /Dany Title: Re: Some Router problem with ETag and empty payload Post by: D.Tkalcec (RTC) on July 14, 2017, 05:30:21 PM Thank you for reporting this problem and for providing a clear step-by-step guide to reproduce it.
I've released an update now (RTC SDK v8.18) to fix the problem and eliminate the need for manually setting the Response.SendContent property to FALSE when preparing a Response which SHOULD NOT HAVE a Content Body. This includes all responses to 'HEAD' requests, as well as responses with a Status Code 1xx, 204 and 304. Please, download the update and let me know if the problem is now fixed (or not?). Best Regards, Danijel Tkalcec Title: Re: Some Router problem with ETag and empty payload Post by: Dany on July 14, 2017, 07:21:18 PM Yes!
I have even updated the deployed router - server and it works nicely now :) [Though it will not give much feedback-wise since the load is rather meagre there atm]. Making a good MVE is a breeze when i do not forget to try the problem out in the Demos. The Demos (they are very complete and extensive) are really good like that. I guess the only downside is the learning curve for new users. Before thinking of trying out my problem using the demos i was tracing along heavily. I noticed that i got some hidden exceptions (Trying to send more data out...) from the server behind the router and i think this was because i used Write *with* content even if SendContent was set to false. I also try to handle empty files / payloads like non-empty files / payloads (this is not the case in the webserver demo) because an E-Tag i suppose is valid for an empty file / response too. I will, however, revisit that code and get more into those cases when i put E-Tags on my REST responses too. I'll also try to remove some now redundant calls. Thank you *so much* for this prompt response. /Dany Regards Title: Re: Some Router problem with ETag and empty payload Post by: D.Tkalcec (RTC) on July 14, 2017, 07:58:13 PM Perfect. Thanks again for your feedback.
Best Regards, Danijel Tkalcec |