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

I think you'll need to provide us with a runnable example that reproduces the problem (see http://sscce.org/). POSTDATA works fine for me:

{ package SimpleSrv; use parent 'HTTP::Server::Simple::CGI'; sub handle_request { my ($self,$cgi) = @_; print "HTTP/1.1 200\x0D\x0A"; print $cgi->header(-type=>'text/plain'); print "<<<".($cgi->param('POSTDATA')//"undef").">>>\n"; } } my $server = SimpleSrv->new(8080); $server->host('127.0.0.1'); $server->run();

Example:

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

Replies are listed 'Best First'.
Re^2: Finding XML POST data in HTTP::Server::Simple::CGI
by Wiggins (Hermit) on Mar 16, 2016 at 18:42 UTC
    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.

      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.

      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.