CGI and multipart/related data

S

Simon Callan

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
 
A

Andres Monroy-Hernandez

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.
 
S

Simon Callan

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,125
Latest member
VinayKumar Nevatia_
Top