int port;
int iocp;
int verbose;
+ int max_body_size;
int unlink;
const char *unixsock;
" -U - bind to unix socket\n"
" -u - unlink unix socket before bind\n"
" -I - IOCP\n"
+ " -m - max body size\n"
" -v - verbosity, enables libevent debug logging too\n", prog);
exit(exit_code);
}
memset(&o, 0, sizeof(o));
- while ((opt = getopt(argc, argv, "hp:U:uIv")) != -1) {
+ while ((opt = getopt(argc, argv, "hp:U:m:uIv")) != -1) {
switch (opt) {
case 'p': o.port = atoi(optarg); break;
case 'U': o.unixsock = optarg; break;
case 'u': o.unlink = 1; break;
case 'I': o.iocp = 1; break;
+ case 'm': o.max_body_size = atoi(optarg); break;
case 'v': ++o.verbose; break;
case 'h': print_usage(stdout, argv[0], 0); break;
default : fprintf(stderr, "Unknown option %c\n", opt); break;
/* We want to accept arbitrary requests, so we need to set a "generic"
* cb. We can also add callbacks for specific paths. */
evhttp_set_gencb(http, send_document_cb, &o);
+ if (o.max_body_size)
+ evhttp_set_max_body_size(http, o.max_body_size);
if (o.unixsock) {
#ifdef EVENT__HAVE_STRUCT_SOCKADDR_UN