PUT should work fine. The default list of methods is:
./web/webapi.py: methods = ['GET', 'HEAD', 'POST', 'PUT', 'DELETE']
We can add more if anyone needs them.
web.input() only works if the incoming data is in key-value pairs;
usually with PUT you just get one big document so you need to call
web.data() instead.
Maybe if you spelled Content-Length correctly?
Works fine for me with 0.3:
$ telnet 0.0.0.0 8080
Trying 0.0.0.0...
Connected to 0.0.0.0.
Escape character is '^]'.
PUT / HTTP/1.0
Content-Length: 20
abcddddddddddddddd
HTTP/1.1 200 OK
Date: Tue, 05 Aug 2008 18:24:54 GMT
Server: CherryPy/3.1.0 WSGI Server
abcddddddddddddddd
Connection closed by foreign host.
You misspelled Content-length, which is probably the problem since
without it, the server doesn't know how much data to expect.
> HTTP/1.1 200 OK
> Date: Tue, 05 Aug 2008 17:53:18 GMT
> Server: CherryPy/3.0.1
--
Gary
http://blog.extracheese.org
=== modified file 'web/webapi.py'
--- web/webapi.py 2008-06-28 15:43:14 +0000
+++ web/webapi.py 2008-07-26 21:51:40 +0000
@@ -170,8 +170,8 @@
e = ctx.env.copy()
a = b = {}
- if _method.lower() in ['both', 'post']:
- if e['REQUEST_METHOD'] == 'POST':
+ if _method.lower() in ['both', 'post', 'put']:
+ if e['REQUEST_METHOD'] in ['POST', 'PUT']:
if e.get('CONTENT_TYPE', '').lower().startswith('multipart/'):
# since wsgi.input is directly passed to cgi.FieldStorage,
# it can not be called multiple times. Saving the FieldStorage
I dunno if it's the right way or if that has already been done elsewhere.
--
Yoan
Already fixed.