in reply to Getting POST data from HTTP Request

You don't show the code for http_request_handler. That function appears to be passed a filehandle to read the HTTP body from. The filehandle is unlikely to produce a proper EOF marker, so the request handler should peek at $req->{HEADER}{'Content-Length'}.

Any particular reason you're not using HTTP::Daemon, HTTP::Daemon::SSL, HTTP::Server::Simple, Starlet, Starman, Gepok or any other of the fine HTTP servers on CPAN? You'll save yourself a lot of work and get a better quality solution. There are, for example, at least two bugs in your parsing of HTTP headers.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Replies are listed 'Best First'.
Re^2: Getting POST data from HTTP Request
by nss12 (Novice) on May 16, 2012 at 11:48 UTC
    Thanks for the reply. The main aim was really to play around and learn, eventually perhaps incorporating it into another project. Thanks for the EOF tip too, using content length seems to do the trick, but you're right in that it's a little fragile. Perhaps I'll move onto using one of the CPAN HTTP servers - saves bother now that I've satisfied my need for experimentation. Cheers.