Skip to content

Commit

Permalink
ver 1.2, add post_max_size to config
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeniy Golovin committed Jun 17, 2014
1 parent deca65a commit 605cc41
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions conf/etc/os-fcgi/conf.os
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ return {
threads = 8,
listen = ":9000",

post_max_size = 1024*1024*8,
}
12 changes: 8 additions & 4 deletions os-fcgi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "3rdparty/MPFDParser-1.0/Parser.h"
#include <stdlib.h>

#define OS_FCGI_VERSION OS_TEXT("1.1.3")
#define OS_FCGI_VERSION OS_TEXT("1.2")

#include <sys/types.h>
#include <sys/stat.h>
Expand Down Expand Up @@ -74,6 +74,7 @@ char init_cache_path[128] =
#endif
;
int listen_socket = 0;
int post_max_size = 0;

#include <cstdio>

Expand Down Expand Up @@ -374,7 +375,7 @@ class FCGX_OS: public OS
getProperty("CONTENT_LENGTH");
int content_length = popInt();

int post_max_size = 1024*1024*8;
// int post_max_size = 1024*1024*8;
if(content_length > post_max_size){
FCGX_FPrintF(request->out, "POST Content-Length of %d bytes exceeds the limit of %d bytes", content_length, post_max_size);
return;
Expand Down Expand Up @@ -769,8 +770,9 @@ int main(int argc, char * argv[])
const char * config_flename = "/etc/os-fcgi/conf.os";
#endif
os->require(config_flename, false, 1);
threads = (os->getProperty(-1, "threads"), os->popInt());
OS::String listen = (os->getProperty(-1, "listen"), os->popString(":9000"));
threads = (os->getProperty(-1, "threads"), os->popInt());
OS::String listen = (os->getProperty(-1, "listen"), os->popString(":9000"));
post_max_size = (os->getProperty(-1, "post_max_size"), os->popInt(1024*1024*8));
os->release();

int listen_queue_backlog = 400;
Expand All @@ -793,6 +795,7 @@ int main(int argc, char * argv[])
threads = MAX_THREAD_COUNT;
}
printf("threads: %d\n", threads);
printf("post_max_size: %.1f Mb\n", (float)post_max_size / (1024.0f * 1024.0f));
demonize();

pthread_t id[MAX_THREAD_COUNT];
Expand All @@ -802,6 +805,7 @@ int main(int argc, char * argv[])
#else
threads = 1;
printf("threads: %d\n", threads);
printf("post_max_size: %.1f Mb\n", (float)post_max_size / (1024.0f * 1024.0f));
#endif
doit(NULL);

Expand Down

0 comments on commit 605cc41

Please sign in to comment.