eyereasoner / EyeServer

EyeServer is a server for the EYE reasoner.
http://reasoning.restdesc.org/
Other
31 stars 8 forks source link

Allow localhost files behind a flag #22

Open tduval-unifylogic opened 2 years ago

tduval-unifylogic commented 2 years ago

Hola!

I am sure it is something really simple I am missing. I want to use the api but cannot get it to work as designed with local web server files (port 80). Here are some images that depict what I am experiencing. I'm on an M1 Mac Mini (Monterey) if that makes any difference.

First, I try the sample post provided on the github repo home page in postman (which works!):

image

Then I create a local web server (on port 80), files are accessible by a browser without specifying port:

image image

Then I try the same post, except this time I point to the files on the local web server:

image

Then I tried the same post in a Notebook in Visual Studio with Python requests object:

image

Lastly, (what did work!!!) I gave the eye CLI the same arguments (local web server addresses) to the files and it worked!!

image

Any guidance on how to get this working as intended would be greatly appreciated!

Thanks!

RubenVerborgh commented 2 years ago

Maybe the server does not work with more recent EYE versions, that would be an easy explanation.

josd commented 2 years ago

Here on my laptop plus WSL 2 (Windows Subsystem for Linux) EyeServer still runs fine with the latest EYE v22.0409.1317

$ eyeserver 8000
EYE server running on http://localhost:8000
$ curl "http://localhost:8000/?data=http://eulersharp.sourceforge.net/2003/03swap/socrates.n3&query=http://eulersharp.sourceforge.net/2003/03swap/socratesF.n3"
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix : <http://www.agfa.com/w3c/euler/socrates#>.
@prefix q: <http://www.w3.org/2004/ql#>.

:Socrates a :Man.
:Socrates a :Mortal.
$ curl "http://localhost:8000/?data=https://n3.restdesc.org/n3/friends.n3&data=https://n3.restdesc.org/n3/knows-rule.n3&query=https://n3.restdesc.org
/n3/query-all.n3"
@prefix ppl: <http://example.org/people#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.

ppl:Cindy foaf:knows ppl:John.
ppl:Cindy foaf:knows ppl:Eliza.
ppl:Cindy foaf:knows ppl:Kate.
ppl:Eliza foaf:knows ppl:John.
ppl:Peter foaf:knows ppl:John.
ppl:John foaf:knows ppl:Cindy.
ppl:Eliza foaf:knows ppl:Cindy.
ppl:Kate foaf:knows ppl:Cindy.
ppl:John foaf:knows ppl:Eliza.
ppl:John foaf:knows ppl:Peter.
tduval-unifylogic commented 2 years ago

Thanks Jos!

I am having success as you depicted below with uris pointing to external resources on the web.

Uris to files on a web server hosted on the same machine as the eye server seem to be the issue.

On Thu, Apr 14, 2022 at 8:15 AM, Jos De Roo @.***> wrote:

Here on my laptop plus WSL 2 (Windows Subsystem for Linux) EyeServer still runs fine with the latest EYE v22.0409.1317

$ eyeserver 8000 EYE server running on http://localhost:8000

$ curl "http://localhost:8000/?data=http://eulersharp.sourceforge.net/2003/03swap/socrates.n3&query=http://eulersharp.sourceforge.net/2003/03swap/socratesF.n3" @prefix log: http://www.w3.org/2000/10/swap/log#. @prefix rdfs: http://www.w3.org/2000/01/rdf-schema#. @prefix rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#. @prefix : http://www.agfa.com/w3c/euler/socrates#. @prefix q: http://www.w3.org/2004/ql#.

:Socrates a :Man. :Socrates a :Mortal.

$ curl "http://localhost:8000/?data=https://n3.restdesc.org/n3/friends.n3&data=https://n3.restdesc.org/n3/knows-rule.n3&query=https://n3.restdesc.org /n3/query-all.n3" @prefix ppl: http://example.org/people#. @prefix foaf: http://xmlns.com/foaf/0.1/.

