mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-08-26 16:28:00 +00:00
ported the xslt plugin to the new api
This commit is contained in:
+1
-1
@@ -1,3 +1,3 @@
|
||||
[uwsgi]
|
||||
main_plugin = python,gevent,psgi,lua,php,rack,jvm,jwsgi,ring,mono,transformation_toupper,coroae,v8,cgi
|
||||
main_plugin = python,gevent,psgi,lua,php,rack,jvm,jwsgi,ring,mono,transformation_toupper,coroae,v8,cgi,xslt,webdav
|
||||
inherit = base
|
||||
|
||||
@@ -2,7 +2,7 @@ import os
|
||||
|
||||
NAME='xslt'
|
||||
CFLAGS = os.popen('xslt-config --cflags').read().rstrip().split()
|
||||
LDFLAGS = os.popen('xslt-config --libs').read().rstrip().split()
|
||||
LIBS = []
|
||||
LDFLAGS = []
|
||||
LIBS = os.popen('xslt-config --libs').read().rstrip().split()
|
||||
|
||||
GCC_LIST = ['xslt']
|
||||
|
||||
+8
-13
@@ -316,9 +316,10 @@ static void uwsgi_xslt_log(struct wsgi_request *wsgi_req) {
|
||||
log_request(wsgi_req);
|
||||
}
|
||||
|
||||
static int transform_toxslt(struct wsgi_request *wsgi_req, struct uwsgi_buffer *ub, struct uwsgi_buffer **new, void *data) {
|
||||
static int transform_toxslt(struct wsgi_request *wsgi_req, struct uwsgi_transformation *ut) {
|
||||
int ret = -1;
|
||||
struct uwsgi_transformation_xslt_conf *utxc = (struct uwsgi_transformation_xslt_conf *) data;
|
||||
struct uwsgi_transformation_xslt_conf *utxc = (struct uwsgi_transformation_xslt_conf *) ut->data;
|
||||
struct uwsgi_buffer *ub = ut->chunk;
|
||||
|
||||
xmlDoc *doc = xmlReadMemory(ub->buf, ub->pos, NULL, NULL, 0);
|
||||
if (!doc) goto end;
|
||||
@@ -327,18 +328,12 @@ static int transform_toxslt(struct wsgi_request *wsgi_req, struct uwsgi_buffer *
|
||||
char *output = uwsgi_xslt_apply( doc, utxc->stylesheet->buf, utxc->params ? utxc->params->buf : NULL, &rlen);
|
||||
if (!output) goto end;
|
||||
|
||||
if (uwsgi_response_prepare_headers_int(wsgi_req, wsgi_req->status)) goto end;
|
||||
if (uwsgi_response_add_content_length(wsgi_req, rlen)) goto end;
|
||||
if (uwsgi_response_add_content_type(wsgi_req, utxc->content_type->buf, utxc->content_type->pos)) goto end;
|
||||
|
||||
*new = uwsgi_buffer_new(rlen);
|
||||
if (uwsgi_buffer_append(*new, output, rlen)) {
|
||||
xmlFree(output);
|
||||
uwsgi_buffer_destroy(*new);
|
||||
*new = NULL;
|
||||
goto end;
|
||||
// do not check for errors !!!
|
||||
if (ut->round == 1) {
|
||||
uwsgi_response_add_content_type(wsgi_req, utxc->content_type->buf, utxc->content_type->pos);
|
||||
}
|
||||
xmlFree(output);
|
||||
|
||||
uwsgi_buffer_map(ub, output, rlen);
|
||||
ret = 0;
|
||||
|
||||
end:
|
||||
|
||||
Reference in New Issue
Block a user