X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuhttpd.git;a=blobdiff_plain;f=main.c;h=31700c7d66f474a86e59b8da2822a32abd410590;hp=11d2e547faea048aad0f844ab79b2a468f8fdb52;hb=7bd66ddacb6b87a927b7846a44c02c0df7988c71;hpb=48e1a4df5a74f1c4c0e19d94977d4d5efc76a2ff diff --git a/main.c b/main.c index 11d2e54..31700c7 100644 --- a/main.c +++ b/main.c @@ -1,20 +1,20 @@ /* * uhttpd - Tiny single-threaded httpd * - * Copyright (C) 2010-2012 Jo-Philipp Wich - * Copyright (C) 2012 Felix Fietkau + * Copyright (C) 2010-2013 Jo-Philipp Wich + * Copyright (C) 2013 Felix Fietkau * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #define _BSD_SOURCE @@ -132,7 +132,8 @@ static int usage(const char *name) " -S Do not follow symbolic links outside of the docroot\n" " -D Do not allow directory listings, send 403 instead\n" " -R Enable RFC1918 filter\n" - " -n count Maximum allowed number of concurrent requests\n" + " -n count Maximum allowed number of concurrent script requests\n" + " -N count Maximum allowed number of concurrent connections\n" #ifdef HAVE_LUA " -l string URL prefix for Lua handler, default is '/lua'\n" " -L file Lua handler script, omit to disable Lua\n" @@ -159,7 +160,8 @@ static void init_defaults(void) conf.script_timeout = 60; conf.network_timeout = 30; conf.http_keepalive = 20; - conf.max_requests = 3; + conf.max_script_requests = 3; + conf.max_connections = 100; conf.realm = "Protected Area"; conf.cgi_prefix = "/cgi-bin"; conf.cgi_path = "/sbin:/usr/sbin:/bin:/usr/bin"; @@ -201,7 +203,7 @@ int main(int argc, char **argv) init_defaults(); signal(SIGPIPE, SIG_IGN); - while ((ch = getopt(argc, argv, "fSDRC:K:E:I:p:s:h:c:l:L:d:r:m:n:x:i:t:k:T:A:u:U:")) != -1) { + while ((ch = getopt(argc, argv, "fSDRC:K:E:I:p:s:h:c:l:L:d:r:m:n:N:x:i:t:k:T:A:u:U:")) != -1) { bool tls = false; switch(ch) { @@ -253,7 +255,11 @@ int main(int argc, char **argv) break; case 'n': - conf.max_requests = atoi(optarg); + conf.max_script_requests = atoi(optarg); + break; + + case 'N': + conf.max_connections = atoi(optarg); break; case 'x':