Bug 149696 - Unexpected HTTP Head request triggered by queryContent (HTTP GET requests to REST API)
Summary: Unexpected HTTP Head request triggered by queryContent (HTTP GET requests to ...
Status: RESOLVED INSUFFICIENTDATA
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: sdk (show other bugs)
Version:
(earliest affected)
7.1.6.2 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-23 13:24 UTC by yanncailleux
Modified: 2023-08-24 03:14 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
HTTP requests triggered by queryContent (18.70 KB, image/png)
2022-06-23 13:28 UTC, yanncailleux
Details

Note You need to log in before you can comment on or make changes to this bug.
Description yanncailleux 2022-06-23 13:24:02 UTC
Description:
Context is the implementation of HTTP Get request to a Rest API facing a 403 triggered by a unexpected HTTP HEAD request

Code is the following

  oUCB = CreateUnoService("com.sun.star.ucb.UniversalContentBroker")
  oId = oUCB.createContentIdentifier(sURL)

  oDataSink = CreateUnoListener("XDataSink_", "com.sun.star.io.XActiveDataSink")
  oCommandEnv = CreateUnoListener("XCommandEnv_", "com.sun.star.ucb.XWebDAVCommandEnvironment")

  oGetArgs = CreateUnoStruct("com.sun.star.ucb.OpenCommandArgument2")
  oGetArgs.Mode = 2 
  oGetArgs.Sink = oDataSink
  
  aCommand = CreateUnoStruct("com.sun.star.ucb.Command")
  aCommand.Name = "open"
  aCommand.Argument = oGetArgs
  
  oContent = oUCB.queryContent(oId)  
  vRet = oContent.execute(aCommand, 0, oCommandEnv)

  oOutput = oDataSink.getInputStream()

function XCommandEnv_getUserRequestHeaders is implemented to provide HTTP header parameters

Issue:
oUCB.queryContent(oId) is triggering two HTTP requests: HTTP OPTIONS followed by HTTP HEAD request without a way to provide the requested HTTP header parameters and thus endding with a 403 answer from the API

oContent.execute(aCommand, 0, oCommandEnv) works fine and triggers a call to XCommandEnv_getUserRequestHeaders allowing to provide HTTP headers parameters

Additional information:
Implementing error handeling oUCB.queryContent(oId) gets called a second time approx 4s after and then no HTTP requests are triggered

Why is queryContent function triggering an HTTP HEAD request if there is no way to provide header parameters ? 


Steps to Reproduce:
1.execute queryContent

3.

Actual Results:
HTTP OPTIONS and HTTP HEAD requests are triggered with a way to provide HTTP header parameter

Expected Results:
No HTTP Head request should be triggered by a call to queryContent without a way to provide HTTP header parameters


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.1.6.2 (x64) / LibreOffice Community
Build ID: 0e133318fcee89abacd6a7d077e292f1145735c3
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: fr-FR (fr_FR); UI: fr-FR
Calc: CL
Comment 1 yanncailleux 2022-06-23 13:28:45 UTC
Created attachment 180932 [details]
HTTP requests triggered by queryContent
Comment 2 Buovjaga 2023-01-24 08:05:21 UTC
I tried the example code in Writer. Running it in Windows, I get

BASIC runtime error.
Object variable not set.

pointing to

vRet = oContent.execute(aCommand, 0, oCommandEnv)

On Linux I get

BASIC runtime error.
Property or method not found: XCommandEnv_getInteractionHandler.

and another error dialog

BASIC runtime error.
An exception occurred 
Type: com.sun.star.ucb.InteractiveAugmentedIOException
Message: at /home/user/libreoffice/ucb/source/ucp/gio/gio_content.cxx:883.

Please help.

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 1c638b7ac46d8077994c8483e6becc4a33efd12b
CPU threads: 2; OS: Windows 10.0 Build 22621; UI render: Skia/Raster; VCL: win
Locale: en-US (en_FI); UI: en-US
Calc: threaded

Arch Linux 64-bit, X11
Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 713493c107e6a210ef9b87d033efd0614271483a
CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 24 January 2023
Comment 3 QA Administrators 2023-07-24 03:13:19 UTC Comment hidden (obsolete)
Comment 4 QA Administrators 2023-08-24 03:14:42 UTC
Dear yanncailleux,

Please read this message in its entirety before proceeding.

Your bug report is being closed as INSUFFICIENTDATA due to inactivity and
a lack of information which is needed in order to accurately
reproduce and confirm the problem. We encourage you to retest
your bug against the latest release. If the issue is still
present in the latest stable release, we need the following
information (please ignore any that you've already provided):

a) Provide details of your system including your operating
   system and the latest version of LibreOffice that you have
   confirmed the bug to be present

b) Provide easy to reproduce steps – the simpler the better

c) Provide any test case(s) which will help us confirm the problem

d) Provide screenshots of the problem if you think it might help

e) Read all comments and provide any requested information

Once all of this is done, please set the bug back to UNCONFIRMED
and we will attempt to reproduce the issue. Please do not:

a) respond via email 

b) update the version field in the bug or any of the other details
   on the top section of our bug tracker

Warm Regards,
QA Team

MassPing-NeedInfo-FollowUp