TheProjecter / sardine

Automatically exported from code.google.com/p/sardine
0 stars 0 forks source link

sardine throw exception instead of following redirects with http 301 return code #92

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

sardine.getResources("http://someserver/dav/somename");

What is the expected output? What do you see instead?

If should get the list of ressources of that URL, along with metadatas 
informations, informations that will allow me to find out if "somename" is a 
collection or a file. Instead i get an error when somename is a collection. 
Which is a problem because i have no prior way to know if it is a collection or 
a file (user input).

Workaround could be "on exception, try again with an additional /" in my code, 
but that would be pretty bad practice. At least the sardine exception should be 
clear on the fact it's a move (already is via status code) AND most importantyl 
include the new url.

Note that exist() does follow the redirect. This mean i see ressource as 
existing but unable to access it :s. Sardine should be coherent, either never 
follow redirect, either always obey it.

I am also using another webdav server (slide) where the move could lead to a 
complete different URL. This server has the notion of "links" that are exposed 
as moved responses at webdav level)

What version of the product are you using?
svn trunk

What webdav server are you hitting?
Apache + mod_dav

What is in the server error logs?

Please provide any additional information below (including code examples and 
full stack traces with line numbers in them).

Http dump:

PROPFIND /webdav/published HTTP/1.1

Depth: 1

Content-Type: text/xml; charset=UTF-8

Content-Length: 84

Host: rmibeta.oma.be

Connection: Keep-Alive

User-Agent: Sardine/210

Authorization: Basic ***************

<?xml version="1.0" encoding="utf-8" ?><propfind 
xmlns="DAV:">.<allprop/></propfind>HTTP/1.1 301 Moved Permanently

Date: Thu, 12 May 2011 09:48:44 GMT

Server: Apache/2.2.3 (Red Hat)

Location: http://rmibeta.oma.be/webdav/published/

Content-Length: 327

Connection: close

Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a 
href="http://rmibeta.oma.be/webdav/published/">here</a>.</p>
<hr>
<address>Apache/2.2.3 (Red Hat) Server at rmibeta.oma.be Port 80</address>
</body></html>

Original issue reported on code.google.com by tch...@gmail.com on 12 May 2011 at 11:08

GoogleCodeExporter commented 9 years ago
Discussed before in issue 74.

Original comment by dkocher@sudo.ch on 16 May 2011 at 2:42

GoogleCodeExporter commented 9 years ago
In r213.

Original comment by dkocher@sudo.ch on 16 May 2011 at 3:07