Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: Finding XML POST data in HTTP::Server::Simple::CGI

by Wiggins (Hermit)
on Mar 16, 2016 at 18:42 UTC ( [id://1157976]=note: print w/replies, xml ) Need Help??


in reply to Re: Finding XML POST data in HTTP::Server::Simple::CGI
in thread Finding XML POST data in HTTP::Server::Simple::CGI

Try with:
Content-type: application/xml

It is always better to have seen your target for yourself, rather than depend upon someone else's description.

  • Comment on Re^2: Finding XML POST data in HTTP::Server::Simple::CGI

Replies are listed 'Best First'.
Re^3: Finding XML POST data in HTTP::Server::Simple::CGI
by derby (Abbot) on Mar 16, 2016 at 19:18 UTC

    Ahh ... that bad decision of CGI tying the mime-type of application/xml to XFORMS ... use text/xml instead.

    -derby
      Unfortunately, I do not specify that. It is part of the developing TAXII/STIX standards. It would seem only right that the service be able to handle any XML content type.

      It is always better to have seen your target for yourself, rather than depend upon someone else's description.

        update: just saw the response to update CGI to properly handle application/xml. That may be a better idea than using CGI::Simple -- YMMMV.

        Then unfortunately you cannot use HTTP::Server::Simple::CGI out of the box, you'll need to tell it to use something other than CGI. The docs show how you could use CGI::Simple.

        my $server = SimpleSrv->new(8080); $server->cgi_class('CGI::Simple'); $server->cgi_init(sub { require CGI::Simple; }); $server->host('127.0.0.1'); $server->run();

        -derby
Re^3: Finding XML POST data in HTTP::Server::Simple::CGI
by Anonymous Monk on Mar 16, 2016 at 18:54 UTC

    Um, no, you try it and tell us what problems you had. (Because it works perfectly fine on my end, even with application/xml and even with the request in your first post.)

      Using the test program from above, I found the the Content type made a difference with the above script (on my system).

      tuser:/u1/data/MeerKat/taxiiSite$ telnet localhost 8080 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. POST /hello HTTP/1.1 Content-type: text/plain Content-length: 6 foobar HTTP/1.1 200 Content-Type: text/plain; charset=ISO-8859-1 <<<foobar>>> Connection closed by foreign host. tuser:/u1/data/MeerKat/taxiiSite$ telnet localhost 8080 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. POST /hello HTTP/1.1 Content-type: application/xml Content-length: 6 foobar HTTP/1.1 200 Content-Type: text/plain; charset=ISO-8859-1 <<<undef>>> Connection closed by foreign host.
      There may also be a difference between the result in the 'handle_request()' and the dispatched 'resp_hello()'.

      It is always better to have seen your target for yourself, rather than depend upon someone else's description.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1157976]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (1)
As of 2024-04-24 13:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found