couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jumbo jim <jumboji...@gmail.com>
Subject Delete a session with curl?
Date Wed, 11 Feb 2015 03:14:22 GMT
Hi,

I am trying to delete a session with Curl. Couchdb is on a remote server
(192.168.0.10).

Firstly, I create a session -
(I have shown verbose output to ensure I am specifying the cookie correctly)

curl -v -X POST http://192.168.0.10:5984/_session -d 'name=xxx&password=xxx'

--------------------------------
* About to connect() to 192.168.0.10 port 5984 (#0)
*   Trying 192.168.0.10... connected
> POST /_session HTTP/1.1
> User-Agent: curl/7.22.0 ...
> Host: 192.168.0.10:5984
> Accept: */*
> Content-Length: 29
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 29out of 29 bytes
< HTTP/1.1 200 OK
< Set-Cookie:
AuthSession=jDuE8378Ki8zOjU0REFDNzE2OpwCmt9Vf9N9FvdMLxE88qieL95j;
Version=1; Path=/; HttpOnly
< Server: CouchDB/1.6.1 (Erlang OTP/R14B04)
< Date: Wed, 11 Feb 2015 03:05:58 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 42
< Cache-Control: must-revalidate
<
{"ok":true,"name":"xxx","roles":[]}
* Connection #0 to host 192.168.0.10 left intact
* Closing connection #0
--------------------------------

Show/confirm session -

curl -X GET http://192.168.0.10:5984/_session  -H "Accept: application/json
Cookie: AuthSession=jDuE8378Ki8zOjU0REFDNzE2OpwCmt9Vf9N9FvdMLxE88qieL95j"

--------------------------------
> Cookie: AuthSession=jDuE8378Ki8zOjU0REFDNzE2OpwCmt9Vf9N9FvdMLxE88qieL95j"
{"ok":true,"userCtx":{"name":"xxx","roles":[]},"info":{"authentication_db":"_users","authentication_handlers":["oauth","cookie","default"],"authenticated":"cookie"}}
--------------------------------

Neither of the following messages will delete the session? -

curl -X DELETE http://192.168.0.10:5984/_session  -H "Accept:
application/json
Cookie: AuthSession=jDuE8378Ki8zOjU0REFDNzE2OpwCmt9Vf9N9FvdMLxE88qieL95j;
Version=1; Path=/; HttpOnly"

curl -v -X DELETE http://192.168.0.10:5984/_session --cookie
AuthSession=jDuE8378Ki8zOjU0REFDNzE2OpwCmt9Vf9N9FvdMLxE88qieL95j -H
"X-CouchDB-WWW-Authenticate: Cookie" -H "Content-Type:
application/x-www-form-urlencoded"


I keep getting "HTTP/1.1 200 OK", but the session still persists with I run
a GET query again.

I have also tried both DELETE methods above with only using
"AuthSession=jDuE8378Ki8zOjU0REFDNzE2OpwCmt9Vf9N9FvdMLxE88qieL95j" as the
cookie.

Does anyone know what I am missing?

Thanks.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message