Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl (http://www.velocityreviews.com/forums/f17-perl.html)
-   -   CGI and multipart/related data (http://www.velocityreviews.com/forums/t25340-cgi-and-multipart-related-data.html)

Simon Callan 09-02-2004 03:21 PM

CGI and multipart/related data
 
I'm trying to implement a WAP Push Protocol Gateway, using Push Access
Protocol over HTTP, and I'm having problems.

Ignoring all the buzzwords, my CGI program receives a post something
like:

POST /cgi-bin/wap_push.cgi HTTP/1.1
Host: www.wireless-network.com
Date: Sun, 16 May 1999 18:13:23 GMT
Content-Type: multipart/related; boundary=asdf; type="application/xml"
Content-Length: 353

--asdf
Content-Type: application/xml
<?xml version="1.0"?>
<!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAD 2.0//EN"
"http://www.wapforum.org/DTD/pap_2.0.dtd"
[<?wap-pap-ver supported-version="2.0,1.*"?>]>
<pap>
...control...
</pdp>
--asdf
...content entity ..
--asdf--

The first problem ism how do I extract the multipart/related data? The
CGI modules do not appear to handle this sort of stuff, and despitre
searching www.perl.com and CPAN, I cannot see any obvious modules that
do what I want.

I think that XML::Simple will be suitable for the simple XML i expect,
but if anyone has any better suggestions, I would be more than happy
to receive them.

Thanks,

Simon Callan

Andres Monroy-Hernandez 09-14-2004 03:54 AM

Re: CGI and multipart/related data
 
I would parse STDIN and put everything after "Content-Type:
application/xml" into a $string. Then use XML::SAX or XML::Twig to
parse the data. It all depends on what you want to do with the XML
data.

--
Andrés Monroy-Hernández

simon@callan.demon.co.uk (Simon Callan) wrote in message news:<31bc3bbc.0409020721.28a66cb8@posting.google. com>...
> I'm trying to implement a WAP Push Protocol Gateway, using Push Access
> Protocol over HTTP, and I'm having problems.
>
> Ignoring all the buzzwords, my CGI program receives a post something
> like:
>
> POST /cgi-bin/wap_push.cgi HTTP/1.1
> Host: www.wireless-network.com
> Date: Sun, 16 May 1999 18:13:23 GMT
> Content-Type: multipart/related; boundary=asdf; type="application/xml"
> Content-Length: 353
>
> --asdf
> Content-Type: application/xml
> <?xml version="1.0"?>
> <!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAD 2.0//EN"
> "http://www.wapforum.org/DTD/pap_2.0.dtd"
> [<?wap-pap-ver supported-version="2.0,1.*"?>]>
> <pap>
> ..control...
> </pdp>
> --asdf
> ..content entity ..
> --asdf--
>
> The first problem ism how do I extract the multipart/related data? The
> CGI modules do not appear to handle this sort of stuff, and despitre
> searching www.perl.com and CPAN, I cannot see any obvious modules that
> do what I want.
>
> I think that XML::Simple will be suitable for the simple XML i expect,
> but if anyone has any better suggestions, I would be more than happy
> to receive them.
>
> Thanks,
>
> Simon Callan


Simon Callan 09-16-2004 10:07 AM

Re: CGI and multipart/related data
 
andres@monroy.com (Andres Monroy-Hernandez) wrote:

> I would parse STDIN and put everything after "Content-Type:
> application/xml" into a $string. Then use XML::SAX or XML::Twig to
> parse the data. It all depends on what you want to do with the XML
> data.


Handling the XML bit is simple - I'm simply throwing it at
XML::Simple.

The biggest problem is that none of the CGI packages I have seen cope
with multipart/related data, so I had to write that bit myself.

Simon


All times are GMT. The time now is 12:34 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.