My 1st thought was the file module, but it doesn't seem to have access to that directory.
Sounds surprising. Which error message do you get?
Hi France,
Thanks for the test case. I called your RESTXQ function with Windows, and it seems to work. What I did:
- I started basexhttp.bat
- I modified your script to be runnable (8972 → 8984, namespace added
for "a-test", etc.)
- I added a test.png to the "static" webapp directory
- I called http://localhost/a-test (in the browser and via curl), it
returns <div>200</div>
Maybe you did something differently?
Does the problem persist if you…
- send the HTTP request without xquery:fork-join?
- use fetch:binary?
The easier your example code and setup is, the easier it might get to reproduce the problem.
And a general observation: It’s recommendable not to the same HTTP instance from a RESTXQ function (but this may simply have been the result of our persistance to deliver us with reproducible test cases?).
Cheers Christian
On Wed, May 8, 2019 at 11:54 AM France Baril france.baril@architextus.com wrote:
Hi,
We have two servers with similar jetty configuration, we find that an http:request call on static works on Linux but not on Windows.
HOW TO REPLICATE
Add an image test.png in webapp/static Try the attached .xqm (change img-url for your server path) Copy of the .xqm function for reference:
declare %rest:path('/a-test') %rest:GET %output:method("html") %output:html-version("5.0") function a-test:http-req(){ let $img-url := 'http://localhost:8972/static/test.png' let $http-function := function() {http:send-request(<http:request method='get' status-only='true'/>, $img-url)} let $http-s := xquery:fork-join($http-function) let $http-status := $http-s//data(@status) return <div>{$http-status}</div> };
Test: http://localhost:8972/a-test
Result on Linux: 200 Result on Windows: [experr:HC0001] unknown protocol: localhost
This seemed to be security issue, but tests in multiple browsers return the same results and enabling CORS doesn't help... technically we're calling from the same domain/port... but hey we tried!
If we type the value of $img-url directly in the browser, we see the image on both platforms, so the issue is not with accessing the image itself, but with accessing it with the http:send-request function.
-- France Baril Architecte documentaire / Documentation architect france.baril@architextus.com