Issue 121201 - webdav ucp: failure if the server does not support HEAD requests
webdav ucp: failure if the server does not support HEAD requests
Status: RESOLVED FIXED
Product: General
Classification: Code
Component: code
3.4.1
All All
: P3 normal (vote)
: 4.0.0
Assigned To: Ariel Constenla-Haile
:
Depends on: 121202
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-12 07:18 UTC by Ariel Constenla-Haile
Modified: 2013-03-24 13:28 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation on: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Ariel Constenla-Haile 2012-10-12 07:18:39 UTC
The Extensions Update seems to be broken, I couldn't detect a behavior pattern, because it does not fail always, but in same cases it return a "Not found!" error while trying to download the update.

You can try installing preview version 1.0.2 of the MySQL Driver from http://code.google.com/a/apache-extras.org/p/aoo-my-sdbc/downloads/list?can=1&q=&colspec=Filename+Summary+Uploaded+ReleaseDate+Size+DownloadCount

The Extension Manager will try to upgrade the extension to version 1.1.0, but will fail downloading the extension:

"Error while downloading extension MySQL Connector for Apache OpenOffice. The error message is: Could not download http://aoo-my-sdbc.apache-extras.org.codespot.com/files/aoo-my-sdbc-1.1.0-linux-x86-64.oxt. Not found!
The extension will not be installed.

Error while installing extension MySQL Connector for Apache OpenOffice. The extension will not be installed."


Setting a break point in dp_gui::UpdateInstallDialog::Thread::download()

around 

::ucbhelper::Content sourceContent;    
dp_misc::create_ucb_content( &sourceContent, sDownloadURL, m_updateCmdEnv.get() );

step into dp_misc::create_ucb_content()
There you see that it re throws due to ucbContent.isFolder() throwing an exception.

http_dav_ucp::SerfSession::HEAD throws an exception due to failure in http_dav_ucp::SerfRequestProcessor::processHead() for header name "IsFolder"; note that outSerfStatus is 20014 (an internal error?), not NOT_FOUND.

I tried changing the code on dp_misc::create_ucb_content() from isFolder() to isDocument() and it also fails.

Backtrace:
#0 http_dav_ucp::SerfSession::HandleError() at /build/aoo/src/playground/trunk/main/ucb/source/ucp/webdav/SerfSession.cxx:1371
#1 http_dav_ucp::SerfSession::HEAD() at /build/aoo/src/playground/trunk/main/ucb/source/ucp/webdav/SerfSession.cxx:690
#2 http_dav_ucp::DAVResourceAccess::HEAD() at /build/aoo/src/playground/trunk/main/ucb/source/ucp/webdav/DAVResourceAccess.cxx:329
#3 http_dav_ucp::Content::getPropertyValues() at /build/aoo/src/playground/trunk/main/ucb/source/ucp/webdav/webdavcontent.cxx:1348
#4 http_dav_ucp::Content::execute() at /build/aoo/src/playground/trunk/main/ucb/source/ucp/webdav/webdavcontent.cxx:428
#5 ucbhelper::Content_Impl::executeCommand() at /build/aoo/src/playground/trunk/main/ucbhelper/source/client/content.cxx:1866
#6 ucbhelper::Content::getPropertyValuesInterface() at /build/aoo/src/playground/trunk/main/ucbhelper/source/client/content.cxx:679
#7 ucbhelper::Content::getPropertyValues() at /build/aoo/src/playground/trunk/main/ucbhelper/source/client/content.cxx:616
#8 ucbhelper::Content::getPropertyValue() at /build/aoo/src/playground/trunk/main/ucbhelper/source/client/content.cxx:566
#9 ucbhelper::Content::isDocument() at /build/aoo/src/playground/trunk/main/ucbhelper/source/client/content.cxx:1614
#10 dp_misc::create_ucb_content() at /build/aoo/src/playground/trunk/main/desktop/source/deployment/misc/dp_ucb.cxx:70
#11 dp_gui::UpdateInstallDialog::Thread::download() at /build/aoo/src/playground/trunk/main/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx:621
#12 dp_gui::UpdateInstallDialog::Thread::downloadExtensions() at /build/aoo/src/playground/trunk/main/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx:405
#13 dp_gui::UpdateInstallDialog::Thread::execute() at /build/aoo/src/playground/trunk/main/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx:199
#14 dp_gui::Thread::run() at /build/aoo/src/playground/trunk/main/desktop/source/deployment/gui/dp_gui_thread.cxx:66
#15 osl::threadFunc() at /build/aoo/src/playground/trunk/main/solver/350/unxlngx6/inc/osl/thread.hxx:182
#16 osl_thread_start_Impl() at /build/aoo/src/playground/trunk/main/sal/osl/unx/thread.c:265
#17 start_thread() at /usr/src/debug/glibc-2.15-a316c1f/nptl/pthread_create.c:308
#18 clone() at /usr/src/debug/glibc-2.15-a316c1f/sysdeps/unix/sysv/linux/x86_64/clone.S:114
Comment 1 Ariel Constenla-Haile 2012-10-12 07:31:42 UTC
Sure related to this, the SimpleFileAccess service says that the extension doesn't exist:

Sub Main
Dim oSFA
oSFA = CreateUnoService("com.sun.star.ucb.SimpleFileAccess")
Dim bExists as Boolean
bExists = oSFA.isFolder(ConvertToURL("http://aoo-my-sdbc.apache-extras.org.codespot.com/files/aoo-my-sdbc-1.1.0-linux-x86-64.oxt"))
End Sub

