Skip to content

Commit

Permalink
introduced open PSGI plugin for uWSGI
Browse files Browse the repository at this point in the history
  • Loading branch information
roberto@sirius committed Apr 13, 2010
1 parent 8caee1b commit 299fd9c
Show file tree
Hide file tree
Showing 5 changed files with 395 additions and 5 deletions.
6 changes: 2 additions & 4 deletions plugins/example/example_plugin.c
@@ -1,17 +1,15 @@
#include "../../uwsgi.h"

/* gcc `python-config --cflags` `python ../../uwsgiconfig.py --cflags` -o example_plugin.so -fPIC -shared example_plugin.c */

int uwsgi_init(struct uwsgi_server *uwsgi, char *args){
fprintf(stderr,"i am the example plugin initialization function with arg: %s\n", args);
return 0;
}

int uwsgi_request(struct uwsgi_server *uwsgi, struct wsgi_request *wsgi_req) {

char *http = "HTTP/1.1 200 Ok\r\nContent-type: text/html\r\n\r\n<h1>Hello World</h1>" ;
wsgi_req->response_size += write(uwsgi->poll.fd, http, strlen(http));

fprintf(stderr,"UWSGI POLL: %p\n", &uwsgi->poll);
wsgi_req->response_size += write(wsgi_req->poll.fd, http, strlen(http));

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/lua/lua_plugin.c
Expand Up @@ -93,7 +93,7 @@ int uwsgi_request(struct uwsgi_server *uwsgi, struct wsgi_request *wsgi_req) {
char *ptrbuf;

/* Standard WSAPI request */
if (!wsgi_req->size) {
if (!wsgi_req->uh.pktsize) {
fprintf (stderr, "Invalid WSAPI request. skip.\n");
return -1;
}
Expand Down

0 comments on commit 299fd9c

Please sign in to comment.