ppl:Cindy foaf:knows ppl:John. ppl:Cindy foaf:knows ppl:Eliza. ppl:Cindy foaf:knows ppl:Kate. ppl:Eliza foaf:knows ppl:John. ppl:Peter foaf:knows ppl:John. ppl:John foaf:knows ppl:Cindy. ppl:Eliza foaf:knows ppl:Cindy. ppl:Kate foaf:knows ppl:Cindy. ppl:John foaf:knows ppl:Eliza. ppl:John foaf:knows ppl:Peter.

— Reply to this email directly, view it on GitHub https://github.com/RubenVerborgh/EyeServer/issues/22#issuecomment-1099123324, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO3YXTE6KKIMCCOGVNX7A43VFAD5BANCNFSM5TLREVNA . You are receiving this because you authored the thread.Message ID: @.***>

bdevloed commented 2 years ago

@MartyStache are you using Docker or some kind of virtualization to run EyeServer? This would explain why localhost for node (i.e. EyeServer) doesn't map to the same localhost as your cli.

tduval-unifylogic commented 2 years ago

Nothing that fancy...

on Mac M1 Monterey...running eye server local on port 8000 and web server for files local on port 80:

[image: image.png]

On Thu, Apr 14, 2022 at 9:52 AM Boris De Vloed @.***> wrote:

@MartyStache https://github.com/MartyStache are you using Docker or some kind of virtualization to run EyeServer? This would explain why localhost for node (i.e. EyeServer) doesn't map to the same as localhost as your cli.

— Reply to this email directly, view it on GitHub https://github.com/RubenVerborgh/EyeServer/issues/22#issuecomment-1099209790, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO3YXTF7UI4BJLKQL5PAQE3VFAPJFANCNFSM5TLREVNA . You are receiving this because you were mentioned.Message ID: @.***>

josd commented 2 years ago

Tried the same here and there is indeed an issue: Via command line it works all fine

$ eye --nope http://localhost/eye/reasoning/socrates/socrates.n3 --query http://localhost/eye/reasoning/socrates/socrates-query.n3
eye --nope http://localhost/eye/reasoning/socrates/socrates.n3 --query http://localhost/eye/reasoning/socrates/socrates-query.n3
EYE v22.0409.1317 josd
SWI-Prolog version 8.5.10-15-g673a8f640
starting 32 [msec cputime] 29 [msec walltime]
#Processed by EYE v22.0409.1317 josd
#eye --nope http://localhost/eye/reasoning/socrates/socrates.n3 --query http://localhost/eye/reasoning/socrates/socrates-query.n3

GET http://localhost/eye/reasoning/socrates/socrates.n3 SC=3
GET http://localhost/eye/reasoning/socrates/socrates-query.n3 SC=1
networking 5 [msec cputime] 24 [msec walltime]
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix : <http://example.org/socrates#>.

:Socrates a :Human.
:Socrates a :Mortal.

reasoning 0 [msec cputime] 0 [msec walltime]
#2022-04-14T16:53:38.202Z in=4 out=2 ent=3 step=6 brake=2 inf=23148 sec=0.037 inf/sec=625622
#ENDS

2022-04-14T16:53:38.202Z in=4 out=2 ent=3 step=6 brake=2 inf=23148 sec=0.037 inf/sec=625622

but via eyeserver nothing comes back

$ curl "http://localhost:8000/?data=http://localhost/eye/reasoning/socrates/socrates.n3&query=http://localhost/eye/reasoning/socrates/socrates-query.n3"

@RubenVerborgh any idea?

RubenVerborgh commented 2 years ago

Oh yes, we are very likely deliberately blocking localhost access for security reasons 🙂

RubenVerborgh commented 2 years ago

Yeah we are: https://github.com/RubenVerborgh/EyeServer/blob/36b3e87fd263af122c8af6ab54ea681eeaab6734/lib/eye.js#L93

Can make this into a flag.

josd commented 2 years ago

That would be a nice option indeed!

tduval-unifylogic commented 2 years ago

awesome! thanks! great for debugging!