Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > CGI and multipart/related data

Reply
Thread Tools

CGI and multipart/related data

 
 
Simon Callan
Guest
Posts: n/a
 
      09-02-2004
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
 
Reply With Quote
 
 
 
 
Andres Monroy-Hernandez
Guest
Posts: n/a
 
      09-14-2004
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) wrote in message news:<. 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

 
Reply With Quote
 
 
 
 
Simon Callan
Guest
Posts: n/a
 
      09-16-2004
(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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
(CGI-Target)Could not connect to CGI-Proxy John Smith Java 0 05-15-2006 09:21 PM
cgi and cgi-bin zippy Perl Misc 5 02-02-2005 01:46 AM
Python CGI - Accepting Input, Invoking Another Process, Ending CGI LarsenMTL Python 4 11-04-2004 05:59 PM
Calling cgi from cgi thru 'system' function. Different behaviour on browser v/s cmd line Shailan Perl 2 12-15-2003 04:26 PM
Re: CGI Perl "use CGI" statement fail Jürgen Exner Perl 0 07-31-2003 02:00 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57