netcharm / pywebdav

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

Non-standards compliant PUT response code #49

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I've been debugging a webdav application used internally at the place where I 
work. To verify correct behaviour I used PyWebDAV. Now I'm suspecting PyWebDAV 
is not fully standards compliant. Please correct me if I'm wrong!

What steps will reproduce the problem?

1. Start PyWebDAV mounted to an empty folder:
$ rm -fr repos && mkdir repos && davserver -D repos -n -J

2. Upload first one file. I do this using the "nd" command line utility: 
$ nd -p arandomfile.txt http://localhost:8008/uploadedfile.txt

Notice how PyWebDAV returns a status code 201 (Created). This is correct 
behaviour (since the file didn't exist before, it was created).

3. Upload a second (different) file: nd -p anotherrandomfile.txt 
http://localhost:8008/uploadedfile.txt

Notice how PyWebDAV returns a status code 201 (Created). According to RFC 
2518[1], no specific HTTP response codes are defined for PUTs. However, if you 
can backtrack to RFC 2068[2] it states that "If a new resource is created, the 
origin server MUST inform the user agent via the 201 (Created) response.  If an 
existing resource is modified, either the 200 (OK) or 204 (No Content) response 
codes SHOULD be sent to indicate successful completion of the request.".

Expected outcome: Since the second put done in (3) above is not creating the 
file, but rather modifying it, I would expect pywebdav to return either a 200 
or a 204.

[1] https://tools.ietf.org/html/rfc2518#page-36
[2] https://tools.ietf.org/html/rfc2068#page-52

What version of the product are you using? On what operating system?

PyWebDAV 0.9.8 (just recently) installed through pip. I'm running Ubuntu Linux 
Lucid Lynx 10.04 LTS.

Please provide any additional information below.

I have no idea whether 200 or 204 response code is to be preferred. I'd love to 
know.

Original issue reported on code.google.com by jens.ran...@gmail.com on 29 May 2012 at 2:51