httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dariusz Suchojad" <ds...@gefira.pl>
Subject Parsing POST submitted XML with apreq2
Date Sun, 29 Mar 2009 12:53:03 GMT
Hello,

I'm using apreq2 (Ubuntu Intrepid version 2.08-5build1) and I'm trying to
parse the incoming POST submitted XML requests with it, however the very
simple code below fails to build the body_table with APREQ_ERROR_NOPARSER.

I've checked the latest SVN code and on one hand it seems apreq2 is trying
to MIME-restrict itself to "application/x-www-form-urlencoded",
"multipart/form-data" and "multipart/related" in
library/parser.c:apreq_pre_initialize.

Yet on the other hand there's a
APREQ_DECLARE_HOOK(apreq_hook_apr_xml_parser) in the same source code file
which is in use in library/t/parsers.c:parse_related.

I haven't yet investigated it any closer but is what parse_related does the
way to parse XML (both text/xml and application/xml) with apreq2? Can't it
be done with apreq_body?

Thanks for pointers!

static int test_handle(request_rec *r)
{

    if(!r->handler || strcmp(r->handler, "test")) {
        return DECLINED;
    }

    apreq_handle_t *req;
    const apr_table_t* body_table;
    apr_status_t status;

    req = (apreq_handle_t *)apreq_handle_apache2(r);
    status = apreq_body(req, &body_table);

    if(body_table != NULL) {
        /* Do something useful here */
    }
    else {
        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, APR_SUCCESS, r,
            "body_table status [%d] [%d]", status, APREQ_ERROR_NOPARSER);
    }

    return OK;
}


-- 
Dariusz Suchojad

gefira / the knowledge company
http://www.gefira.pl

Trackeria / online issue tracker
https://www.trackeria.com

Mime
View raw message