Bug 144276 - WEBSERVICE function to certain external URL results in #VALUE! error
Summary: WEBSERVICE function to certain external URL results in #VALUE! error
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: framework (show other bugs)
Version:
(earliest affected)
5.3.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Network Calc-Function
  Show dependency treegraph
 
Reported: 2021-09-03 01:19 UTC by Aron Budea
Modified: 2023-08-03 13:12 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Session log (2.79 KB, text/plain)
2021-09-03 01:21 UTC, Aron Budea
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aron Budea 2021-09-03 01:19:30 UTC
Taking the sample function from bug 144238:
=WEBSERVICE("http://data.fixer.io/api/latest?access_key=74ba35e56db252bd4737c215d4b0bf62&base=&symbols=PLN")

This results in a #VALUE! error when entered in a cell in Calc, while opening the link itself gives correct JSON:
http://data.fixer.io/api/latest?access_key=74ba35e56db252bd4737c215d4b0bf62&base=&symbols=PLN

Sample result: {"success":true,"timestamp":1630625596,"base":"EUR","date":"2021-09-02","rates":{"PLN":4.51215}}

This is a regression from the following commit, bibisected using ibisect-linux-64-5.3. It also looks like a reproducible case of bug 108141. Adding CC: to Giuseppe Castagno.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=16df731a30917a426df81d751a0bfd0ae5fcdd45
author		Giuseppe Castagno <giuseppe.castagno@acca-esse.eu>	2016-09-12 20:59:09 +0200
committer	Giuseppe Castagno <giuseppe.castagno@acca-esse.eu>	2016-10-11 06:06:12 +0000

"tdf#102499 (5): Deal with HTTP unofficial response status codes"

Eike, I see you commented on bug 108141, let me CC you here as well.
Comment 1 Aron Budea 2021-09-03 01:21:47 UTC
Created attachment 174751 [details]
Session log

Console logs from a debug build.
Comment 2 Eike Rathke 2021-09-03 11:12:17 UTC
Might be a timing problem of the requests issued or the web server not wanting to let have us access otherwise. Effectively we're getting a HTTP status code 403 Forbidden. Deep down at
https://opengrok.libreoffice.org/xref/core/ucb/source/ucp/webdav-neon/webdavcontent.cxx?r=10d29c39#2235
the GET() call fails, or if retried already the getResourceOptions() call at
https://opengrok.libreoffice.org/xref/core/ucb/source/ucp/webdav-neon/webdavcontent.cxx?r=10d29c39#2225
both with the 403. The latter for the OPTIONS() call at
https://opengrok.libreoffice.org/xref/core/ucb/source/ucp/webdav-neon/webdavcontent.cxx?r=10d29c39#3928

It was successful twice when single stepping through that sequence in the debugger, which doesn't make things easier, so I believe it is some (too fast) timing problem and the server thinking bad of us thus denying with 403. Or we issue some request between that isn't on its access-control-allow-methods list, but it doesn't look like from the first glance (list with curl -i for that URL is GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS).

On the other hand, using
curl -I 'http://data.fixer.io/api/latest?access_key=74ba35e56db252bd4737c215d4b0bf62&base=&symbols=PLN'
to issue a HEAD request I also get a 403 error. Which makes me believe the server has a broken implementation anyway.

Nothing that could be solved at the Calc level and I'm not familiar with that code. Setting 'framework' component. Not even sure this is a bug, given the curl -I behaviour.
Comment 3 Stéphane Guillou (stragu) 2023-08-03 12:52:00 UTC
Reproduced with sample formula in recent master build:

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: eef0c5d4d45ba35acfb6d8f7551fe565ca4badaa
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded