Bug 99246 - WebDAV: Using a Web proxy server or Fiddler the PUT request on a locked resource does not provide the needed lock-token
Summary: WebDAV: Using a Web proxy server or Fiddler the PUT request on a locked resou...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
5.1.1.3 release
Hardware: All All
: medium normal
Assignee: Giuseppe Castagno (aka beppec56)
URL:
Whiteboard: target:5.2.0 target:5.1.4
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-12 13:47 UTC by FeelAirSlow
Modified: 2016-10-25 19:02 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Wireshark log, with and without Fiddler (41.99 KB, application/x-zip-compressed)
2016-04-27 11:03 UTC, FeelAirSlow
Details

Note You need to log in before you can comment on or make changes to this bug.
Description FeelAirSlow 2016-04-12 13:47:40 UTC
During communication with a WebDAV server, if LibreOffice has acquired a lock, it MUST use an "If" header with Lock-Token uri (cf. https://tools.ietf.org/html/rfc4918#section-7) in PUT queries to be allowed to update the locked resource.

For now, as it's not the case, the WebDAV server refuses the PUT query with a "423 Locked" response and LibreOffice displays an error message saying "The file is locked by yourself"...
Comment 1 Julien Nabet 2016-04-12 19:07:22 UTC
Giuseppe: thought you might be interested in this one.
Comment 2 Giuseppe Castagno (aka beppec56) 2016-04-13 06:58:49 UTC
(In reply to FeelAirSlow from comment #0)
 
> For now, as it's not the case, the WebDAV server refuses the PUT query with
> a "423 Locked" response and LibreOffice displays an error message saying
> "The file is locked by yourself"...

when you spare time, can you try with LO 5.1.x version?
Comment 3 FeelAirSlow 2016-04-13 09:04:03 UTC
(In reply to Giuseppe Castagno (aka beppec56) from comment #2)
> when you spare time, can you try with LO 5.1.x version?

All my tests are already done with LO 5.1.1.3
Comment 4 Giuseppe Castagno (aka beppec56) 2016-04-13 14:18:54 UTC
Strange, because on that version I didn't hit this kind of problem.

FeelAirSlow:

I need to know:

1) what WebDAV server are you using?

2) the exact LO version, you can copy from the Help > About dialog and paste here.

3) what operation are you performing on LO when the bug hits you?
Comment 5 FeelAirSlow 2016-04-13 14:47:28 UTC
(In reply to Giuseppe Castagno (aka beppec56) from comment #4)

* WebDAV server : "IT Hit WebDAV server"

* LibreOffice :
Version: 5.1.1.3
Build ID: 89f508ef3ecebd2cfb8e1def0f0ba9a803b88a6d
Threads CPU : 4; Version de l'OS :Windows 6.1; UI Render : par défaut; 
Locale : fr-FR (fr_FR)

* Steps to reproduce the bug :
1) Go to "http://www.ajaxbrowser.com/" (live demo of IT hit webdav server)
2) Open "Sales" folder, then right click, then "Upload Files..." to upload any odt file.
3) Right click on the odt file, "Properties"
4) Copy the location URL.
5) Open LibreOffice
6) BE SURE TO USE LibreOffice DIALOG BOX and paste url (there are OPTIONS, PROPFIND, GET, LOCK queries)
7) Save (there is a PUT query without Lock-Token)
8) Error message

NB : LibreOffice behave not the same if you use Windows dialog box (it seems like a legacy mechanism, which uses "Microsoft-WebDAV-MiniRedir" and create ".~lock" file).
Comment 6 Julien Nabet 2016-04-13 20:20:11 UTC
(In reply to FeelAirSlow from comment #5)
> ...
> 6) BE SURE TO USE LibreOffice DIALOG BOX and paste url (there are OPTIONS,
> PROPFIND, GET, LOCK queries)
> ...

I enabled LO dialog box but I don't know what to do then.
Indeed, I used "File/Open" and paste the url in "File Name" but where are the options you quoted?
Comment 7 FeelAirSlow 2016-04-14 07:05:23 UTC
(In reply to Julien Nabet from comment #6)

> > 6) BE SURE TO USE LibreOffice DIALOG BOX and paste url (there are OPTIONS,
> > PROPFIND, GET, LOCK queries)
> > ...
> 
> I enabled LO dialog box but I don't know what to do then.
> Indeed, I used "File/Open" and paste the url in "File Name" but where are
> the options you quoted?

Sorry for the misunderstanding : after you paste the URL and click "Open", there are WebDAV queries (OPTION, PROPFIND, GET, LOCK)
Comment 8 Julien Nabet 2016-04-14 07:09:32 UTC
(In reply to FeelAirSlow from comment #7)
> ...
> Sorry for the misunderstanding : after you paste the URL and click "Open",
> there are WebDAV queries (OPTION, PROPFIND, GET, LOCK)

I pasted the url in a brand new doc in Writer, then clicked "Open", I've got no WebDav queries/options at all.
Sorry, I think I can't help here and just make you waste your time so I uncc myself.
Comment 9 FeelAirSlow 2016-04-14 07:13:46 UTC
(In reply to Julien Nabet from comment #8)
> I pasted the url in a brand new doc in Writer, then clicked "Open", I've got
> no WebDav queries/options at all.
> Sorry, I think I can't help here and just make you waste your time so I uncc
> myself.

NB : WebDAV HTTP queries cannot be seen without a tool like Fiddler.
Just a question : did you tried to "Save" your file, and did you succeed ?
Comment 10 Giuseppe Castagno (aka beppec56) 2016-04-14 11:17:42 UTC
I repeated the test as follow:

On LO:Version: 5.1.2.2
Build ID: d3bf12ecb743fc0d20e0be0c58ca359301eb705f
CPU Threads: 2; OS Version: Windows 6.1; UI Render: default; 
Locale: en-US (en_US)

1) Open http://www.ajaxbrowser.com/
2) using the browser and the context menu upload a file
3) open LO, confirm you have the LO native dialog active (Tools > Options > General, checkbox 'Use Libreoffice Dialog' should be ticked)
4) on browser, open context menu on the file loaded on 2) above
5) select 'Properties' copy the 'Location' URL
6) on LO select 'File Open' paste the URL in 'File name:' edit box
7) open it: the file should open with no error
8) do some editing to file
9) save it. No error shown.

