Revision 643132366637 () - Diff

Link to this snippet: https://friendpaste.com/4dbdw6pscRwNHoxpswklUH
Embed:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
>>> sock = socket.create_connection(("127.0.0.1", 5984))
>>> sock.send('PUT /testdb/hum1 HTTP/1.1\r\nHost: 127.0.0.1:5984\r\nAccept-Encoding: identity\r\nContent-Length: 2\r\nContent-Type: application/octet-stream\r\nExpect: 100-continue\r\nUser-Agent: restkit/0.9.2\r\n\r\n')
186
>>> sock.recv(4096)'HTTP/1.1 100 Continue\r\n\r\n'
>>> sock.send("{}")2
>>> sock.recv(4096)'HTTP/1.1 201 Created\r\nServer: CouchDB/0.11.0b22c551bb-git (Erlang OTP/R13B)\r\nLocation: http://127.0.0.1:5984/testdb/hum1\r\nEtag: "1-967a00dff5e02add41819138abb3284d"\r\nDate: Fri, 18 Dec 2009 20:49:48 GMT\r\nContent-Type: text/plain;charset=utf-8\r\nContent-Length: 67\r\nCache-Control: must-revalidate\r\n\r\n{"ok":true,"id":"hum1","rev":"1-967a00dff5e02add41819138abb3284d"}\n'
>>> sock = socket.create_connection(("127.0.0.1", 5984))
>>> sock.send('PUT /testdb/hum1/att1 HTTP/1.1\r\nHost: 127.0.0.1:5984\r\nAccept-Encoding: identity\r\nContent-Length: 2\r\nContent-Type: application/octet-stream\r\nExpect: 100-continue\r\nUser-Agent: restkit/0.9.2\r\n\r\n')
191
>>> sock.recv(4096)
'HTTP/1.1 409 Conflict\r\nServer: CouchDB/0.11.0b22c551bb-git (Erlang OTP/R13B)\r\nDate: Fri, 18 Dec 2009 20:50:22 GMT\r\nContent-Type: text/plain;charset=utf-8\r\nContent-Length: 58\r\nCache-Control: must-revalidate\r\n\r\n{"error":"conflict","reason":"Document update conflict."}\n'
>>> sock = socket.create_connection(("127.0.0.1", 5984))
>>> sock.send('PUT /testdb/hum1/att1?rev=1-967a00dff5e02add41819138abb3284d HTTP/1.1\r\nHost: 127.0.0.1:5984\r\nAccept-Encoding: identity\r\nContent-Length: 2\r\nContent-Type: application/octet-stream\r\nExpect: 100-continue\r\nUser-Agent: restkit/0.9.2\r\n\r\n')
230
>>> sock.recv(4096)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
socket.error: [Errno 54] Connection reset by peer
>>> sock = socket.create_connection(("127.0.0.1", 5984), 2)>>> sock.send('PUT /testdb/hum1/att1?rev=1-967a00dff5e02add41819138abb3284d HTTP/1.1\r\nHost: 127.0.0.1:5984\r\nAccept-Encoding: identity\r\nContent-Length: 2\r\nContent-Type: application/octet-stream\r\nExpect: 100-continue\r\nUser-Agent: restkit/0.9.2\r\n\r\n')
230
>>> sock.recv(4096)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
socket.timeout: timed out