CGI and multipart/related data

Discussion in 'Perl' started by Simon Callan, Sep 2, 2004.

  1. Simon Callan

    Simon Callan Guest

    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, Sep 2, 2004
    #1
    1. Advertising

  2. 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:<>...
    > 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, Sep 14, 2004
    #2
    1. Advertising

  3. Simon Callan

    Simon Callan Guest

    (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
    Simon Callan, Sep 16, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris Curvey

    cgi and multipart/form-data?

    Chris Curvey, Mar 29, 2005, in forum: Python
    Replies:
    1
    Views:
    1,229
    Chris Curvey
    Mar 29, 2005
  2. Edwinah63
    Replies:
    9
    Views:
    4,582
    Edwinah63
    Sep 21, 2007
  3. Martin Hart

    CGI and multipart data

    Martin Hart, Feb 26, 2004, in forum: Ruby
    Replies:
    4
    Views:
    243
    Paul Vudmaska
    Feb 26, 2004
  4. Stefan Fischer
    Replies:
    2
    Views:
    237
    Stefan Fischer
    Feb 23, 2010
  5. Replies:
    1
    Views:
    388
Loading...

Share This Page