There is another way, using the URL provided on the WebDAV opening page to the right (e.g. something like http://www.ajaxbrowser.com/Userf2f446c)
You may copy it, then:
1) open LO, confirm you have the LO native dialog active (Tools > Options > General checkbox 'Use Libreoffice Dialog' should be ticked)
2) select 'File > Open' 
3) paste the root URL into the topmost edit box (the one which contains the file path)
3) hit return, the remote folder should show
4) navigate to the file to open, open it. Then you should be able to edit/save with no problem.

Just a thougth: saw you are on a French locale, what file name you used?
Comment 11 FeelAirSlow 2016-04-14 11:48:47 UTC
(In reply to Giuseppe Castagno (aka beppec56) from comment #10)

> I repeated the test as follow:
> 9) save it. No error shown.
> Just a thougth: saw you are on a French locale, what file name you used?

I've done the test with your very own file :
http://www.ajaxbrowser.com:80/Userf2f446c/Sales/Lorem_ipsum.odt
I have the error message ! I cannot put the file back.
And I confirm the PUT request does not provide Lock-Token (if I fiddle the query and add the missing "If" header, it works).

> There is another way, using the URL provided on the WebDAV opening page to
> the right (e.g. something like http://www.ajaxbrowser.com/Userf2f446c)

Of course, your alternate method works because it's using OpenOffice legacy WebDAV connection (via Microsoft-WebDAV-MiniRedir and "~.lock file").

But my full use case is opening a link in a web browser.
The protocol handler then starts LibreOffice with the command :
soffice.exe "vnd.sun.star.webdav://www.ajaxbrowser.com:80/Userf2f446c/Sales/Lorem_ipsum.odt"
And in this use case, it's like directly opening the full link in the LibreOffice dialog box (using User-Agent: LibreOffice).
Comment 12 Giuseppe Castagno (aka beppec56) 2016-04-15 06:19:52 UTC
FeelAirSlow:

now you lost me.
What are you trying to accomplish?

Since all this is happening on a http connection, Wireshark can be of use to log your entire try session.
You may then post the Wireshark log here.

About comment 5: OPTIONS method is not implemented in LO, I don't known what sent it, surely not LO.
Comment 13 FeelAirSlow 2016-04-15 09:15:57 UTC
> About comment 5: OPTIONS method is not implemented in LO, I don't known what
> sent it, surely not LO.
You're right Giuseppe, my mistake.

> What are you trying to accomplish?
I'm simply trying to edit a WebDAV file from the command line :
soffice.exe "vnd.sun.star.webdav://www.ajaxbrowser.com/Userf2f446c/Sales/Lorem_ipsum.odt"

And I think I've found why I can't update the file : on my dev machine, I always use Fiddler web debugging proxy.
When Fiddler is off, I can save the file with LO !
But when it's on, LO does not send "If" header with PUT queries.
NB : I suppose it's something in LO instead of Fiddler, because when I use MS-Word via WebDAV with Fiddler on, everything is fine ("If" header is here).
Comment 14 Buovjaga 2016-04-26 10:03:36 UTC
Set to NEEDINFO.
Change back to UNCONFIRMED after you have provided the Wireshark log requested.
Comment 15 FeelAirSlow 2016-04-27 11:03:17 UTC
Created attachment 124671 [details]
Wireshark log, with and without Fiddler

Wireshark log as requested, with and without Fiddler activated.
Comment 16 Giuseppe Castagno (aka beppec56) 2016-05-04 13:31:10 UTC
Took me some time to nail it down.

It seems Fiddler behaves like a sort of proxy server, disrupting the existed lock search while doing PUT operation.
Comment 17 Giuseppe Castagno (aka beppec56) 2016-05-05 10:23:53 UTC
A better description, since this is a general bug.
Comment 18 Giuseppe Castagno (aka beppec56) 2016-05-07 09:25:44 UTC
FeelAirSlow:

There a fix on master in this commit:

<https://gerrit.libreoffice.org/gitweb?p=core.git;a=commitdiff;h=d324b4b3e1d32b25a6347f2f77ae921a584ee9b0>

daily master from here:
<http://dev-builds.libreoffice.org/daily/master/Win-x86@42/current/>

has the fix.

If you spare time, you may give it a try, thanks.
Comment 19 Commit Notification 2016-05-09 07:23:42 UTC
Giuseppe Castagno committed a patch related to this issue.
It has been pushed to "libreoffice-5-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=19d61beb37f63e171f55f937c21dfb0d1422fd72&h=libreoffice-5-1

tdf#99246 Use correct path for lock in PUT method.

It will be available in 5.1.4.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 20 FeelAirSlow 2016-05-10 09:25:30 UTC
Giuseppe:

I've made many tests with the current daily master.
Your fix works great in my use cases.
Thank you for investigating this issue.