Permalink
Browse files

Make POST data available in csgi.input

  • Loading branch information...
1 parent 7eae097 commit 6a75f34f552793e8885c73febcad5ecb85d1257a @tadzik committed Apr 9, 2012
Showing with 9 additions and 0 deletions.
  1. +9 −0 csgi.cpp
View
@@ -122,6 +122,15 @@ CSGI::Env CSGI::Server::parse_request(int fd)
env[k] = v;
}
+ if (env.count("HTTP_CONTENT-LENGTH")) {
+ int n = atoi(env["HTTP_CONTENT-LENGTH"].c_str());
+ char * buf = new char[n + 1];
+ s.read(buf, n);
+ buf[n] = '\0';
+ env["csgi.input"] = std::string(buf);
+ delete []buf;
+ }
+
return env;
}

0 comments on commit 6a75f34

Please sign in to comment.