fastcgipp-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fastcgipp-users] post problem


From: xamiw
Subject: [Fastcgipp-users] post problem
Date: Wed, 22 Apr 2009 22:43:43 +0200 (CEST)

Hi all!

I've tried a small example for posting data (which is derived by the echo 
example of the docs).

The problem: If I post some content I'll hang up the webserver. I got no 
feedback and the cpu goes up to 100%. I have to restart to load the website 
again.

Thanks in advance, Goran




#include <fstream>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <fastcgi++/request.hpp>
#include <fastcgi++/manager.hpp>

class Post : public Fastcgipp::Request<wchar_t>
{
   bool response()
   {
      out << "Content-Type: text/html; charset=utf-8\r\n\r\n";
      out << "<html><head><meta http-equiv='Content-Type' content='text/html; 
charset=utf-8' />";
      out << "<title>fastcgi++: Post</title></head><body>";
      out << "<h1>Post Data</h1>";

      if(environment.posts.size())
         for(Fastcgipp::Http::Environment<wchar_t>::Posts::iterator 
it=environment.posts.begin(); it!=environment.posts.end(); ++it)
         {
            out << "<h2>" << it->first << "</h2>";
            if(it->second.type==Fastcgipp::Http::Post<wchar_t>::form)
            {
               out << "<p><b>Type:</b> form data<br />";
               out << "<b>Value:</b> " << it->second.value << "</p>";
            }
            
            else
            {
               out << "<p><b>Type:</b> file<br />";
               out << "<b>Filename:</b> " << it->second.value << "<br />";
               out << "<b>Size:</b> " << it->second.size << "<br />";
               out << "<b>Data:</b></p><pre>";
               out.dump(it->second.data.get(), it->second.size);
               out << "</pre>";
            }
         }
      else
         out << "<p>No post data</p>";

      out << "<form action=\"http://localhost/myapp.fcgi\"; method=\"post\">";
      out << "  <p>name: <input name=\"name\" size=\"40\"></p>";
      out << "  <p><input type=\"submit\" value=\"send\"></p>";
      out << "</form>";
      out << "</body></html>";
      return true;
   }
};

int main()
{
  Fastcgipp::Manager<Post> fcgi;
  fcgi.handler();
}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]