TestInABox / stackInAWSGI

Loading StackInABox into a WSGI for additional testing needs
Apache License 2.0
2 stars 1 forks source link

Session Bug #11

Closed BenjamenMeyer closed 8 years ago

BenjamenMeyer commented 8 years ago
bmeyer@blu:~/stackInAWSGI/examples/gunicorn$ curl -v -X POST http://localhost:8081/admin/
* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8081 (#0)
> POST /admin/ HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:8081
> Accept: */*
> 
< HTTP/1.1 201
* Server gunicorn/19.6.0 is not blacklisted
< Server: gunicorn/19.6.0
< Date: Fri, 17 Jun 2016 18:57:39 GMT
< Connection: close
< Transfer-Encoding: chunked
< HOST: localhost:8081
< x-session-id: e8e77a94-ff88-4d14-b45f-7b7cf6fc2340
< location: http://localhost/stackinabox//e8e77a94-ff88-4d14-b45f-7b7cf6fc2340/
< ACCEPT: */*
< USER_AGENT: curl/7.35.0
< 
* Closing connection 0
bmeyer@blu:~/stackInAWSGI/examples/gunicorn$ curl -X GET http://localhost/stackinabox//e8e77a94-ff88-4d14-b45f-7b7cf6fc2340/hello/
curl: (7) Failed to connect to localhost port 80: Connection refused
bmeyer@blu:~/stackInAWSGI/examples/gunicorn$ curl -X GET http://localhost:8081/stackinabox//e8e77a94-ff88-4d14-b45f-7b7cf6fc2340/hello/
StackInAWSGI - Missing Session
bmeyer@blu:~/stackInAWSGI/examples/gunicorn$ 
bmeyer@blu:~/stackInAWSGI/examples/gunicorn$ curl -X GET http://localhost:8081/stackinabox/e8e77a94-ff88-4d14-b45f-7b7cf6fc2340/hello/
StackInAWSGI - Unknown Session
bmeyer@blu:~/stackInAWSGI/examples/gunicorn$ 

Issues:

BenjamenMeyer commented 8 years ago

Confirmed that the session survives the WSGI call. However, the global dict is not truly global - it's limited to the workers (at least under gunicorn). It may be necessary to add an optional class used to create the global data hold consisting of:

Looking at gunicorn there doesn't seem any documentation on how to do have cross-worker communications. Contacting them on IRC via #gunicorn.

BenjamenMeyer commented 8 years ago

PR #12 fixes the duplicate '/' in the location url

BenjamenMeyer commented 8 years ago

PR #13 fixes the location URL issue; however, the issue of sessions between multiple workers still needs to be worked out.

BenjamenMeyer commented 8 years ago

Documenting for uwsgi and gunicorn as supporting a single worker only until this issue is resolved.