Skip to content

Commit

Permalink
lib: monkey: upgrade to v1.7.5
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo Silva <[email protected]>
  • Loading branch information
edsiper committed Jun 12, 2024
1 parent 7c8a4bb commit b17730d
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 77 deletions.
28 changes: 14 additions & 14 deletions lib/monkey/examples/list.c
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/* Monkey HTTP Daemon
* ------------------
* Copyright (C) 2012, Lauri Kasanen <[email protected]>
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */

/* Monkey HTTP Server
* ==================
* Copyright 2001-2017 Eduardo Silva <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* 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
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
* http://www.apache.org/licenses/LICENSE-2.0
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* 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.
*/

#include <libmonkey.h>
Expand Down
28 changes: 14 additions & 14 deletions lib/monkey/examples/quiz.c
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/* Monkey HTTP Daemon
* ------------------
* Copyright (C) 2012, Lauri Kasanen <[email protected]>
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */

/* Monkey HTTP Server
* ==================
* Copyright 2001-2017 Eduardo Silva <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* 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
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
* http://www.apache.org/licenses/LICENSE-2.0
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* 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.
*/

#include <libmonkey.h>
Expand Down
24 changes: 11 additions & 13 deletions lib/monkey/include/monkey/mk_api.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */

/* Monkey HTTP Server
* ------------------
* Copyright (C) 2001-2015, Eduardo Silva P. <[email protected]>
* ==================
* Copyright 2001-2017 Eduardo Silva <[email protected]>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
* 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
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
* http://www.apache.org/licenses/LICENSE-2.0
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* 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.
*/

#ifndef MONKEY_PLUGIN_API_H
Expand Down
24 changes: 11 additions & 13 deletions lib/monkey/include/monkey/monkey.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */

/* Monkey HTTP Server
* ------------------
* Copyright (C) 2001-2015, Eduardo Silva P. <[email protected]>
* ==================
* Copyright 2001-2017 Eduardo Silva <[email protected]>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
* 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
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
* http://www.apache.org/licenses/LICENSE-2.0
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* 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.
*/

#ifndef MK_MONKEY_H
Expand Down
2 changes: 1 addition & 1 deletion lib/monkey/monkey.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Version: 1.4.0
Release: 1%{?dist}
Summary: A fast and lightweight web server for Linux
Group: System Environment/Daemons
License: GPLv2+
License: Apache v2
URL: http://www.monkey-project.com
Source: http://www.monkey-project.com/releases/1.4/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Expand Down
38 changes: 16 additions & 22 deletions lib/monkey/qa/checklog
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
#!/usr/bin/env python

# Copyright (C) 2010, Eduardo Silva <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 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
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# http://www.apache.org/licenses/LICENSE-2.0
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# 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.

import os
import sys
Expand All @@ -27,7 +21,7 @@ ACCESS_FILE = '../logs/access.log'
ERROR_FILE = '../logs/error.log'

class AccessRule:
def __init__(self,
def __init__(self,
ip = None, time = None,
method = None, uri = None,
protocol = None, status = None,
Expand All @@ -46,7 +40,7 @@ class AccessRule:
if size.isdigit():
self.size = size
else:
if size[:8] == 'FILESIZE':
if size[:8] == 'FILESIZE':
target = size[8:].strip()
self.size = os.path.getsize(target)
else:
Expand Down Expand Up @@ -100,7 +94,7 @@ class Config(ConfigParser.ConfigParser):
message = self._get_value(section, 'message')

rule = ErrorRule(ip, time, error, message)

# Add rule to list
rules.append(rule)

Expand Down Expand Up @@ -155,7 +149,7 @@ class Logfile:
print " -h Show this help"
print
exit(1)

def get_last_file_line(self, file):
f = open(file, 'r')
lines = f.readlines()
Expand Down Expand Up @@ -206,11 +200,11 @@ class Logfile:
self.check_field(r.protocol, data['protocol'])
self.check_field(r.status, data['status'])
self.check_field(r.size, data['size'])

elif r.type == 'error':
line = self.get_last_file_line(ERROR_FILE)
fields = error_re.split(line)

# We always expect at least 4 fields
if len(fields) < 4:
if self.silent_mode is False:
Expand All @@ -233,7 +227,7 @@ class Logfile:

if self.silent_mode is False:
print "Check passed :)"

if __name__ == '__main__':
Logfile()

0 comments on commit b17730d

Please sign in to comment.