PXshadow / weblink

MIT License
41 stars 7 forks source link

Add cors and options support #29

Open neimanpinchas opened 6 months ago

neimanpinchas commented 6 months ago

I had a need for cors, so I tried to add options and cors

please forgive the coding style, I know it might not be ready for commit, I created the idea as a starting point, I tested it with my code (with haxe remoting, this is another story) and it worked.

neimanpinchas commented 5 months ago

I've added basic nodejs support, so no need for express js anymore even when targetting js

PXshadow commented 5 months ago

Well done on the changes! Could you make it so that the tests run on both hashlink and nodejs?

neimanpinchas commented 5 months ago

OK, will do

probably only need to remove these threading syncronous Sys.sleep

also needs this for Http.requestUrl to work https://github.com/HaxeFoundation/hxnodejs/pull/187, hope it will get merged one day.

PXshadow commented 2 months ago

Latest status?

neimanpinchas commented 2 months ago

It is not trivial for me to adjust the existing testing for javascript.

I've implemented a virtual local threading, but now I bumped into the syncronous Http.requestUrl, being used in the tests.

I think maybe we need to combine mutiple test case into a generic one, running off a json file for the input urls and the server settings

PXshadow commented 1 month ago

Sorry about the conflict, it seems it's only one part, the other 2 conflicting areas is an import, and a comment.

If I could ask the current status?

neimanpinchas commented 1 month ago

The import can be removed as it is redundent anyway (I placed it into a if #hl because I want to use it with js backed)

I think that the making the Stream variable a closure instead of server class property was handled in both branches, the only diffrence is that I've used var, and he used final.

The done varible has been added for js to function properly, once the buffer exceeds the content length, however this may cause issues with persitent connections.

I wasn't yet succesfull with translating the test cases for javascript, as JS is single threaded and t is not trivial to make a synchronous web request when the same process should act as the server and respond, I am thinking something about a config file based testing, but I wasn't yet succesfull, I hope the branch will not get rusty in the meantime.

PXshadow commented 1 month ago

The import can be removed as it is redundent anyway (I placed it into a if #hl because I want to use it with js backed)

I think that the making the Stream variable a closure instead of server class property was handled in both branches, the only diffrence is that I've used var, and he used final.

The done varible has been added for js to function properly, once the buffer exceeds the content length, however this may cause issues with persitent connections.

I wasn't yet succesfull with translating the test cases for javascript, as JS is single threaded and t is not trivial to make a synchronous web request when the same process should act as the server and respond, I am thinking something about a config file based testing, but I wasn't yet succesfull, I hope the branch will not get rusty in the meantime.

Worst case scenario the rust can be shaken off, or this pr can be redone on latest commit. I'd for sure like to see these changes get added, so let me know how I can help make them happen.

I'd also say forget about js if that'd be helpful and focus on options and cors.