In this case, the ucb command "open" is failing.
Comment 2 jsc 2012-10-12 09:07:40 UTC
I can reproduce the update problem after I have installed version 1.0.2 from my people test folder (installed via the file open dialog).

When I run the basic macro I can't reproduce a problem, bExists is false and I think that is the expected value.

All my test are under MacOS.
Comment 3 Ariel Constenla-Haile 2013-02-25 14:53:41 UTC
(In reply to comment #0)
> The Extensions Update seems to be broken, I couldn't detect a behavior
> pattern, because it does not fail always, but in same cases it return a "Not
> found!" error while trying to download the update.
> 
> You can try installing preview version 1.0.2 of the MySQL Driver from
> http://code.google.com/a/apache-extras.org/p/aoo-my-sdbc/downloads/
> list?can=1&q=&colspec=Filename+Summary+Uploaded+ReleaseDate+Size+DownloadCoun
> t
> 
> The Extension Manager will try to upgrade the extension to version 1.1.0,
> but will fail downloading the extension:
> 
> "Error while downloading extension MySQL Connector for Apache OpenOffice.
> The error message is: Could not download
> http://aoo-my-sdbc.apache-extras.org.codespot.com/files/aoo-my-sdbc-1.1.0-
> linux-x86-64.oxt. Not found!
> The extension will not be installed.
> 
> Error while installing extension MySQL Connector for Apache OpenOffice. The
> extension will not be installed."

I still get the same error after updating serf to 1.2.0
But testing with OOo 3.4.0 BETA (with neon), I get the same error.
May be related to the extension manager code, not to the webdav ucp.
Comment 4 hanya 2013-03-18 16:23:48 UTC
I wrote the following Python script to check HEAD request to 
aoo-my-sdbc.apache-extras.org.codespot.com: 

Result:
HEAD: www.openoffice.org/api/docs/common/ref/index-files/index-1.html:
200 OK
GET: www.openoffice.org/api/docs/common/ref/index-files/index-1.html:
200 OK
HEAD: aoo-my-sdbc.apache-extras.org.codespot.com/files/aoo-my-sdbc-1.1.0-linux-x86.oxt:
404 Not Found
GET: aoo-my-sdbc.apache-extras.org.codespot.com/files/aoo-my-sdbc-1.1.0-linux-x86.oxt:
200 OK

the server does not respond to HEAD request.

import httplib

def get(main, path):
    conn = httplib.HTTPConnection(main)
    conn.request("GET", path)
    r2 = conn.getresponse()
    print("GET: " + main + path + ":\n" + str(r2.status) + " " + str(r2.reason))

def head(main, path):
    conn = httplib.HTTPConnection(main)
    conn.request("HEAD", path)
    res = conn.getresponse()
    print("HEAD: " + main + path + ":\n" + str(res.status) + " " + str(res.reason))

s = "www.openoffice.org"
v = "/api/docs/common/ref/index-files/index-1.html"
head(s, v)
get(s, v)

u = "aoo-my-sdbc.apache-extras.org.codespot.com"
t = "/files/aoo-my-sdbc-1.1.0-linux-x86.oxt"
head(u, t)
get(u, t)
Comment 5 Ariel Constenla-Haile 2013-03-18 19:23:40 UTC
(In reply to comment #4)
> I wrote the following Python script to check HEAD request to 
> aoo-my-sdbc.apache-extras.org.codespot.com: 

You are right:

[ariel@localhost ~]$ curl -i --head http://aoo-my-sdbc.apache-extras.org.codespot.com/files/aoo-my-sdbc-1.1.0-linux-x86.oxt
HTTP/1.1 404 Not Found
Content-Type: text/html; charset=UTF-8
X-Content-Type-Options: nosniff
Date: Mon, 18 Mar 2013 18:51:37 GMT
Server: codesite_downloads
Content-Length: 968
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN

while a partial GET is working:

[ariel@localhost ~]$ curl -i --get -H "Range: bytes=0-1" http://aoo-my-sdbc.apache-extras.org.codespot.com/files/aoo-my-sdbc-1.1.0-linux-x86.oxt
HTTP/1.1 206 Partial Content
Content-Range: bytes 0-1/1549728
Content-Length: 2
Content-Type: application/zip; charset=binary
Content-Disposition: attachment; filename="aoo-my-sdbc-1.1.0-linux-x86.oxt"
Accept-Ranges: bytes
Date: Mon, 18 Mar 2013 18:52:34 GMT
Last-Modified: Thu, 11 Oct 2012 09:21:07 GMT
Expires: Mon, 25 Mar 2013 18:52:34 GMT
Cache-Control: public, max-age=604800
Server: DFE/largefile
Comment 6 Ariel Constenla-Haile 2013-03-18 19:57:21 UTC
Found http://code.google.com/p/support/issues/detail?id=660
support HTTP HEAD method for file download urls

The question now is if supporting HEAD is mandatory.
If not, the webdav ucp should not rely on it.

Something similar happens for webdav broken due to PROPFIND not supported on the server.
Comment 7 SVN Robot 2013-03-24 13:20:59 UTC
"arielch" committed SVN revision 1460354 into trunk:
i121201 - Handle servers not supporting HEAD requests
Comment 8 Ariel Constenla-Haile 2013-03-24 13:28:26 UTC
Fixed on trunk