Bug fix to Remote Backups
@@ -1,24 +0,0 @@
|
||||
# http://editorconfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{cpp,h}]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
tab_width = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.sh]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.php]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
@@ -1,80 +0,0 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
Project(openlitespeed)
|
||||
INCLUDE( ${PROJECT_SOURCE_DIR}/CMakeModules/common.cmake)
|
||||
|
||||
set(openlitespeed_MAJOR_VERSION 1)
|
||||
set(openlitespeed_MINOR_VERSION 4)
|
||||
set(openlitespeed_PATCH_VERSION 0)
|
||||
set(openlitespeed_VERSION
|
||||
${FOOBAR_MAJOR_VERSION}.${FOOBAR_MINOR_VERSION}.${FOOBAR_PATCH_VERSION})
|
||||
|
||||
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
include_directories( include ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/include/)
|
||||
link_directories( ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/lib/)
|
||||
|
||||
SET (CMAKE_C_COMPILER "/usr/bin/clang")
|
||||
SET (CMAKE_CXX_COMPILER "/usr/bin/clang++")
|
||||
|
||||
#set(MY_CMAKE_WARNING_FLAG " -Wall -Wextra -Wno-unused-parameter")
|
||||
#set(MY_CMAKE_WARNING_FLAG " -Wall -Wextra -Wno-unused-parameter -fsanitize=address -fno-omit-frame-pointer")
|
||||
#set(MY_CMAKE_WARNING_FLAG " -Wall -Wextra -Wno-unused-parameter -fno-omit-frame-pointer")
|
||||
set(MY_CMAKE_WARNING_FLAG " -Wall -Wextra -Wno-unused-parameter -fsanitize=address -fsanitize-recover=address -fno-omit-frame-pointer")
|
||||
#set(MY_CMAKE_WARNING_FLAG " -Wall -Wextra -Wno-unused-parameter")
|
||||
set(MY_CMAKE_POOL_FLAG " -DPOOL_TESTING -DUSE_VALGRIND")
|
||||
#set(MY_CMAKE_POOL_FLAG " -DPOOL_TESTING")
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MY_CMAKE_WARNING_FLAG} ${MY_CMAKE_POOL_FLAG}")
|
||||
#set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${MY_CMAKE_WARNING_FLAG}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_CMAKE_WARNING_FLAG} ${MY_CMAKE_POOL_FLAG}")
|
||||
#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${MY_CMAKE_WARNING_FLAG}")
|
||||
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
|
||||
|
||||
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
|
||||
find_package(ZLIB REQUIRED)
|
||||
##find_package(LibLdap REQUIRED)
|
||||
find_package(PCRE REQUIRED)
|
||||
find_package(EXPAT REQUIRED)
|
||||
#find_package(OpenSSL REQUIRED)
|
||||
|
||||
|
||||
execute_process( COMMAND ${PROJECT_SOURCE_DIR}/dlossl.sh )
|
||||
execute_process( COMMAND ${PROJECT_SOURCE_DIR}/src/modules/pagespeed/dlpsol.sh )
|
||||
|
||||
##########################################################################################
|
||||
#If you want to link libUnitTest++, just un-comment out the following commands
|
||||
#AND YOU NEED TO INSTALL it to the directory /src/test/unittest-cpp/UnitTest++/
|
||||
add_definitions(-DRUN_TEST)
|
||||
set(libUnitTest libUnitTest++.a)
|
||||
##########################################################################################
|
||||
#If you want to use BoringSSL, just un-comment out the following commands
|
||||
#AND YOU NEED TO HAVE THE files ready in openlitespeed/ssl
|
||||
#You can run the dlbssl.sh to make them ready
|
||||
set(BSSL_ADD_LIB libdecrepit.a)
|
||||
##########################################################################################
|
||||
#If you want to use Brotli Compression, just un-comment out the following commands
|
||||
#set(BROTLI_ADD_LIB libbrotlidec.a libbrotlienc.a libbrotlicommon.a)
|
||||
#add_definitions(-DUSE_BROTLI)
|
||||
##########################################################################################
|
||||
#If you want to use IP2Location, just un-comment out the following commands
|
||||
set(IP2LOC_ADD_LIB libIP2Location.a)
|
||||
add_definitions(-DUSE_IP2LOCATION)
|
||||
##########################################################################################
|
||||
|
||||
|
||||
add_definitions(-DTEST_OUTPUT_PLAIN_CONF)
|
||||
#add_definitions(-DLS_VG_DEBUG)
|
||||
#add_definitions(-DDEBUG_POOL)
|
||||
add_definitions(-DOPENSSL_NO_CXX)
|
||||
|
||||
execute_process( COMMAND getconf LFS_CFLAGS
|
||||
OUTPUT_VARIABLE LFS_CFLAGS )
|
||||
|
||||
add_definitions( ${LFS_CFLAGS} )
|
||||
add_definitions(-DUSE_UDNS)
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(test)
|
||||
@@ -1,69 +0,0 @@
|
||||
# Try and find libldap.
|
||||
# As soon as libldap has been found, the following variables will be defined:
|
||||
#
|
||||
# LIBLDAP_FOUND
|
||||
# LDAP_INCLUDE_DIR
|
||||
# LDAP_LIBRARY:FILEPATH
|
||||
#
|
||||
#
|
||||
# Copyright (c) 2009 Juergen Leising <jleising@users.sourceforge.net>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the New
|
||||
# BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
#
|
||||
|
||||
|
||||
MESSAGE(STATUS "checking for libldap and liblber...")
|
||||
|
||||
FIND_PATH(LDAP_INCLUDE_DIR NAMES ldap.h
|
||||
PATHS /include /usr/include /usr/local/include /usr/share/include /opt/include
|
||||
DOC "Try and find the header file ldap.h")
|
||||
|
||||
FIND_PATH(LBER_INCLUDE_DIR NAMES lber.h
|
||||
PATHS /include /usr/include /usr/local/include /usr/share/include /opt/include ${LDAP_INCLUDE_DIR}
|
||||
DOC "Try and find the header file lber.h")
|
||||
|
||||
|
||||
|
||||
FIND_LIBRARY(LDAP_LIBRARY NAMES ldap
|
||||
PATHS /usr/lib /lib /usr/local/lib /usr/share/lib /opt/lib /opt/share/lib /var/lib /usr/lib64 /lib64 /usr/local/lib64 /usr/share/lib64 /opt/lib64 /opt/share/lib64 /var/lib64
|
||||
DOC "Try and find libldap")
|
||||
|
||||
|
||||
IF (LDAP_LIBRARY)
|
||||
get_filename_component(LDAP_LIBRARY_DIRS ${LDAP_LIBRARY} PATH)
|
||||
FIND_LIBRARY(LBER_LIBRARY NAMES lber
|
||||
PATHS /usr/lib /lib /usr/local/lib /usr/share/lib /opt/lib /opt/share/lib /var/lib /usr/lib64 /lib64 /usr/local/lib64 /usr/share/lib64 /opt/lib64 /opt/share/lib64 /var/lib64 ${LDAP_LIBRARY_DIRS}
|
||||
DOC "Try and find liblber")
|
||||
ELSE (LDAP_LIBRARY)
|
||||
FIND_LIBRARY(LBER_LIBRARY NAMES lber
|
||||
PATHS /usr/lib /lib /usr/local/lib /usr/share/lib /opt/lib /opt/share/lib /var/lib /usr/lib64 /lib64 /usr/local/lib64 /usr/share/lib64 /opt/lib64 /opt/share/lib64 /var/lib64
|
||||
DOC "Try and find liblber")
|
||||
ENDIF (LDAP_LIBRARY)
|
||||
|
||||
|
||||
|
||||
|
||||
IF (LBER_LIBRARY)
|
||||
SET( LIBLBER_FOUND 1 )
|
||||
get_filename_component(LBER_LIBRARY_DIRS ${LBER_LIBRARY} PATH)
|
||||
MESSAGE(STATUS " Found ${LBER_LIBRARY}")
|
||||
ELSE(LBER_LIBRARY)
|
||||
MESSAGE( STATUS " Could NOT find liblber.")
|
||||
ENDIF (LBER_LIBRARY)
|
||||
|
||||
|
||||
|
||||
|
||||
IF (LDAP_INCLUDE_DIR AND LDAP_LIBRARY)
|
||||
SET( LIBLDAP_FOUND 1 )
|
||||
MESSAGE(STATUS " Found ${LDAP_LIBRARY}")
|
||||
ELSE (LDAP_INCLUDE_DIR AND LDAP_LIBRARY)
|
||||
IF ( LibLdap_FIND_REQUIRED )
|
||||
MESSAGE( FATAL_ERROR " Could NOT find libldap. The ldap plugin needs this library.")
|
||||
ELSE ( LibLdap_FIND_REQUIRED )
|
||||
MESSAGE( STATUS " Could NOT find libldap.")
|
||||
ENDIF ( LibLdap_FIND_REQUIRED )
|
||||
ENDIF (LDAP_INCLUDE_DIR AND LDAP_LIBRARY)
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
# - Try to find the PCRE regular expression library
|
||||
# Once done this will define
|
||||
#
|
||||
# PCRE_FOUND - system has the PCRE library
|
||||
# PCRE_INCLUDE_DIR - the PCRE include directory
|
||||
# PCRE_LIBRARIES - The libraries needed to use PCRE
|
||||
|
||||
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
if (PCRE_INCLUDE_DIR AND PCRE_PCREPOSIX_LIBRARY AND PCRE_PCRE_LIBRARY)
|
||||
# Already in cache, be silent
|
||||
set(PCRE_FIND_QUIETLY TRUE)
|
||||
endif (PCRE_INCLUDE_DIR AND PCRE_PCREPOSIX_LIBRARY AND PCRE_PCRE_LIBRARY)
|
||||
|
||||
if (NOT WIN32)
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PC_PCRE QUIET libpcre)
|
||||
set(PCRE_DEFINITIONS ${PC_PCRE_CFLAGS_OTHER})
|
||||
endif (NOT WIN32)
|
||||
|
||||
find_path(PCRE_INCLUDE_DIR pcre.h
|
||||
HINTS ${PC_PCRE_INCLUDEDIR} ${PC_PCRE_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES pcre)
|
||||
|
||||
find_library(PCRE_PCRE_LIBRARY NAMES pcre HINTS ${PC_PCRE_LIBDIR} ${PC_PCRE_LIBRARY_DIRS})
|
||||
|
||||
find_library(PCRE_PCREPOSIX_LIBRARY NAMES pcreposix HINTS ${PC_PCRE_LIBDIR} ${PC_PCRE_LIBRARY_DIRS})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
IF(NOT WIN32)
|
||||
find_package_handle_standard_args(PCRE DEFAULT_MSG PCRE_INCLUDE_DIR PCRE_PCRE_LIBRARY PCRE_PCREPOSIX_LIBRARY )
|
||||
mark_as_advanced(PCRE_INCLUDE_DIR PCRE_LIBRARIES PCRE_PCREPOSIX_LIBRARY PCRE_PCRE_LIBRARY)
|
||||
set(PCRE_LIBRARIES ${PCRE_PCRE_LIBRARY} ${PCRE_PCREPOSIX_LIBRARY})
|
||||
ELSE()
|
||||
find_package_handle_standard_args(PCRE DEFAULT_MSG PCRE_INCLUDE_DIR PCRE_PCRE_LIBRARY )
|
||||
set(PCRE_LIBRARIES ${PCRE_PCRE_LIBRARY} )
|
||||
mark_as_advanced(PCRE_INCLUDE_DIR PCRE_LIBRARIES PCRE_PCRE_LIBRARY)
|
||||
ENDIF()
|
||||
@@ -1,3 +0,0 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
include_directories ("${PROJECT_SOURCE_DIR}/openssl/include" "${PROJECT_SOURCE_DIR}/src" "${PROJECT_BINARY_DIR}/src")
|
||||
|
||||
@@ -1,674 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
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.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
@@ -1,3 +0,0 @@
|
||||
About installation, please read below article
|
||||
http://open.litespeedtech.com/quick_install_guide.html
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
SUBDIRS = src
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
install-data-hook:
|
||||
( cd dist; ./install.sh "$(DESTDIR)$(prefix)" "$(OPENLSWS_USER)" "$(OPENLSWS_GROUP)" "$(OPENLSWS_ADMIN)" "$(OPENLSWS_PASSWORD)" "$(OPENLSWS_EMAIL)" "$(OPENLSWS_ADMINSSL)" "$(OPENLSWS_ADMINPORT)" "$(USE_LSPHP7)" "$(DEFAULT_TMP_DIR)" "$(PID_FILE)" "$(OPENLSWS_EXAMPLEPORT)" "$(IS_LSCPD)" ;)
|
||||
( rm -f $(DESTDIR)$(prefix)/modules/cache.la $(DESTDIR)$(prefix)/modules/modinspector.la $(DESTDIR)$(prefix)/modules/modreqparser.la $(DESTDIR)$(prefix)/modules/uploadprogress.la $(DESTDIR)$(prefix)/modules/mod_lua.la )
|
||||
|
||||
ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS}
|
||||
@@ -1,825 +0,0 @@
|
||||
# Makefile.in generated by automake 1.13.4 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = .
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||
$(top_srcdir)/configure $(am__configure_deps) INSTALL \
|
||||
config.guess config.sub depcomp install-sh missing ltmain.sh
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/ax_check_zlib.m4 \
|
||||
$(top_srcdir)/ax_check_openssl.m4 \
|
||||
$(top_srcdir)/ax_path_lib_pcre.m4 \
|
||||
$(top_srcdir)/ax_lib_expat.m4 $(top_srcdir)/ax_check_liblua.m4 \
|
||||
$(top_srcdir)/ax_check_libudns.m4 \
|
||||
$(top_srcdir)/ax_check_brotli.m4 \
|
||||
$(top_srcdir)/ax_check_ip2location.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/src/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
|
||||
ctags-recursive dvi-recursive html-recursive info-recursive \
|
||||
install-data-recursive install-dvi-recursive \
|
||||
install-exec-recursive install-html-recursive \
|
||||
install-info-recursive install-pdf-recursive \
|
||||
install-ps-recursive install-recursive installcheck-recursive \
|
||||
installdirs-recursive pdf-recursive ps-recursive \
|
||||
tags-recursive uninstall-recursive
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
am__recursive_targets = \
|
||||
$(RECURSIVE_TARGETS) \
|
||||
$(RECURSIVE_CLEAN_TARGETS) \
|
||||
$(am__extra_recursive_targets)
|
||||
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
|
||||
cscope distdir dist dist-all distcheck
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__tagged_files)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
CSCOPE = cscope
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
am__remove_distdir = \
|
||||
if test -d "$(distdir)"; then \
|
||||
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||
&& rm -rf "$(distdir)" \
|
||||
|| { sleep 5 && rm -rf "$(distdir)"; }; \
|
||||
else :; fi
|
||||
am__post_remove_distdir = $(am__remove_distdir)
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
|
||||
sed_rest='s,^[^/]*/*,,'; \
|
||||
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
|
||||
sed_butlast='s,/*[^/]*$$,,'; \
|
||||
while test -n "$$dir1"; do \
|
||||
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
|
||||
if test "$$first" != "."; then \
|
||||
if test "$$first" = ".."; then \
|
||||
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
|
||||
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
|
||||
else \
|
||||
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
|
||||
if test "$$first2" = "$$first"; then \
|
||||
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
|
||||
else \
|
||||
dir2="../$$dir2"; \
|
||||
fi; \
|
||||
dir0="$$dir0"/"$$first"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
|
||||
done; \
|
||||
reldir="$$dir2"
|
||||
DIST_ARCHIVES = $(distdir).tar.gz
|
||||
GZIP_ENV = --best
|
||||
DIST_TARGETS = dist-gzip
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
|
||||
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BROTLI_INCLUDES = @BROTLI_INCLUDES@
|
||||
BROTLI_LIBS = @BROTLI_LIBS@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFAULT_TMP_DIR = @DEFAULT_TMP_DIR@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DL_LIB_OPTION = @DL_LIB_OPTION@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
EXPAT_CFLAGS = @EXPAT_CFLAGS@
|
||||
EXPAT_LIBS = @EXPAT_LIBS@
|
||||
EXPAT_VERSION = @EXPAT_VERSION@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
IP2LOCATION_INCLUDES = @IP2LOCATION_INCLUDES@
|
||||
IP2LOCATION_LIBS = @IP2LOCATION_LIBS@
|
||||
IS_LSCPD = @IS_LSCPD@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LUA_INCLUDES = @LUA_INCLUDES@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OPENLSWS_ADMIN = @OPENLSWS_ADMIN@
|
||||
OPENLSWS_ADMINPORT = @OPENLSWS_ADMINPORT@
|
||||
OPENLSWS_ADMINSSL = @OPENLSWS_ADMINSSL@
|
||||
OPENLSWS_BSSL = @OPENLSWS_BSSL@
|
||||
OPENLSWS_DISABLE_RPATH = @OPENLSWS_DISABLE_RPATH@
|
||||
OPENLSWS_EMAIL = @OPENLSWS_EMAIL@
|
||||
OPENLSWS_EXAMPLEPORT = @OPENLSWS_EXAMPLEPORT@
|
||||
OPENLSWS_GROUP = @OPENLSWS_GROUP@
|
||||
OPENLSWS_LIBDIR = @OPENLSWS_LIBDIR@
|
||||
OPENLSWS_PASSWORD = @OPENLSWS_PASSWORD@
|
||||
OPENLSWS_USER = @OPENLSWS_USER@
|
||||
OPENSSL_INCLUDES = @OPENSSL_INCLUDES@
|
||||
OPENSSL_LDFLAGS = @OPENSSL_LDFLAGS@
|
||||
OPENSSL_LIBS = @OPENSSL_LIBS@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PCRE_CFLAGS = @PCRE_CFLAGS@
|
||||
PCRE_LDFLAGS = @PCRE_LDFLAGS@
|
||||
PCRE_LIBS = @PCRE_LIBS@
|
||||
PID_FILE = @PID_FILE@
|
||||
RANLIB = @RANLIB@
|
||||
RT_LIB_OPTION = @RT_LIB_OPTION@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
UDNS_CFLAGS = @UDNS_CFLAGS@
|
||||
UDNS_LIBS = @UDNS_LIBS@
|
||||
USE_LSPHP7 = @USE_LSPHP7@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
brotli_dir = @brotli_dir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
ip2location_dir = @ip2location_dir@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
need_brotli = @need_brotli@
|
||||
need_ip2location = @need_ip2location@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
SUBDIRS = src
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS}
|
||||
all: all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
am--refresh: Makefile
|
||||
@:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
|
||||
$(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
echo ' $(SHELL) ./config.status'; \
|
||||
$(SHELL) ./config.status;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
$(am__cd) $(srcdir) && $(AUTOCONF)
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool config.lt
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run 'make' without going through this Makefile.
|
||||
# To change the values of 'make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in 'config.status', edit 'config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run 'make');
|
||||
# (2) otherwise, pass the desired values on the 'make' command line.
|
||||
$(am__recursive_targets):
|
||||
@fail=; \
|
||||
if $(am__make_keepgoing); then \
|
||||
failcom='fail=yes'; \
|
||||
else \
|
||||
failcom='exit 1'; \
|
||||
fi; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-recursive
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-recursive
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscope: cscope.files
|
||||
test ! -s cscope.files \
|
||||
|| $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
|
||||
clean-cscope:
|
||||
-rm -f cscope.files
|
||||
cscope.files: clean-cscope cscopelist
|
||||
cscopelist: cscopelist-recursive
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
test -d "$(distdir)" || mkdir "$(distdir)"
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
$(am__make_dryrun) \
|
||||
|| test -d "$(distdir)/$$subdir" \
|
||||
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
|
||||
$(am__relativize); \
|
||||
new_distdir=$$reldir; \
|
||||
dir1=$$subdir; dir2="$(top_distdir)"; \
|
||||
$(am__relativize); \
|
||||
new_top_distdir=$$reldir; \
|
||||
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
|
||||
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
|
||||
($(am__cd) $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$$new_top_distdir" \
|
||||
distdir="$$new_distdir" \
|
||||
am__remove_distdir=: \
|
||||
am__skip_length_check=: \
|
||||
am__skip_mode_fix=: \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
-test -n "$(am__skip_mode_fix)" \
|
||||
|| find "$(distdir)" -type d ! -perm -755 \
|
||||
-exec chmod u+rwx,go+rx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r "$(distdir)"
|
||||
dist-gzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-bzip2: distdir
|
||||
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-lzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-xz: distdir
|
||||
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-shar: distdir
|
||||
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-zip: distdir
|
||||
-rm -f $(distdir).zip
|
||||
zip -rq $(distdir).zip $(distdir)
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist dist-all:
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
case '$(DIST_ARCHIVES)' in \
|
||||
*.tar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
|
||||
*.tar.bz2*) \
|
||||
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||
*.tar.lz*) \
|
||||
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
|
||||
*.tar.xz*) \
|
||||
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
|
||||
*.tar.Z*) \
|
||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||
*.shar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
esac
|
||||
chmod -R a-w $(distdir)
|
||||
chmod u+w $(distdir)
|
||||
mkdir $(distdir)/_build $(distdir)/_inst
|
||||
chmod a-w $(distdir)
|
||||
test -d $(distdir)/_build || exit 0; \
|
||||
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||
&& am__cwd=`pwd` \
|
||||
&& $(am__cd) $(distdir)/_build \
|
||||
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
|
||||
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
|
||||
distuninstallcheck \
|
||||
&& chmod -R a-w "$$dc_install_base" \
|
||||
&& ({ \
|
||||
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
||||
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
||||
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
||||
&& rm -rf "$$dc_destdir" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist \
|
||||
&& rm -rf $(DIST_ARCHIVES) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
|
||||
&& cd "$$am__cwd" \
|
||||
|| exit 1
|
||||
$(am__post_remove_distdir)
|
||||
@(echo "$(distdir) archives ready for distribution: "; \
|
||||
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
|
||||
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
|
||||
distuninstallcheck:
|
||||
@test -n '$(distuninstallcheck_dir)' || { \
|
||||
echo 'ERROR: trying to run $@ with an empty' \
|
||||
'$$(distuninstallcheck_dir)' >&2; \
|
||||
exit 1; \
|
||||
}; \
|
||||
$(am__cd) '$(distuninstallcheck_dir)' || { \
|
||||
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
|
||||
exit 1; \
|
||||
}; \
|
||||
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left after uninstall:" ; \
|
||||
if test -n "$(DESTDIR)"; then \
|
||||
echo " (check DESTDIR support)"; \
|
||||
fi ; \
|
||||
$(distuninstallcheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
distcleancheck: distclean
|
||||
@if test '$(srcdir)' = . ; then \
|
||||
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left in build directory after distclean:" ; \
|
||||
$(distcleancheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-libtool \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
@$(NORMAL_INSTALL)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
|
||||
install-dvi: install-dvi-recursive
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-recursive
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-recursive
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-recursive
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: $(am__recursive_targets) install-am install-data-am \
|
||||
install-strip
|
||||
|
||||
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
|
||||
am--refresh check check-am clean clean-cscope clean-generic \
|
||||
clean-libtool cscope cscopelist-am ctags ctags-am dist \
|
||||
dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
|
||||
dist-xz dist-zip distcheck distclean distclean-generic \
|
||||
distclean-libtool distclean-tags distcleancheck distdir \
|
||||
distuninstallcheck dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am \
|
||||
install-data-hook install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs installdirs-am maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic \
|
||||
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
|
||||
uninstall-am
|
||||
|
||||
|
||||
install-data-hook:
|
||||
( cd dist; ./install.sh "$(DESTDIR)$(prefix)" "$(OPENLSWS_USER)" "$(OPENLSWS_GROUP)" "$(OPENLSWS_ADMIN)" "$(OPENLSWS_PASSWORD)" "$(OPENLSWS_EMAIL)" "$(OPENLSWS_ADMINSSL)" "$(OPENLSWS_ADMINPORT)" "$(USE_LSPHP7)" "$(DEFAULT_TMP_DIR)" "$(PID_FILE)" "$(OPENLSWS_EXAMPLEPORT)" "$(IS_LSCPD)" ;)
|
||||
( rm -f $(DESTDIR)$(prefix)/modules/cache.la $(DESTDIR)$(prefix)/modules/modinspector.la $(DESTDIR)$(prefix)/modules/modreqparser.la $(DESTDIR)$(prefix)/modules/uploadprogress.la $(DESTDIR)$(prefix)/modules/mod_lua.la )
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -1,33 +0,0 @@
|
||||
OpenLiteSpeed Web Server
|
||||
========
|
||||
|
||||
Description
|
||||
--------
|
||||
|
||||
OpenLiteSpeed is a high-performance, lightweight, open source HTTP server developed and copyrighted by
|
||||
LiteSpeed Technologies. Users are free to download, use, distribute, and modify OpenLiteSpeed and its
|
||||
source code in accordance with the precepts of the GPLv3 license.
|
||||
|
||||
This is the official repository for OpenLiteSpeed's source code. It is maintained byLiteSpeed
|
||||
Technologies.
|
||||
|
||||
Documentation
|
||||
--------
|
||||
|
||||
Users can find all OpenLiteSpeed documentation on the [OpenLiteSpeed site](http://open.litespeedtech.com),
|
||||
but here are some quick links to important parts of the site:
|
||||
|
||||
[Installation](http://open.litespeedtech.com/mediawiki/index.php/Help:Installation)
|
||||
|
||||
[Configuration](http://open.litespeedtech.com/mediawiki/index.php/Help:Configuration)
|
||||
|
||||
[Road map](http://open.litespeedtech.com/mediawiki/index.php/Road_Map)
|
||||
|
||||
[Release log](http://open.litespeedtech.com/mediawiki/index.php/Release_Log/1.x)
|
||||
|
||||
Get in Touch
|
||||
--------
|
||||
|
||||
OpenLiteSpeed has a [Google Group](https://groups.google.com/forum/#!forum/openlitespeed-development). If
|
||||
you find a bug, want to request new features, or just want to talk about OpenLiteSpeed, this is the place
|
||||
to do it.
|
||||
9660
install/openlitespeed-1.4.28/aclocal.m4
vendored
@@ -1,14 +0,0 @@
|
||||
How to build the example module and use it.
|
||||
|
||||
There are four steps:
|
||||
|
||||
1, You need to compile and build it. You can simply use the ccc.sh script to compile and build the module.
|
||||
For example:
|
||||
./ccc.sh hellohandler.c
|
||||
Then you will get the module file hellohandler.so
|
||||
|
||||
2, Copy the module file to $LSWS-HOME/modules/
|
||||
|
||||
3, In the admin console, Configuration/Server/Modules/, add the newly created module and enable it; in the above example, the name is hellohandler.
|
||||
|
||||
4, Restart openlitespeed and it should be added.
|
||||
@@ -1,76 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo =====================================================================================
|
||||
|
||||
cd `dirname "$0"`
|
||||
|
||||
if [ $# -eq 0 ] ; then
|
||||
echo Need a c file name, such as $0 mymodule.c
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Your command is $0 $1"
|
||||
echo
|
||||
|
||||
if [ ! -f $1 ] ; then
|
||||
echo File $1 does not exist
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
if [ "x$LSIAPIDIR" = "x" ]; then
|
||||
#if not set the LSIAPIDIR, use the default location
|
||||
LSIAPIDIR=../../
|
||||
fi
|
||||
|
||||
if [ ! -d "$LSIAPIDIR/include" ]; then
|
||||
echo "Directory $LSIAPIDIR/include missing"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TARGET=`basename $1 .c`
|
||||
echo Target=$TARGET
|
||||
echo
|
||||
|
||||
|
||||
|
||||
|
||||
SYS_NAME=`uname -s`
|
||||
if [ "x$SYS_NAME" = "xDarwin" ] ; then
|
||||
UNDEFINED_FLAG="-undefined dynamic_lookup"
|
||||
else
|
||||
UNDEFINED_FLAG=""
|
||||
fi
|
||||
|
||||
if [ "$TARGET" = "imgresize" ] ; then
|
||||
if [ -e "/usr/local/lib/libgd.a" ] ; then
|
||||
GDLIB="-lgd"
|
||||
else
|
||||
echo "Lib gd is not installed. Cannot use $TARGET without it."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
GDLIB=""
|
||||
fi
|
||||
|
||||
|
||||
gcc -g -Wall -fPIC -c -D_REENTRANT $(getconf LFS_CFLAGS) $TARGET.c -I "$LSIAPIDIR/src" -I "$LSIAPIDIR/include"
|
||||
gcc -g -Wall -fPIC $UNDEFINED_FLAG $(getconf LFS_CFLAGS) -o $TARGET.so $TARGET.o -shared $GDLIB
|
||||
|
||||
if [ -f $(pwd)/$TARGET.so ] ; then
|
||||
echo -e "\033[38;5;71m$TARGET.so created.\033[39m"
|
||||
else
|
||||
echo -e "\033[38;5;203mError, $TARGET.so does not exist, failed.\033[39m"
|
||||
fi
|
||||
|
||||
if [ -f $TARGET.o ] ; then
|
||||
rm $TARGET.o
|
||||
fi
|
||||
|
||||
|
||||
echo Done!
|
||||
echo
|
||||
@@ -1,44 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
|
||||
#define MNAME hellohandler
|
||||
lsi_module_t MNAME;
|
||||
|
||||
|
||||
static char resp_buf[] = "Hello module handler.\r\n";
|
||||
|
||||
static int begin_process(const lsi_session_t *session)
|
||||
{
|
||||
g_api->set_status_code(session, 200);
|
||||
g_api->set_resp_header(session, LSI_RSPHDR_CONTENT_TYPE, NULL, 0,
|
||||
"text/html", 9, LSI_HEADEROP_SET);
|
||||
g_api->append_resp_body(session, resp_buf, sizeof(resp_buf) - 1);
|
||||
g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Define a handler, need to provide a struct _handler_st object, in which
|
||||
* the first function pointer should not be NULL
|
||||
*/
|
||||
static lsi_reqhdlr_t myhandler = { begin_process, NULL, NULL, NULL };
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, NULL, &myhandler, NULL };
|
||||
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#define _GNU_SOURCE
|
||||
#include "../include/ls.h"
|
||||
#include <string.h>
|
||||
|
||||
#define MNAME hellohandler2
|
||||
lsi_module_t MNAME;
|
||||
|
||||
|
||||
static int rcvd_req_header_cbf(lsi_param_t *param)
|
||||
{
|
||||
const char *uri;
|
||||
int len;
|
||||
uri = g_api->get_req_uri(param->session, &len);
|
||||
if (memmem((const void *)uri, len, (const void *)".345", 4) != NULL)
|
||||
{
|
||||
g_api->register_req_handler(param->session, &MNAME, 0);
|
||||
g_api->log(param->session, LSI_LOG_DEBUG,
|
||||
"[hellohandler2:%s] register_req_handler for URI: %s\n",
|
||||
MNAME.about, uri);
|
||||
}
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
|
||||
static int init_module(lsi_module_t *module)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_DEBUG,
|
||||
"[hellohandler2:%s] init_module [log in module code]\n",
|
||||
MNAME.about);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static char resp_buf[] = "Hello module handler2.\r\n";
|
||||
|
||||
static int begin_process(const lsi_session_t *session)
|
||||
{
|
||||
g_api->append_resp_body(session, resp_buf, sizeof(resp_buf) - 1);
|
||||
g_api->end_resp(session);
|
||||
g_api->log(session, LSI_LOG_DEBUG,
|
||||
"[hellohandler2:%s] begin_process for URI: %s\n",
|
||||
MNAME.about, g_api->get_req_uri(session, NULL));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static lsi_serverhook_t server_hooks[] =
|
||||
{
|
||||
{ LSI_HKPT_RCVD_REQ_HEADER, rcvd_req_header_cbf, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED },
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
/**
|
||||
* Define a handler, need to provide a struct lsi_reqhdlr_t object, in which
|
||||
* the first function pointer should not be NULL
|
||||
*/
|
||||
static lsi_reqhdlr_t myhandler = { begin_process, NULL, NULL, NULL };
|
||||
lsi_module_t MNAME =
|
||||
{
|
||||
LSI_MODULE_SIGNATURE, init_module, &myhandler, NULL, "v1.0", server_hooks
|
||||
};
|
||||
@@ -1,278 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../include/ls.h"
|
||||
#include <lsr/ls_loopbuf.h>
|
||||
#include <lsr/ls_xpool.h>
|
||||
|
||||
#include "gd.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <lsdef.h>
|
||||
|
||||
|
||||
/****************************************************************
|
||||
* How to test: Access an image dynamically (i.e. with a proxy),
|
||||
* ensuring that the resize dimensions are in the query string.
|
||||
* For example: http://localhost:8088/apple.jpeg?w=400&h=500
|
||||
*
|
||||
***************************************************************/
|
||||
|
||||
enum httpimg
|
||||
{
|
||||
HTTP_IMG_GIF,
|
||||
HTTP_IMG_PNG,
|
||||
HTTP_IMG_JPEG
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//DEFINE the module name, MUST BE the same as .so file name
|
||||
//ie. if MNAME is testmodule, then the .so must be testmodule.so
|
||||
#define MNAME imgresize
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
lsi_module_t MNAME;
|
||||
#define MAX_BLOCK_BUFSIZE 8192
|
||||
|
||||
typedef struct _MyData
|
||||
{
|
||||
ls_loopbuf_t inWBuf;
|
||||
ls_loopbuf_t outWBuf;
|
||||
enum httpimg IMAGE_TYPE;
|
||||
} MyData;
|
||||
|
||||
/*Function Declarations*/
|
||||
static int setWaitFull(lsi_param_t *rec);
|
||||
static int scanForImage(lsi_param_t *rec);
|
||||
static int parseParameters(lsi_param_t *rec, MyData *myData);
|
||||
static int getReqDimensions(const char *buf, int iLen, int *width,
|
||||
int *height);
|
||||
static void *resizeImage(const char *buf, int bufLen, int width,
|
||||
int height, MyData *myData, int *size);
|
||||
static int init_module();
|
||||
|
||||
int httpRelease(void *data)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### mymoduleresize %s\n", "httpRelease");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int httpinit(lsi_param_t *rec)
|
||||
{
|
||||
MyData *myData;
|
||||
ls_xpool_t *pool = g_api->get_session_pool(rec->session);
|
||||
myData = ls_xpool_alloc(pool, sizeof(MyData));
|
||||
ls_loopbuf_x(&myData->inWBuf, MAX_BLOCK_BUFSIZE, pool);
|
||||
ls_loopbuf_x(&myData->outWBuf, MAX_BLOCK_BUFSIZE, pool);
|
||||
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### mymoduleresize init\n");
|
||||
g_api->set_module_data(rec->session, &MNAME, LSI_DATA_HTTP,
|
||||
(void *)myData);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int setWaitFull(lsi_param_t *rec)
|
||||
{
|
||||
g_api->set_resp_wait_full_body(rec->session);
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
/* Returns 0 for image, 1 for wrong input */
|
||||
static int parseParameters(lsi_param_t *rec, MyData *myData)
|
||||
{
|
||||
int iLen;
|
||||
const char *ptr;
|
||||
struct iovec iov;
|
||||
|
||||
if ((iLen = g_api->get_resp_header(rec->session,
|
||||
LSI_RSPHDR_CONTENT_TYPE, NULL, 0, &iov, 1)) < 1
|
||||
|| iov.iov_len < 9
|
||||
)
|
||||
return 1;
|
||||
|
||||
ptr = (const char *)iov.iov_base;
|
||||
if (memcmp(ptr, "image/", 6) != 0)
|
||||
return 1;
|
||||
|
||||
if (memcmp(ptr + 6, "png", 3) == 0)
|
||||
myData->IMAGE_TYPE = HTTP_IMG_PNG;
|
||||
else if (memcmp(ptr + 6, "gif", 3) == 0)
|
||||
myData->IMAGE_TYPE = HTTP_IMG_GIF;
|
||||
else if (memcmp(ptr + 6, "jpeg", 4) == 0)
|
||||
myData->IMAGE_TYPE = HTTP_IMG_JPEG;
|
||||
else
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*return 0 on success, -1 for garbage queries*/
|
||||
static int getReqDimensions(const char *buf, int iLen, int *width,
|
||||
int *height)
|
||||
{
|
||||
const char *parse, *ptr2, *ptr = buf, *pEnd = buf + iLen;
|
||||
int val = 0;
|
||||
while (ptr < pEnd - 1)
|
||||
{
|
||||
if (*ptr != 'w' && *ptr != 'h')
|
||||
return LS_FAIL;
|
||||
if (*(ptr + 1) != '=')
|
||||
return LS_FAIL;
|
||||
ptr2 = memchr(ptr + 2, '&', (pEnd - ptr) - 2);
|
||||
if (!ptr2)
|
||||
ptr2 = pEnd;
|
||||
for (parse = ptr + 2; parse < ptr2; ++parse)
|
||||
{
|
||||
if (*parse < '0' || *parse > '9')
|
||||
return LS_FAIL;
|
||||
val = val * 10 + (*parse - '0');
|
||||
}
|
||||
if (*ptr == 'w' && *width == 0)
|
||||
*width = val;
|
||||
else if (*ptr == 'h' && *height == 0)
|
||||
*height = val;
|
||||
if (*ptr2 != '&')
|
||||
return 0;
|
||||
val = 0;
|
||||
ptr = ptr2 + 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *resizeImage(const char *buf, int bufLen, int width,
|
||||
int height, MyData *myData, int *size)
|
||||
{
|
||||
|
||||
char *ptr = NULL;
|
||||
gdImagePtr dest, src;
|
||||
if (myData->IMAGE_TYPE == HTTP_IMG_JPEG)
|
||||
src = gdImageCreateFromJpegPtr(bufLen, (void *)buf);
|
||||
else if (myData->IMAGE_TYPE == HTTP_IMG_GIF)
|
||||
src = gdImageCreateFromGifPtr(bufLen, (void *)buf);
|
||||
else if (myData->IMAGE_TYPE == HTTP_IMG_PNG)
|
||||
src = gdImageCreateFromPngPtr(bufLen, (void *)buf);
|
||||
else
|
||||
return NULL;
|
||||
|
||||
if (!width && !height)
|
||||
return NULL;
|
||||
else if (!width)
|
||||
width = height * src->sx / src->sy;
|
||||
else if (!height)
|
||||
height = width * src->sy / src->sx;
|
||||
dest = gdImageCreateTrueColor(width, height);
|
||||
|
||||
gdImageCopyResampled(dest, src, 0, 0, 0, 0,
|
||||
width, height,
|
||||
src->sx, src->sy);
|
||||
|
||||
if (myData->IMAGE_TYPE == HTTP_IMG_JPEG)
|
||||
ptr = gdImageJpegPtr(dest, size, 50);
|
||||
else if (myData->IMAGE_TYPE == HTTP_IMG_GIF)
|
||||
ptr = gdImageGifPtr(dest, size);
|
||||
else if (myData->IMAGE_TYPE == HTTP_IMG_PNG)
|
||||
ptr = gdImagePngPtr(dest, size);
|
||||
|
||||
// Ron: and if NONE of the above are true?? returned
|
||||
// uninitialized ptr
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static int scanForImage(lsi_param_t *rec)
|
||||
{
|
||||
off_t offset = 0;
|
||||
int iSrcSize, iDestSize, iWidth = 0, iHeight = 0, iLen = 0;
|
||||
void *pRespBodyBuf, *pSrcBuf, *pDestBuf;
|
||||
const char *ptr, *pDimensions;
|
||||
MyData *myData = (MyData *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_HTTP);
|
||||
ls_xpool_t *pPool = g_api->get_session_pool(rec->session);
|
||||
|
||||
if (parseParameters(rec, myData) == 0)
|
||||
{
|
||||
|
||||
pDimensions = g_api->get_req_query_string(rec->session, &iLen);
|
||||
if ((iLen == 0)
|
||||
|| (getReqDimensions(pDimensions, iLen, &iWidth, &iHeight) != 0)
|
||||
)
|
||||
return LSI_OK;
|
||||
pRespBodyBuf = g_api->get_resp_body_buf(rec->session);
|
||||
if (!pRespBodyBuf)
|
||||
return LSI_OK;
|
||||
iSrcSize = g_api->get_body_buf_size(pRespBodyBuf);
|
||||
pSrcBuf = ls_xpool_alloc(pPool, iSrcSize);
|
||||
while (!g_api->is_body_buf_eof(pRespBodyBuf, offset))
|
||||
{
|
||||
ptr = g_api->acquire_body_buf_block(pRespBodyBuf, offset, &iLen);
|
||||
if (!ptr)
|
||||
break;
|
||||
memcpy(pSrcBuf + offset, ptr, iLen);
|
||||
g_api->release_body_buf_block(pRespBodyBuf, offset);
|
||||
offset += iLen;
|
||||
}
|
||||
}
|
||||
else
|
||||
return LSI_OK;
|
||||
g_api->reset_body_buf(pRespBodyBuf, 1);
|
||||
if (g_api->append_body_buf(pRespBodyBuf, pSrcBuf, iSrcSize) != iSrcSize)
|
||||
return LSI_ERROR;
|
||||
iSrcSize = g_api->get_body_buf_size(pRespBodyBuf);
|
||||
|
||||
pDestBuf = resizeImage(pSrcBuf, iSrcSize, iWidth, iHeight, myData,
|
||||
&iDestSize);
|
||||
if (!pDestBuf)
|
||||
return LSI_ERROR;
|
||||
|
||||
while (g_api->is_resp_buffer_available(rec->session) <= 0);
|
||||
|
||||
|
||||
g_api->reset_body_buf(pRespBodyBuf, 1);
|
||||
if (g_api->append_body_buf(pRespBodyBuf, pDestBuf, iDestSize) != iDestSize)
|
||||
return LSI_ERROR;
|
||||
g_api->set_resp_content_length(rec->session, iDestSize);
|
||||
|
||||
gdFree(pDestBuf);
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_HTTP_BEGIN, httpinit, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{LSI_HKPT_RCVD_REQ_HEADER, setWaitFull, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{LSI_HKPT_SEND_RESP_HEADER, scanForImage, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module(lsi_module_t *pModule)
|
||||
{
|
||||
g_api->init_module_data(pModule, httpRelease, LSI_DATA_HTTP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "imgresize", serverHooks};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
#include <string.h>
|
||||
|
||||
#define MNAME mytest
|
||||
lsi_module_t MNAME;
|
||||
|
||||
|
||||
static int rcvd_req_header_cbf(lsi_param_t *param)
|
||||
{
|
||||
const char *uri;
|
||||
int len;
|
||||
uri = g_api->get_req_uri(param->session, &len);
|
||||
if ((len >= 7) && (strncasecmp(uri, "/mytest", 7) == 0))
|
||||
g_api->register_req_handler(param->session, &MNAME, 7);
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
|
||||
static int init_module()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int begin_process(const lsi_session_t *session)
|
||||
{
|
||||
g_api->append_resp_body(session, "MyTest!\n", 8);
|
||||
g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static lsi_serverhook_t server_hooks[] =
|
||||
{
|
||||
{LSI_HKPT_RCVD_REQ_HEADER, rcvd_req_header_cbf, LSI_HOOK_FIRST, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static lsi_reqhdlr_t myhandler = { begin_process, NULL, NULL, NULL };
|
||||
lsi_module_t MNAME =
|
||||
{
|
||||
LSI_MODULE_SIGNATURE, init_module, &myhandler, NULL, "", server_hooks
|
||||
};
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/**
|
||||
* Define the module name, MUST BE the same as .so file name;
|
||||
* i.e., if MNAME is testmodule, then the .so must be testmodule.so.
|
||||
*
|
||||
* This example is for testing reply a big buffer (20MB)
|
||||
* Since the buffer is so big, we can not append all the reply data
|
||||
* to the response cache.
|
||||
* So on_write event needs to be used to write the remaining data
|
||||
*/
|
||||
|
||||
#define MNAME replybigbufhandler
|
||||
lsi_module_t MNAME;
|
||||
|
||||
static char testuri[] = "/replybigbuf";
|
||||
|
||||
#define REPLY_BUFFER_LENGTH (1*1024*1024)
|
||||
|
||||
|
||||
static int free_mydata(void *data)
|
||||
{
|
||||
// The data is only the size, did not malloc memory, so no free needed
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int disable_compress(lsi_param_t *param)
|
||||
{
|
||||
// To disable compress, set the LSI_FLAG_DECOMPRESS_REQUIRED flag
|
||||
// in the hook.
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
|
||||
static int rcvd_req_header_cbf(lsi_param_t *param)
|
||||
{
|
||||
const char *uri;
|
||||
int len;
|
||||
uri = g_api->get_req_uri(param->session, &len);
|
||||
if ((len >= sizeof(testuri) - 1)
|
||||
&& (strncasecmp(uri, testuri, sizeof(testuri) - 1) == 0))
|
||||
{
|
||||
g_api->register_req_handler(param->session, &MNAME, sizeof(testuri) - 1);
|
||||
g_api->set_module_data(param->session, &MNAME, LSI_DATA_HTTP,
|
||||
(void *)REPLY_BUFFER_LENGTH);
|
||||
}
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
|
||||
static int init_module(lsi_module_t *module)
|
||||
{
|
||||
g_api->init_module_data(module, free_mydata, LSI_DATA_HTTP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// begin_process will be called the first time,
|
||||
// then on_write will be called next and next.
|
||||
static char txt1[] = "replybigbufhandler module reply the first line\r\n";
|
||||
static int begin_process(const lsi_session_t *session)
|
||||
{
|
||||
g_api->set_resp_header(session, LSI_RSPHDR_CONTENT_TYPE, NULL, 0,
|
||||
"text/html", 9, LSI_HEADEROP_SET);
|
||||
int size = sizeof(txt1) - 1;
|
||||
long left = (long)g_api->get_module_data(session, &MNAME,
|
||||
LSI_DATA_HTTP);
|
||||
g_api->append_resp_body(session, txt1, size);
|
||||
left -= size;
|
||||
g_api->set_module_data(session, &MNAME, LSI_DATA_HTTP,
|
||||
(void *)left);
|
||||
g_api->flush(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// return 0: error, 1: done, 2: not finished, definitions are in ls.h
|
||||
static int on_write(const lsi_session_t *session)
|
||||
{
|
||||
#define _BLOCK_SIZE (1024)
|
||||
int i;
|
||||
char buf[_BLOCK_SIZE] = {0};
|
||||
int size = 0;
|
||||
long left = (long)g_api->get_module_data(session, &MNAME,
|
||||
LSI_DATA_HTTP);
|
||||
|
||||
while (left > 0 && g_api->is_resp_buffer_available(session))
|
||||
{
|
||||
for (i = 0; i < _BLOCK_SIZE; ++i)
|
||||
buf[i] = 'A' + rand() % 52;
|
||||
size = ((left > _BLOCK_SIZE) ? _BLOCK_SIZE : left);
|
||||
g_api->append_resp_body(session, buf, size);
|
||||
left -= size;
|
||||
}
|
||||
g_api->set_module_data(session, &MNAME, LSI_DATA_HTTP,
|
||||
(void *)left);
|
||||
if (left == 0)
|
||||
g_api->append_resp_body(session, "\r\nEnd\r\n", 7);
|
||||
|
||||
return (left > 0) ? LSI_RSP_MORE : LSI_RSP_DONE;
|
||||
}
|
||||
|
||||
|
||||
static lsi_serverhook_t server_hooks[] =
|
||||
{
|
||||
{ LSI_HKPT_RCVD_REQ_HEADER, rcvd_req_header_cbf, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED },
|
||||
{ LSI_HKPT_RCVD_RESP_BODY, disable_compress, LSI_HOOK_NORMAL, LSI_FLAG_DECOMPRESS_REQUIRED | LSI_FLAG_ENABLED },
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
lsi_reqhdlr_t myhandler = { begin_process, NULL, on_write, NULL };
|
||||
lsi_module_t MNAME =
|
||||
{
|
||||
LSI_MODULE_SIGNATURE, init_module, &myhandler, NULL, "", server_hooks
|
||||
};
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
<p> <p>Test Get method:
|
||||
<form action="/reqinfo/testget" method="get">
|
||||
First value: <input type="text" name="fvalue"><br>
|
||||
Last value: <input type="text" name="lvalue"><br>
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
|
||||
|
||||
<p><p>Test post method echo
|
||||
<form action="/reqinfo/echo" method="post">
|
||||
First value: <input type="text" name="fvalue"><br>
|
||||
Last value: <input type="text" name="lvalue"><br>
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
<p><p>Test post method md5
|
||||
<form action="/reqinfo/md5" method="post">
|
||||
First value: <input type="text" name="fvalue"><br>
|
||||
Last value: <input type="text" name="lvalue"><br>
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
|
||||
|
||||
<p><p>Test post method upload
|
||||
<form action="/reqinfo/upload" method="post">
|
||||
First value: <input type="text" name="fvalue"><br>
|
||||
Last value: <input type="text" name="lvalue"><br>
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p><p>Test post a file and echo the whole request body
|
||||
<form method="post" action="/reqinfo/echo" name="submit" enctype="multipart/form-data">
|
||||
<input type="file" name="fileField"><br /><br />
|
||||
<input type="submit" name="submit" value="Submit">
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
<p><p>Test post a file and calculate the request body's md5
|
||||
<form method="post" action="/reqinfo/md5" name="submit" enctype="multipart/form-data">
|
||||
<input type="file" name="fileField"><br /><br />
|
||||
<input type="submit" name="submit" value="Submit">
|
||||
</form>
|
||||
|
||||
<p><p>Test post a file and save file to /tmp/uploadfile
|
||||
<form method="post" action="/reqinfo/upload" name="submit" enctype="multipart/form-data">
|
||||
<input type="file" name="fileField"><br /><br />
|
||||
<input type="submit" name="submit" value="Submit">
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,513 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../include/ls.h"
|
||||
|
||||
#include <lsr/ls_xpool.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <openssl/md5.h>
|
||||
|
||||
/**
|
||||
* Define the module name, MUST BE the same as .so file name;
|
||||
* i.e., if MNAME is testmodule, then the .so must be testmodule.so.
|
||||
*
|
||||
* How to test this sample
|
||||
* 1, build it, put the file reqinfhandler.so in $LSWS_HOME/modules
|
||||
* 2, in web admin console configuration, enable this module
|
||||
* 3, visit http(s)://.../reqinfo(/echo|/md5|/upload) with/without request body
|
||||
*/
|
||||
|
||||
#define MNAME reqinfhandler
|
||||
lsi_module_t MNAME;
|
||||
|
||||
static char testuri[] = "/reqinfo";
|
||||
|
||||
#define CONTENT_HEAD "<html><head><title>Server request varibles</title></head><body>\r\n"
|
||||
#define CONTENT_FORMAT "<tr><td>%s</td><td>%s</td></tr>\r\n"
|
||||
#define CONTENT_TAIL "</body></html>\r\n"
|
||||
|
||||
typedef struct mydata_s
|
||||
{
|
||||
int type;
|
||||
FILE *fp;
|
||||
MD5_CTX ctx;
|
||||
int req_body_len; // length in "Content-Length"
|
||||
int rcvd_req_body_len; // recved
|
||||
int rcvd_done; // finished or due to connection error
|
||||
int resp_done;
|
||||
} mydata_t;
|
||||
|
||||
// The following matches the index, DO NOT change the order
|
||||
const char *req_array[] =
|
||||
{
|
||||
"REMOTE_ADDR",
|
||||
"REMOTE_PORT",
|
||||
"REMOTE_HOST",
|
||||
"REMOTE_USER",
|
||||
"REMOTE_IDENT",
|
||||
"REQUEST_METHOD",
|
||||
"QUERY_STRING",
|
||||
"AUTH_TYPE",
|
||||
"PATH_INFO",
|
||||
"SCRIPT_FILENAME",
|
||||
"REQUEST_FILENAME",
|
||||
"REQUEST_URI",
|
||||
"DOCUMENT_ROOT",
|
||||
"SERVER_ADMIN",
|
||||
"SERVER_NAME",
|
||||
"SERVER_ADDR",
|
||||
"SERVER_PORT",
|
||||
"SERVER_PROTOCOL",
|
||||
"SERVER_SOFTWARE",
|
||||
"API_VERSION",
|
||||
"THE_REQUEST",
|
||||
"IS_SUBREQ",
|
||||
"TIME",
|
||||
"TIME_YEAR",
|
||||
"TIME_MON",
|
||||
"TIME_DAY",
|
||||
"TIME_HOUR",
|
||||
"TIME_MIN",
|
||||
"TIME_SEC",
|
||||
"TIME_WDAY",
|
||||
"SCRIPT_NAME",
|
||||
"CURRENT_URI",
|
||||
"REQUEST_BASENAME",
|
||||
"SCRIPT_UID",
|
||||
"SCRIPT_GID",
|
||||
"SCRIPT_USERNAME",
|
||||
"SCRIPT_GROUPNAME",
|
||||
"SCRIPT_MODE",
|
||||
"SCRIPT_BASENAME",
|
||||
"SCRIPT_URI",
|
||||
"ORG_REQ_URI",
|
||||
"HTTPS",
|
||||
"SSL_VERSION",
|
||||
"SSL_SESSION_ID",
|
||||
"SSL_CIPHER",
|
||||
"SSL_CIPHER_USEKEYSIZE",
|
||||
"SSL_CIPHER_ALGKEYSIZE",
|
||||
"SSL_CLIENT_CERT",
|
||||
"GEOIP_ADDR",
|
||||
"PATH_TRANSLATED",
|
||||
};
|
||||
|
||||
// The following is used by name value, you can change the order
|
||||
const char *env_array[] =
|
||||
{
|
||||
"PATH",
|
||||
|
||||
"REMOTE_ADDR",
|
||||
"REMOTE_PORT",
|
||||
"REMOTE_HOST",
|
||||
"REMOTE_USER",
|
||||
"REMOTE_IDENT",
|
||||
"REQUEST_METHOD",
|
||||
"QUERY_STRING",
|
||||
"AUTH_TYPE",
|
||||
"PATH_INFO",
|
||||
"SCRIPT_FILENAME",
|
||||
"REQUEST_FILENAME",
|
||||
"REQUEST_URI",
|
||||
"DOCUMENT_ROOT",
|
||||
"SERVER_ADMIN",
|
||||
"SERVER_NAME",
|
||||
"SERVER_ADDR",
|
||||
"SERVER_PORT",
|
||||
"SERVER_PROTOCOL",
|
||||
"SERVER_SOFTWARE",
|
||||
"API_VERSION",
|
||||
"THE_REQUEST",
|
||||
"IS_SUBREQ",
|
||||
"TIME",
|
||||
"TIME_YEAR",
|
||||
"TIME_MON",
|
||||
"TIME_DAY",
|
||||
"TIME_HOUR",
|
||||
"TIME_MIN",
|
||||
"TIME_SEC",
|
||||
"TIME_WDAY",
|
||||
"SCRIPT_NAME",
|
||||
"CURRENT_URI",
|
||||
"REQUEST_BASENAME",
|
||||
"SCRIPT_UID",
|
||||
"SCRIPT_GID",
|
||||
"SCRIPT_USERNAME",
|
||||
"SCRIPT_GROUPNAME",
|
||||
"SCRIPT_MODE",
|
||||
"SCRIPT_BASENAME",
|
||||
"SCRIPT_URI",
|
||||
"ORG_REQ_URI",
|
||||
"HTTPS",
|
||||
"SSL_VERSION",
|
||||
"SSL_SESSION_ID",
|
||||
"SSL_CIPHER",
|
||||
"SSL_CIPHER_USEKEYSIZE",
|
||||
"SSL_CIPHER_ALGKEYSIZE",
|
||||
"SSL_CLIENT_CERT",
|
||||
"GEOIP_ADDR",
|
||||
"PATH_TRANSLATED",
|
||||
};
|
||||
|
||||
const char *reqhdr_array[] =
|
||||
{
|
||||
"Accept",
|
||||
"Accept-Charset",
|
||||
"Accept-Encoding",
|
||||
"Accept-Language",
|
||||
"Accept-Datetime",
|
||||
"Authorization",
|
||||
"Cache-Control",
|
||||
"Connection",
|
||||
"Content-Type",
|
||||
"Content-Length",
|
||||
"Content-MD5",
|
||||
"Cookie",
|
||||
"Date",
|
||||
"Expect",
|
||||
"From",
|
||||
"Host",
|
||||
"Pragma",
|
||||
"Proxy-Authorization"
|
||||
"If-Match",
|
||||
"If-Modified-Since",
|
||||
"If-None-Match",
|
||||
"If-Range",
|
||||
"If-Unmodified-Since",
|
||||
"Max-Forwards",
|
||||
"Origin",
|
||||
"Referer",
|
||||
"User-Agent",
|
||||
"Range",
|
||||
"Upgrade",
|
||||
"Via",
|
||||
"X-Forwarded-For",
|
||||
};
|
||||
|
||||
|
||||
static int free_mydata(void *data)
|
||||
{
|
||||
mydata_t *mydata = (mydata_t *)data;
|
||||
if (mydata != NULL)
|
||||
{
|
||||
// free (mydata); Do not need to free with session pool,
|
||||
// will be freed at the end of the session.
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### reqinfomodule free_mydata\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int initdata(lsi_param_t *param)
|
||||
{
|
||||
mydata_t *mydata = (mydata_t *)g_api->get_module_data(param->session,
|
||||
&MNAME, LSI_DATA_HTTP);
|
||||
ls_xpool_t *pPool = g_api->get_session_pool(param->session);
|
||||
mydata = (mydata_t *)ls_xpool_alloc(pPool, sizeof(mydata_t));
|
||||
memset(mydata, 0, sizeof(mydata_t));
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### reqinfomodule initdata\n");
|
||||
g_api->set_module_data(param->session, &MNAME, LSI_DATA_HTTP,
|
||||
(void *)mydata);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// 0:no body or no deal, 1,echo, 2: md5, 3, save to file
|
||||
static int get_reqbody_dealertype(const lsi_session_t *session)
|
||||
{
|
||||
char path[512];
|
||||
int n;
|
||||
if (g_api->get_req_content_length(session) > 0)
|
||||
{
|
||||
n = g_api->get_req_var_by_id(session, LSI_VAR_PATH_INFO, path, 512);
|
||||
if (n >= 5 && strncasecmp(path, "/echo", 5) == 0)
|
||||
return 1;
|
||||
else if (n >= 4 && strncasecmp(path, "/md5", 4) == 0)
|
||||
return 2;
|
||||
else if (n >= 7 && strncasecmp(path, "/upload", 7) == 0)
|
||||
return 3;
|
||||
}
|
||||
|
||||
// All other cases, no deal
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static inline void append(const lsi_session_t *session, const char *s, int n)
|
||||
{
|
||||
if (n == 0)
|
||||
n = strlen(s);
|
||||
g_api->append_resp_body(session, (char *)s, n);
|
||||
}
|
||||
|
||||
|
||||
static int on_read(const lsi_session_t *session)
|
||||
{
|
||||
unsigned char md5[16];
|
||||
char buf[8192];
|
||||
int ret, i;
|
||||
int readbytes = 0, written = 0;
|
||||
mydata_t *mydata = (mydata_t *)g_api->get_module_data(session, &MNAME,
|
||||
LSI_DATA_HTTP);
|
||||
if (mydata == NULL || mydata->type == 0)
|
||||
{
|
||||
g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
while ((ret = g_api->read_req_body(session, buf, sizeof(buf))) > 0)
|
||||
{
|
||||
mydata->rcvd_req_body_len += ret;
|
||||
readbytes += ret;
|
||||
|
||||
if (mydata->type == 1)
|
||||
{
|
||||
append(session, buf, ret);
|
||||
written += ret;
|
||||
}
|
||||
else if (mydata->type == 2)
|
||||
MD5_Update(&mydata->ctx, buf, ret);
|
||||
else
|
||||
fwrite(buf, 1, ret, mydata->fp);
|
||||
|
||||
if (mydata->rcvd_req_body_len >= mydata->req_body_len)
|
||||
{
|
||||
mydata->rcvd_done = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ret == 0)
|
||||
mydata->rcvd_done = 1;
|
||||
|
||||
if (mydata->rcvd_done == 1)
|
||||
{
|
||||
if (mydata->type == 2)
|
||||
{
|
||||
MD5_Final(md5, &mydata->ctx);
|
||||
for (i = 0; i < 16; ++i)
|
||||
sprintf(buf + i * 2, "%02X", md5[i]);
|
||||
append(session, "MD5 is<br>", 10);
|
||||
append(session, buf, 32);
|
||||
written += 42;
|
||||
}
|
||||
else if (mydata->type == 3)
|
||||
{
|
||||
if (mydata->fp != NULL)
|
||||
{
|
||||
fclose(mydata->fp);
|
||||
mydata->fp = NULL;
|
||||
append(session, "File uploaded.<br>", 18);
|
||||
written += 18;
|
||||
}
|
||||
}
|
||||
mydata->resp_done = 1;
|
||||
}
|
||||
|
||||
if (written > 0)
|
||||
g_api->flush(session);
|
||||
g_api->set_handler_write_state(session, 1);
|
||||
//g_api->end_resp(session);
|
||||
return readbytes;
|
||||
}
|
||||
|
||||
|
||||
static int begin_process(const lsi_session_t *session)
|
||||
{
|
||||
#define VALMAXSIZE 4096
|
||||
#define LINEMAXSIZE (VALMAXSIZE + 50)
|
||||
char val[VALMAXSIZE], line[LINEMAXSIZE] = {0};
|
||||
int n;
|
||||
int i;
|
||||
const char *p;
|
||||
char *buf;
|
||||
mydata_t *mydata = (mydata_t *)g_api->get_module_data(session, &MNAME,
|
||||
LSI_DATA_HTTP);
|
||||
ls_xpool_t *pPool = g_api->get_session_pool(session);
|
||||
|
||||
//Create response body
|
||||
append(session, CONTENT_HEAD, 0);
|
||||
|
||||
//Original request header
|
||||
n = g_api->get_req_raw_headers_length(session);
|
||||
buf = (char *)ls_xpool_alloc(pPool, n + 1);
|
||||
memset(buf, 0, n + 1);
|
||||
n = g_api->get_req_raw_headers(session, buf, n + 1);
|
||||
append(session, "Original request<table border=1><tr><td><pre>\r\n", 0);
|
||||
append(session, buf, n);
|
||||
append(session, "\r\n</pre></td></tr>\r\n", 0);
|
||||
ls_xpool_free(pPool, buf);
|
||||
|
||||
append(session, "\r\n</table><br>Request headers<br><table border=1>\r\n",
|
||||
0);
|
||||
for (i = 0; i < sizeof(reqhdr_array) / sizeof(char *); ++i)
|
||||
{
|
||||
p = g_api->get_req_header(session, reqhdr_array[i],
|
||||
strlen(reqhdr_array[i]), &n);
|
||||
if ((p != NULL) && p[0] != 0 && n > 0)
|
||||
{
|
||||
memcpy(val, p, n);
|
||||
val[n] = '\0';
|
||||
n = snprintf(line, LINEMAXSIZE - 1, CONTENT_FORMAT, reqhdr_array[i],
|
||||
val);
|
||||
append(session, line, n);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
append(session,
|
||||
"\r\n</table><br>Server req env<br><table border=1>\r\n", 0);
|
||||
//Server req env
|
||||
for (i = LSI_VAR_REMOTE_ADDR; i < LSI_VAR_COUNT; ++i)
|
||||
{
|
||||
n = g_api->get_req_var_by_id(session, i, val, VALMAXSIZE);
|
||||
if (n > 0)
|
||||
{
|
||||
val[n] = '\0';
|
||||
n = snprintf(line, LINEMAXSIZE - 1, CONTENT_FORMAT, req_array[i],
|
||||
val);
|
||||
append(session, line, n);
|
||||
}
|
||||
}
|
||||
|
||||
append(session, "\r\n</table><br>env varibles<br><table border=1>\r\n", 0);
|
||||
for (i = 0; i < sizeof(env_array) / sizeof(char *); ++i)
|
||||
{
|
||||
//env varibles
|
||||
n = g_api->get_req_env(session, env_array[i], strlen(env_array[i]), val,
|
||||
VALMAXSIZE);
|
||||
if (n > 0)
|
||||
{
|
||||
val[n] = '\0';
|
||||
n = snprintf(line, LINEMAXSIZE - 1, CONTENT_FORMAT, env_array[i],
|
||||
val);
|
||||
append(session, line, n);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
p = g_api->get_req_cookies(session, &n);
|
||||
if ((p != NULL) && p[0] != 0 && n > 0)
|
||||
{
|
||||
append(session,
|
||||
"\r\n</table><br>Request cookies<br><table border=1>\r\n", 0);
|
||||
append(session, "<tr><td>Cookie</td><td>", 0);
|
||||
append(session, p, n);
|
||||
append(session, "</td></tr>", 0);
|
||||
}
|
||||
|
||||
n = g_api->get_req_cookie_count(session);
|
||||
if (n > 0)
|
||||
{
|
||||
//try get a certen cookie
|
||||
p = g_api->get_cookie_value(session, "LSWSWEBUI", 9, &n);
|
||||
if ((p != NULL) && n > 0)
|
||||
{
|
||||
append(session, "<tr><td>cookie_LSWSWEBUI</td><td>", 0);
|
||||
append(session, p, n);
|
||||
append(session, "</td></tr>", 0);
|
||||
}
|
||||
}
|
||||
append(session, "</table>", 0);
|
||||
|
||||
n = get_reqbody_dealertype(session);
|
||||
|
||||
mydata->req_body_len = g_api->get_req_content_length(session);
|
||||
mydata->rcvd_req_body_len = 0;
|
||||
mydata->type = n;
|
||||
sprintf(line,
|
||||
"Will deal with the req body.Type = %d, req body lenghth = %d<br>",
|
||||
n, mydata->req_body_len);
|
||||
|
||||
append(session, line, 0);
|
||||
if (mydata->type == 0)
|
||||
{
|
||||
append(session, CONTENT_TAIL, 0);
|
||||
mydata->rcvd_done = 1;
|
||||
mydata->resp_done = 1;
|
||||
}
|
||||
|
||||
g_api->set_status_code(session, 200);
|
||||
|
||||
if (mydata->type == 3) // Save to file
|
||||
mydata->fp = fopen("/tmp/uploadfile", "wb");
|
||||
else if (mydata->type == 2) // Md5
|
||||
MD5_Init(&mydata->ctx);
|
||||
|
||||
g_api->flush(session);
|
||||
|
||||
// if ( mydata->type != 0)
|
||||
on_read(session);
|
||||
|
||||
//g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int on_write(const lsi_session_t *session)
|
||||
{
|
||||
mydata_t *mydata = (mydata_t *)g_api->get_module_data(session, &MNAME,
|
||||
LSI_DATA_HTTP);
|
||||
return (mydata == NULL || mydata->type == 0 || mydata->resp_done == 1) ?
|
||||
LSI_RSP_DONE : LSI_RSP_MORE;
|
||||
}
|
||||
|
||||
|
||||
static int rcvd_req_header_cbf(lsi_param_t *param)
|
||||
{
|
||||
const char *uri;
|
||||
int len;
|
||||
uri = g_api->get_req_uri(param->session, &len);
|
||||
if ((uri != NULL) && (len >= sizeof(testuri) - 1)
|
||||
&& (strncasecmp(uri, testuri, sizeof(testuri) - 1) == 0))
|
||||
g_api->register_req_handler(param->session, &MNAME, sizeof(testuri) - 1);
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
|
||||
static int init_module(lsi_module_t *module)
|
||||
{
|
||||
g_api->init_module_data(module, free_mydata, LSI_DATA_HTTP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int clean_up(const lsi_session_t *session)
|
||||
{
|
||||
g_api->free_module_data(session, &MNAME, LSI_DATA_HTTP,
|
||||
free_mydata);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static lsi_serverhook_t server_hooks[] =
|
||||
{
|
||||
{ LSI_HKPT_HTTP_BEGIN, initdata, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED },
|
||||
//{ LSI_HKPT_HTTP_END, resetdata, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED },
|
||||
{ LSI_HKPT_RCVD_REQ_HEADER, rcvd_req_header_cbf, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED },
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static lsi_reqhdlr_t myhandler = { begin_process, on_read, on_write, clean_up };
|
||||
|
||||
lsi_module_t MNAME =
|
||||
{
|
||||
LSI_MODULE_SIGNATURE, init_module, &myhandler, NULL, "", server_hooks
|
||||
};
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#define _GNU_SOURCE
|
||||
#include "../include/ls.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/**
|
||||
* Define the module name, MUST BE the same as .so file name;
|
||||
* i.e., if MNAME is testmodule, then the .so must be testmodule.so.
|
||||
*
|
||||
* How to test this sample
|
||||
* 1, Build the module, put reqobservmodule.so in $LSWS_HOME/modules
|
||||
* 2, Create a file with the bad words.
|
||||
* 3, Run curl and upload the file and access a dynamically generated page,
|
||||
* curl -F "file=@/home/.../filewithbadwords" http://localhost:8088/phpinfo.php
|
||||
* 4, If filewithbadwords contain at least one word in blockWords,
|
||||
* will get 403, otherwise will get 200
|
||||
*/
|
||||
|
||||
#define MNAME reqobservmodule
|
||||
lsi_module_t MNAME;
|
||||
|
||||
// Test if the request body contains below words, if so 403
|
||||
const char *block_words[] =
|
||||
{
|
||||
"badword1",
|
||||
"badword2",
|
||||
"badword3",
|
||||
};
|
||||
|
||||
lsi_module_t MNAME;
|
||||
|
||||
|
||||
static int has_bad_word(const char *s, size_t len)
|
||||
{
|
||||
int i;
|
||||
int ret = 0;
|
||||
for (i = 0; i < sizeof(block_words) / sizeof(char *); ++i)
|
||||
{
|
||||
if (memmem(s, len, block_words[i], strlen(block_words[i])) != NULL)
|
||||
{
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int check_req_whole_body(lsi_param_t *param)
|
||||
{
|
||||
off_t offset = 0;
|
||||
const char *pbuf;
|
||||
int len = 0;
|
||||
int ret ;
|
||||
void *preqbodybuf = g_api->get_req_body_buf(param->session);
|
||||
while (!g_api->is_body_buf_eof(preqbodybuf, offset))
|
||||
{
|
||||
pbuf = g_api->acquire_body_buf_block(preqbodybuf, offset, &len);
|
||||
if (pbuf == NULL)
|
||||
break;
|
||||
// this is for demonstration purpose, if bad words is at
|
||||
// the block boundery, will not be detected.
|
||||
// you should do better in a real-world application.
|
||||
ret = has_bad_word(pbuf, len);
|
||||
g_api->release_body_buf_block(preqbodybuf, offset);
|
||||
if (ret != 0)
|
||||
return LSI_ERROR;
|
||||
offset += len;
|
||||
}
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
|
||||
static int init_module(lsi_module_t *pModule)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static lsi_serverhook_t server_hooks[] =
|
||||
{
|
||||
{ LSI_HKPT_RCVD_REQ_BODY, check_req_whole_body, LSI_HOOK_EARLY, LSI_FLAG_ENABLED },
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
lsi_module_t MNAME =
|
||||
{
|
||||
LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "", server_hooks
|
||||
};
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* Define the module name, MUST BE the same as .so file name;
|
||||
* i.e., if MNAME is testmodule, then the .so must be testmodule.so.
|
||||
*/
|
||||
|
||||
#define MNAME sendfilehandler
|
||||
lsi_module_t MNAME;
|
||||
|
||||
static char testuri[] = "/sendfile";
|
||||
|
||||
|
||||
static int dummycall(lsi_param_t *param)
|
||||
{
|
||||
const char *in = (const char *)param->ptr1;
|
||||
int len = param->len1;
|
||||
int sent = g_api->stream_write_next(param, in, len);
|
||||
return sent;
|
||||
}
|
||||
|
||||
|
||||
static int rcvd_req_header_cbf(lsi_param_t *param)
|
||||
{
|
||||
const char *uri;
|
||||
int len;
|
||||
uri = g_api->get_req_uri(param->session, &len);
|
||||
if ((len >= sizeof(testuri) - 1)
|
||||
&& (strncasecmp(uri, testuri, sizeof(testuri) - 1) == 0))
|
||||
g_api->register_req_handler(param->session, &MNAME, sizeof(testuri) - 1);
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
|
||||
static int init_module(lsi_module_t *module)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int begin_process(const lsi_session_t *session)
|
||||
{
|
||||
struct stat sb;
|
||||
const char *file = "/home/user/ls0312/DEFAULT/html/test1";
|
||||
off_t off = 0;
|
||||
off_t sz = -1; //-1 set to send all data
|
||||
struct iovec vec[5] =
|
||||
{
|
||||
{"123\r\n", 5}, {"123 ", 4}, {"523", 3}, {"---", 3}, {"1235\r\n", 6}
|
||||
};
|
||||
static char txthello[] = "Hi, test send file\r\n";
|
||||
static char txterror[] = "Sorry, send file error\r\n";
|
||||
static char txtlast[] = "<p>The LAST<p>\r\n";
|
||||
|
||||
g_api->append_resp_body(session, txthello, sizeof(txthello) - 1);
|
||||
g_api->append_resp_bodyv(session, vec, 5);
|
||||
|
||||
if (stat(file, &sb) == 0)
|
||||
sz = sb.st_size - 5;
|
||||
|
||||
if (g_api->send_file(session, file, off, sz) < 0)
|
||||
g_api->append_resp_body(session, txterror, sizeof(txterror) - 1);
|
||||
|
||||
g_api->append_resp_body(session, txtlast, sizeof(txtlast) - 1);
|
||||
g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static lsi_serverhook_t server_hooks[] =
|
||||
{
|
||||
{ LSI_HKPT_RCVD_REQ_HEADER, rcvd_req_header_cbf, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED },
|
||||
//{ LSI_HKPT_SEND_RESP_BODY, dummycall, LSI_HOOK_NORMAL, 0 },
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static lsi_reqhdlr_t myhandler = { begin_process, NULL, NULL, NULL };
|
||||
|
||||
lsi_module_t MNAME =
|
||||
{
|
||||
LSI_MODULE_SIGNATURE, init_module, &myhandler, NULL, "", server_hooks
|
||||
};
|
||||
|
||||
@@ -1,178 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
/**
|
||||
* Define the module name, MUST BE the same as .so file name;
|
||||
* i.e., if MNAME is testmodule, then the .so must be testmodule.so.
|
||||
*
|
||||
* HOW TO TEST:
|
||||
* Go to any url with the query string:
|
||||
* ?setrespheader[0123], then you will get different response headers
|
||||
*
|
||||
* Tests:
|
||||
* mycb - The 1 bit in the query string is set.
|
||||
* Is an example of setting a response header.
|
||||
* If 1 bit is not set, it is an example of removing a session hook.
|
||||
* mycb2 - The 2 bit in the query string is set.
|
||||
* Is an example of setting a response header.
|
||||
* mycb3 - The 4 bit is set. Is an example of removing response headers.
|
||||
* mycb4 - The 8 bit is set. Is an example of getting response headers.
|
||||
*/
|
||||
|
||||
#define MNAME setrespheader
|
||||
lsi_module_t MNAME;
|
||||
|
||||
static char testurl[] = "setrespheader";
|
||||
|
||||
const char *headers[2] =
|
||||
{
|
||||
"Set-Cookie",
|
||||
"Addheader"
|
||||
};
|
||||
|
||||
const int numheaders = sizeof(headers) / sizeof(headers[0]);
|
||||
|
||||
|
||||
//test changing resp header
|
||||
static int mycb(lsi_param_t *rec)
|
||||
{
|
||||
g_api->set_resp_header(rec->session, LSI_RSPHDR_SERVER, NULL, 0,
|
||||
"/testServer 1.0", sizeof("/testServer 1.0") - 1, LSI_HEADEROP_SET);
|
||||
g_api->set_resp_header(rec->session, LSI_RSPHDR_SET_COOKIE, NULL, 0,
|
||||
"An Example Cookie", sizeof("An Example Cookie") - 1, LSI_HEADEROP_ADD);
|
||||
g_api->set_resp_header(rec->session, LSI_RSPHDR_SET_COOKIE, NULL, 0,
|
||||
"1 bit set!", sizeof("1 bit set!") - 1, LSI_HEADEROP_ADD);
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### mymodule1 test %s\n", "myCb");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//test changing resp header
|
||||
static int mycb2(lsi_param_t *rec)
|
||||
{
|
||||
g_api->set_resp_header2(rec->session, "Addheader: 2 bit set!\r\n",
|
||||
sizeof("Addheader: 2 bit set!\r\n") - 1, LSI_HEADEROP_SET);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int mycb3(lsi_param_t *rec)
|
||||
{
|
||||
|
||||
g_api->set_resp_header2(rec->session,
|
||||
"Destructheader: 4 bit set! Removing other headers...\r\n",
|
||||
sizeof("Destructheader: 4 bit set! Removing other headers...\r\n") - 1,
|
||||
LSI_HEADEROP_ADD);
|
||||
g_api->remove_resp_header(rec->session, LSI_RSPHDR_SET_COOKIE, NULL,
|
||||
0);
|
||||
g_api->remove_resp_header(rec->session, -1, "Addheader",
|
||||
sizeof("Addheader") - 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int mycb4(lsi_param_t *rec)
|
||||
{
|
||||
int i, j, iov_count = g_api->get_resp_headers_count(rec->session);
|
||||
struct iovec iov_key[iov_count], iov_val[iov_count];
|
||||
memset(iov_key, 0, sizeof(struct iovec) * iov_count);
|
||||
memset(iov_val, 0, sizeof(struct iovec) * iov_count);
|
||||
|
||||
g_api->set_resp_header2(rec->session,
|
||||
"ProtectorHeader: 8 bit set! Duplicating headers for potential removal!\r\n",
|
||||
sizeof("ProtectorHeader: 8 bit set! Duplicating headers for potential removal!\r\n")
|
||||
- 1, LSI_HEADEROP_ADD);
|
||||
iov_count = g_api->get_resp_headers(rec->session, iov_key, iov_val,
|
||||
iov_count);
|
||||
for (i = iov_count - 1; i >= 0; --i)
|
||||
{
|
||||
for (j = 0; j < numheaders; ++j)
|
||||
{
|
||||
if (strncmp(headers[j], (const char *)iov_key[i].iov_base,
|
||||
iov_key[i].iov_len) == 0)
|
||||
{
|
||||
char save[256];
|
||||
sprintf(save, "SavedHeader: %.*s\r\n",
|
||||
iov_val[i].iov_len, (char *)iov_val[i].iov_base
|
||||
);
|
||||
g_api->set_resp_header2(rec->session, save, strlen(save),
|
||||
LSI_HEADEROP_ADD);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int check_type(lsi_param_t *rec)
|
||||
{
|
||||
const char *qs;
|
||||
int sessionHookType = 0;
|
||||
qs = g_api->get_req_query_string(rec->session, NULL);
|
||||
sessionHookType = strtol(qs + sizeof(testurl) - 1, NULL, 10);
|
||||
if (sessionHookType & 0x01)
|
||||
mycb(rec);
|
||||
if (sessionHookType & 0x02)
|
||||
mycb2(rec);
|
||||
if (sessionHookType & 0x08)
|
||||
mycb4(rec);
|
||||
if (sessionHookType & 0x04)
|
||||
mycb3(rec);
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
|
||||
int check_if_remove_session_hook(lsi_param_t *rec)
|
||||
{
|
||||
const char *qs;
|
||||
int sessionHookType = 0;
|
||||
int iEnableHkpt = LSI_HKPT_SEND_RESP_HEADER;
|
||||
qs = g_api->get_req_query_string(rec->session, NULL);
|
||||
if (qs && strncasecmp(qs, testurl, sizeof(testurl) - 1) == 0)
|
||||
{
|
||||
sessionHookType = strtol(qs + sizeof(testurl) - 1, NULL, 10);
|
||||
if (sessionHookType & 0x0f)
|
||||
g_api->enable_hook(rec->session, &MNAME, 1,
|
||||
&iEnableHkpt, 1);
|
||||
}
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
|
||||
static int init_module(lsi_module_t *module)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static lsi_serverhook_t server_hooks[] =
|
||||
{
|
||||
{ LSI_HKPT_RCVD_REQ_HEADER, check_if_remove_session_hook, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED },
|
||||
{ LSI_HKPT_SEND_RESP_HEADER, check_type, LSI_HOOK_NORMAL, 0 },
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
lsi_module_t MNAME =
|
||||
{
|
||||
LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "", server_hooks
|
||||
};
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
#include <lsdef.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define MNAME testcontext
|
||||
lsi_module_t MNAME;
|
||||
|
||||
/** This module demonstrates how to assign specific contexts to module handlers
|
||||
*
|
||||
* After compiling the module with the ccc.sh script, move this module into
|
||||
* the $SERVERROOT/modules directory.
|
||||
*
|
||||
* In the server configuration, enable the module "testcontext"
|
||||
*
|
||||
* In a virtual host, for example, the Example virtual host, change the vhost
|
||||
* configuration to include a context "/testcon*" handled by this module:
|
||||
context /testcon*{
|
||||
type module
|
||||
handler testcontext
|
||||
}
|
||||
* Start the server, and if everything was done correctly, access any page
|
||||
* matching that context, i.e.
|
||||
* http://localhost:8088/testconThisShouldBeTheOutput
|
||||
*
|
||||
* The response should say something like:
|
||||
* The wildcard matched: ThisShouldBeTheOutput
|
||||
*
|
||||
*/
|
||||
|
||||
static const char *pPrefix = "/testcon";
|
||||
|
||||
const int maxOutLen = 1024;
|
||||
|
||||
static int begin_process(const lsi_session_t *session)
|
||||
{
|
||||
const char *uri;
|
||||
char out[maxOutLen];
|
||||
int iUriLen, iOutLen;
|
||||
g_api->set_status_code(session, 200);
|
||||
g_api->set_resp_header(session, LSI_RSPHDR_CONTENT_TYPE, NULL, 0,
|
||||
"text/html", 9, LSI_HEADEROP_SET);
|
||||
uri = g_api->get_req_uri(session, &iUriLen);
|
||||
if (memcmp(uri, pPrefix, strlen(pPrefix)) != 0)
|
||||
return LS_FAIL;
|
||||
|
||||
iOutLen = snprintf(out, maxOutLen, "The wildcard matched: %s\n",
|
||||
uri + strlen(pPrefix));
|
||||
g_api->append_resp_body(session, out, iOutLen);
|
||||
g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static lsi_reqhdlr_t myhandler = { begin_process, NULL, NULL, NULL };
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, NULL, &myhandler, NULL };
|
||||
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <ls.h>
|
||||
|
||||
#include <lsr/ls_xpool.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* This module tests setting the enable flag during the session.
|
||||
* It is recommended to use this along with testenableflag 2, 3, and 4.
|
||||
*
|
||||
* This one tests: Disabling statically enabled callback functions.
|
||||
*
|
||||
* To test: After compiling and installing this module, access a dynamically
|
||||
* processed page.
|
||||
*
|
||||
* i.e. curl -i http://localhost:8088/phpinfo.php
|
||||
*/
|
||||
|
||||
#define MNAME testenableflag1
|
||||
lsi_module_t MNAME;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#define VERSION "V1.0"
|
||||
|
||||
static int addoutput(lsi_param_t *rec, const char *level)
|
||||
{
|
||||
int len = 0, lenNew;
|
||||
char *pBuf;
|
||||
if (rec->len1 <= 0)
|
||||
return g_api->stream_write_next(rec, rec->ptr1, rec->len1);
|
||||
pBuf = ls_xpool_alloc(g_api->get_session_pool(rec->session),
|
||||
rec->len1 + strlen(level) + 1);
|
||||
snprintf(pBuf, rec->len1 + strlen(level) + 1, "%.*s%.*s",
|
||||
rec->len1, (const char *)rec->ptr1, strlen(level) + 1, level);
|
||||
lenNew = rec->len1 + strlen(level);
|
||||
len = g_api->stream_write_next(rec, pBuf, lenNew);
|
||||
if (len < lenNew)
|
||||
*rec->flag_out = LSI_CBFO_BUFFERED;
|
||||
if (len < rec->len1)
|
||||
return len;
|
||||
return rec->len1;
|
||||
}
|
||||
|
||||
static int addrecvresp(lsi_param_t *rec)
|
||||
{ return addoutput(rec, "RECV1: If this appears, something is wrong.\n"); }
|
||||
|
||||
|
||||
static int addsendresp(lsi_param_t *rec)
|
||||
{ return addoutput(rec, "SEND1: If this appears, something is wrong.\n"); }
|
||||
|
||||
static int beginSession(lsi_param_t *rec)
|
||||
{
|
||||
int aEnableHkpts[] = {LSI_HKPT_RECV_RESP_BODY, LSI_HKPT_SEND_RESP_BODY};
|
||||
g_api->enable_hook(rec->session, &MNAME, 0,
|
||||
aEnableHkpts, 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_HTTP_BEGIN, beginSession, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{
|
||||
LSI_HKPT_RECV_RESP_BODY, addrecvresp, LSI_HOOK_NORMAL,
|
||||
LSI_FLAG_ENABLED | LSI_FLAG_TRANSFORM
|
||||
},
|
||||
{
|
||||
LSI_HKPT_SEND_RESP_BODY, addsendresp, LSI_HOOK_NORMAL,
|
||||
LSI_FLAG_ENABLED | LSI_FLAG_TRANSFORM
|
||||
},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module()
|
||||
{
|
||||
MNAME.about = VERSION; //set version string
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "", serverHooks};
|
||||
@@ -1,96 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <ls.h>
|
||||
|
||||
#include <lsr/ls_xpool.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* This module tests setting the enable flag during the session.
|
||||
* It is recommended to use this along with testenableflag 1, 3, and 4.
|
||||
*
|
||||
* This one tests: Enabling statically disabled callback functions.
|
||||
*
|
||||
* To test: After compiling and installing this module, access a dynamically
|
||||
* processed page.
|
||||
*
|
||||
* i.e. curl -i http://localhost:8088/phpinfo.php
|
||||
*/
|
||||
|
||||
#define MNAME testenableflag2
|
||||
lsi_module_t MNAME;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#define VERSION "V1.0"
|
||||
|
||||
static int addoutput(lsi_param_t *rec, const char *level)
|
||||
{
|
||||
int len = 0, lenNew;
|
||||
char *pBuf;
|
||||
if (rec->len1 <= 0)
|
||||
return g_api->stream_write_next(rec, rec->ptr1, rec->len1);
|
||||
pBuf = ls_xpool_alloc(g_api->get_session_pool(rec->session),
|
||||
rec->len1 + strlen(level) + 1);
|
||||
snprintf(pBuf, rec->len1 + strlen(level) + 1, "%.*s%.*s",
|
||||
rec->len1, (const char *)rec->ptr1, strlen(level) + 1, level);
|
||||
lenNew = rec->len1 + strlen(level);
|
||||
len = g_api->stream_write_next(rec, pBuf, lenNew);
|
||||
if (len < lenNew)
|
||||
*rec->flag_out = LSI_CBFO_BUFFERED;
|
||||
if (len < rec->len1)
|
||||
return len;
|
||||
return rec->len1;
|
||||
}
|
||||
|
||||
static int addrecvresp(lsi_param_t *rec)
|
||||
{ return addoutput(rec, "RECV2: If this appears, good.\n"); }
|
||||
|
||||
|
||||
static int addsendresp(lsi_param_t *rec)
|
||||
{ return addoutput(rec, "SEND2: If this appears, good.\n"); }
|
||||
|
||||
static int beginSession(lsi_param_t *rec)
|
||||
{
|
||||
int aEnableHkpts[] = {LSI_HKPT_RECV_RESP_BODY, LSI_HKPT_SEND_RESP_BODY};
|
||||
g_api->enable_hook(rec->session, &MNAME, 1,
|
||||
aEnableHkpts, 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_HTTP_BEGIN, beginSession, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{
|
||||
LSI_HKPT_RECV_RESP_BODY, addrecvresp, LSI_HOOK_NORMAL,
|
||||
LSI_FLAG_TRANSFORM
|
||||
},
|
||||
{
|
||||
LSI_HKPT_SEND_RESP_BODY, addsendresp, LSI_HOOK_NORMAL,
|
||||
LSI_FLAG_TRANSFORM
|
||||
},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module()
|
||||
{
|
||||
MNAME.about = VERSION; //set version string
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "", serverHooks};
|
||||
@@ -1,96 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <ls.h>
|
||||
|
||||
#include <lsr/ls_xpool.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* This module tests setting the enable flag during the session.
|
||||
* It is recommended to use this along with testenableflag 1, 2, and 4.
|
||||
*
|
||||
* This one tests: Enabling statically enabled callback functions.
|
||||
*
|
||||
* To test: After compiling and installing this module, access a dynamically
|
||||
* processed page.
|
||||
*
|
||||
* i.e. curl -i http://localhost:8088/phpinfo.php
|
||||
*/
|
||||
|
||||
#define MNAME testenableflag3
|
||||
lsi_module_t MNAME;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#define VERSION "V1.0"
|
||||
|
||||
static int addoutput(lsi_param_t *rec, const char *level)
|
||||
{
|
||||
int len = 0, lenNew;
|
||||
char *pBuf;
|
||||
if (rec->len1 <= 0)
|
||||
return g_api->stream_write_next(rec, rec->ptr1, rec->len1);
|
||||
pBuf = ls_xpool_alloc(g_api->get_session_pool(rec->session),
|
||||
rec->len1 + strlen(level) + 1);
|
||||
snprintf(pBuf, rec->len1 + strlen(level) + 1, "%.*s%.*s",
|
||||
rec->len1, (const char *)rec->ptr1, strlen(level) + 1, level);
|
||||
lenNew = rec->len1 + strlen(level);
|
||||
len = g_api->stream_write_next(rec, pBuf, lenNew);
|
||||
if (len < lenNew)
|
||||
*rec->flag_out = LSI_CBFO_BUFFERED;
|
||||
if (len < rec->len1)
|
||||
return len;
|
||||
return rec->len1;
|
||||
}
|
||||
|
||||
static int addrecvresp(lsi_param_t *rec)
|
||||
{ return addoutput(rec, "RECV3: If this appears, good.\n"); }
|
||||
|
||||
|
||||
static int addsendresp(lsi_param_t *rec)
|
||||
{ return addoutput(rec, "SEND3: If this appears, good.\n"); }
|
||||
|
||||
static int beginSession(lsi_param_t *rec)
|
||||
{
|
||||
int aEnableHkpts[] = {LSI_HKPT_RECV_RESP_BODY, LSI_HKPT_SEND_RESP_BODY};
|
||||
g_api->enable_hook(rec->session, &MNAME, 1,
|
||||
aEnableHkpts, 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_HTTP_BEGIN, beginSession, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{
|
||||
LSI_HKPT_RECV_RESP_BODY, addrecvresp, LSI_HOOK_NORMAL,
|
||||
LSI_FLAG_ENABLED | LSI_FLAG_TRANSFORM
|
||||
},
|
||||
{
|
||||
LSI_HKPT_SEND_RESP_BODY, addsendresp, LSI_HOOK_NORMAL,
|
||||
LSI_FLAG_ENABLED | LSI_FLAG_TRANSFORM
|
||||
},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module()
|
||||
{
|
||||
MNAME.about = VERSION; //set version string
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "", serverHooks};
|
||||
@@ -1,96 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <ls.h>
|
||||
|
||||
#include <lsr/ls_xpool.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* This module tests setting the enable flag during the session.
|
||||
* It is recommended to use this along with testenableflag 1, 2, and 3.
|
||||
*
|
||||
* This one tests: Disabling statically disabled callback functions.
|
||||
*
|
||||
* To test: After compiling and installing this module, access a dynamically
|
||||
* processed page.
|
||||
*
|
||||
* i.e. curl -i http://localhost:8088/phpinfo.php
|
||||
*/
|
||||
|
||||
#define MNAME testenableflag4
|
||||
lsi_module_t MNAME;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#define VERSION "V1.0"
|
||||
|
||||
static int addoutput(lsi_param_t *rec, const char *level)
|
||||
{
|
||||
int len = 0, lenNew;
|
||||
char *pBuf;
|
||||
if (rec->len1 <= 0)
|
||||
return g_api->stream_write_next(rec, rec->ptr1, rec->len1);
|
||||
pBuf = ls_xpool_alloc(g_api->get_session_pool(rec->session),
|
||||
rec->len1 + strlen(level) + 1);
|
||||
snprintf(pBuf, rec->len1 + strlen(level) + 1, "%.*s%.*s",
|
||||
rec->len1, (const char *)rec->ptr1, strlen(level) + 1, level);
|
||||
lenNew = rec->len1 + strlen(level);
|
||||
len = g_api->stream_write_next(rec, pBuf, lenNew);
|
||||
if (len < lenNew)
|
||||
*rec->flag_out = LSI_CBFO_BUFFERED;
|
||||
if (len < rec->len1)
|
||||
return len;
|
||||
return rec->len1;
|
||||
}
|
||||
|
||||
static int addrecvresp(lsi_param_t *rec)
|
||||
{ return addoutput(rec, "RECV4: If this appears, something is wrong.\n"); }
|
||||
|
||||
|
||||
static int addsendresp(lsi_param_t *rec)
|
||||
{ return addoutput(rec, "SEND4: If this appears, something is wrong.\n"); }
|
||||
|
||||
static int beginSession(lsi_param_t *rec)
|
||||
{
|
||||
int aEnableHkpts[] = {LSI_HKPT_RECV_RESP_BODY, LSI_HKPT_SEND_RESP_BODY};
|
||||
g_api->enable_hook(rec->session, &MNAME, 0,
|
||||
aEnableHkpts, 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_HTTP_BEGIN, beginSession, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{
|
||||
LSI_HKPT_RECV_RESP_BODY, addrecvresp, LSI_HOOK_NORMAL,
|
||||
LSI_FLAG_TRANSFORM
|
||||
},
|
||||
{
|
||||
LSI_HKPT_SEND_RESP_BODY, addsendresp, LSI_HOOK_NORMAL,
|
||||
LSI_FLAG_TRANSFORM
|
||||
},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module()
|
||||
{
|
||||
MNAME.about = VERSION; //set version string
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "", serverHooks};
|
||||
@@ -1,122 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../include/ls.h"
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include "stdlib.h"
|
||||
#include <unistd.h>
|
||||
|
||||
#define MNAME testenv
|
||||
lsi_module_t MNAME;
|
||||
|
||||
#define URI_PREFIX "/testenv"
|
||||
#define max_file_len 1024
|
||||
|
||||
/**
|
||||
* HOW TO TEST
|
||||
* //testenv?modcompress:S1P-3000R1P-3000&moddecompress:S1P3000R1P3000
|
||||
*/
|
||||
|
||||
int assignHandler(lsi_param_t *rec)
|
||||
{
|
||||
int len;
|
||||
const char *p;
|
||||
const char *pEnd;
|
||||
const char *uri = g_api->get_req_uri(rec->session, &len);
|
||||
const char *nameStart;
|
||||
char name[128];
|
||||
int nameLen;
|
||||
const char *valStart;
|
||||
char val[128];
|
||||
int valLen;
|
||||
if (len < strlen(URI_PREFIX) ||
|
||||
strncasecmp(uri, URI_PREFIX, strlen(URI_PREFIX)) != 0)
|
||||
return 0;
|
||||
|
||||
g_api->register_req_handler(rec->session, &MNAME, 0);
|
||||
p = g_api->get_req_query_string(rec->session, &len);
|
||||
pEnd = p + len;
|
||||
while (p && p < pEnd)
|
||||
{
|
||||
nameStart = p;
|
||||
p = strchr(p, ':');
|
||||
if (p)
|
||||
{
|
||||
nameLen = p - nameStart;
|
||||
strncpy(name, nameStart, nameLen);
|
||||
name[nameLen] = 0x00;
|
||||
++p;
|
||||
|
||||
valStart = p;
|
||||
p = strchr(p, '&');
|
||||
if (p)
|
||||
{
|
||||
valLen = p - valStart;
|
||||
++p;
|
||||
}
|
||||
else
|
||||
{
|
||||
valLen = pEnd - valStart;
|
||||
p = pEnd;
|
||||
}
|
||||
|
||||
strncpy(val, valStart, valLen);
|
||||
val[valLen] = 0x00;
|
||||
|
||||
g_api->set_req_env(rec->session, name, nameLen, val, valLen);
|
||||
g_api->log(rec->session, LSI_LOG_INFO,
|
||||
"[Module:testEnv] setEnv name[%s] val[%s]\n", name, val);
|
||||
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int PsHandlerProcess(const lsi_session_t *session)
|
||||
{
|
||||
int i;
|
||||
//200KB
|
||||
char buf[51] = {0};
|
||||
int count = 0;
|
||||
for (i = 0; i < 2000; ++i)
|
||||
{
|
||||
snprintf(buf, 51, "%04d--0123456789012345678901234567890123456789**\r\n",
|
||||
++count);
|
||||
g_api->append_resp_body(session, buf, 50);
|
||||
}
|
||||
g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_RCVD_REQ_HEADER, assignHandler, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module(lsi_module_t *pModule)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_reqhdlr_t myhandler = { PsHandlerProcess, NULL, NULL, NULL };
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, &myhandler, NULL, "", serverHooks };
|
||||
@@ -1,55 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../include/ls.h"
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include "stdlib.h"
|
||||
#include <unistd.h>
|
||||
|
||||
#define MNAME testhttpauth
|
||||
lsi_module_t MNAME;
|
||||
|
||||
int httpAuth(lsi_param_t *rec)
|
||||
{
|
||||
//test if the IP is 127.0.0.1 pass through, otherwise, reply 403
|
||||
char ip[16] = {0};
|
||||
g_api->get_req_var_by_id(rec->session, LSI_VAR_GEOIP_ADDR, ip, 16);
|
||||
if (strcmp(ip, "127.0.0.1") == 0)
|
||||
return LSI_OK;
|
||||
else
|
||||
{
|
||||
g_api->set_status_code(rec->session, 403);
|
||||
g_api->log(rec->session, LSI_LOG_INFO, "Access denied since ip = %s.\n",
|
||||
ip);
|
||||
return LSI_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_HTTP_AUTH, httpAuth, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module(lsi_module_t *pModule)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "", serverHooks};
|
||||
@@ -1,228 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* This test module will reply the counter of how many times of your IP accessing,
|
||||
* and of the page being accessed, and how many times of this file be accessed
|
||||
* If test uri is /testmoduledata/file1, and if /file1 exists in testing vhost directory
|
||||
* then the uri will be handled
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/***
|
||||
* HOW TO TEST
|
||||
* Create a file "aaa", "bbb" in the /Example/html,
|
||||
* then curl http://127.0.0.1:8088/testmoduledata/aaa and
|
||||
* curl http://127.0.0.1:8088/testmoduledata/bbb,
|
||||
* you will see the result
|
||||
*
|
||||
*/
|
||||
#include "../include/ls.h"
|
||||
#include <lsr/ls_shm.h>
|
||||
#include <lsr/ls_confparser.h>
|
||||
#include <lsr/ls_pool.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <lsdef.h>
|
||||
|
||||
#define MNAME testmoduledata
|
||||
lsi_module_t MNAME;
|
||||
|
||||
#define URI_PREFIX "/testmoduledata"
|
||||
#define URI_PREFIX_LEN (sizeof(URI_PREFIX) - 1)
|
||||
|
||||
|
||||
#define max_file_len 1024
|
||||
ls_shmhash_t *pShmHash = NULL;
|
||||
|
||||
const char *sharedDataStr = "MySharedData";
|
||||
const int sharedDataLen = 12;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
long count;
|
||||
} CounterData;
|
||||
|
||||
int releaseCounterDataCb(void *data)
|
||||
{
|
||||
if (!data)
|
||||
return 0;
|
||||
|
||||
CounterData *pData = (CounterData *)data;
|
||||
pData->count = 0;
|
||||
ls_pfree(pData);
|
||||
return 0;
|
||||
}
|
||||
|
||||
CounterData *allocateMydata(const lsi_session_t *session,
|
||||
const lsi_module_t *module, int level)
|
||||
{
|
||||
CounterData *myData = (CounterData *)ls_palloc(sizeof(CounterData));
|
||||
if (myData == NULL)
|
||||
return NULL;
|
||||
|
||||
memset(myData, 0, sizeof(CounterData));
|
||||
g_api->set_module_data(session, module, level, (void *)myData);
|
||||
return myData;
|
||||
}
|
||||
|
||||
int assignHandler(lsi_param_t *rec)
|
||||
{
|
||||
const char *p;
|
||||
char path[max_file_len] = {0};
|
||||
CounterData *file_data;
|
||||
int len;
|
||||
const char *uri = g_api->get_req_uri(rec->session, &len);
|
||||
if (len >= URI_PREFIX_LEN &&
|
||||
strncasecmp(uri, URI_PREFIX, URI_PREFIX_LEN) == 0)
|
||||
{
|
||||
if (len == URI_PREFIX_LEN)
|
||||
p = "/";
|
||||
else
|
||||
p = uri + URI_PREFIX_LEN;
|
||||
if (0 == g_api->get_uri_file_path(rec->session, p, strlen(p), path,
|
||||
max_file_len) &&
|
||||
access(path, 0) != -1)
|
||||
{
|
||||
g_api->set_req_env(rec->session, "cache-control", 13, "no-cache", 8);
|
||||
g_api->register_req_handler(rec->session, &MNAME, 0);
|
||||
//set the FILE data here, so that needn't to parse the file path again later
|
||||
g_api->init_file_type_mdata(rec->session, &MNAME, path, strlen(path));
|
||||
file_data = (CounterData *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_FILE);
|
||||
if (file_data == NULL)
|
||||
file_data = allocateMydata(rec->session, &MNAME, LSI_DATA_FILE);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int PsHandlerProcess(const lsi_session_t *session)
|
||||
{
|
||||
CounterData *ip_data = NULL, *vhost_data = NULL, *file_data = NULL;
|
||||
char output[128];
|
||||
|
||||
ip_data = (CounterData *)g_api->get_module_data(session, &MNAME,
|
||||
LSI_DATA_IP);
|
||||
if (ip_data == NULL)
|
||||
ip_data = allocateMydata(session, &MNAME, LSI_DATA_IP);
|
||||
if (ip_data == NULL)
|
||||
return 500;
|
||||
|
||||
vhost_data = (CounterData *)g_api->get_module_data(session, &MNAME,
|
||||
LSI_DATA_VHOST);
|
||||
if (vhost_data == NULL)
|
||||
vhost_data = allocateMydata(session, &MNAME, LSI_DATA_VHOST);
|
||||
if (vhost_data == NULL)
|
||||
return 500;
|
||||
|
||||
file_data = (CounterData *)g_api->get_module_data(session, &MNAME,
|
||||
LSI_DATA_FILE);
|
||||
if (file_data == NULL)
|
||||
return 500;
|
||||
|
||||
++ip_data->count;
|
||||
++file_data->count;
|
||||
++vhost_data->count;
|
||||
|
||||
|
||||
int len = 1024, flag = 0;
|
||||
ls_shmoff_t offset = ls_shmhash_get(pShmHash,
|
||||
(const uint8_t *)URI_PREFIX, sizeof(URI_PREFIX) - 1, &len, &flag);
|
||||
if (offset == 0)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_ERROR,
|
||||
"ls_shmhash_get return 0, so quit.\n");
|
||||
return 500;
|
||||
}
|
||||
|
||||
char *pBuf = (char *)ls_shmhash_off2ptr(pShmHash, offset);
|
||||
int sharedCount = 0;
|
||||
if (strncmp(pBuf, sharedDataStr, sharedDataLen) != 0)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_ERROR,
|
||||
"[testmoduledata] Shm Htable returned incorrect"
|
||||
" number of arguments.\n");
|
||||
return 500;
|
||||
}
|
||||
sharedCount = strtol(pBuf + 13, NULL, 10);
|
||||
snprintf(pBuf, len, "%s %d\n", sharedDataStr, ++sharedCount);
|
||||
|
||||
sprintf(output,
|
||||
"IP counter = %ld\nVHost counter = %ld\nFile counter = %ld\n%s",
|
||||
ip_data->count, vhost_data->count, file_data->count, pBuf);
|
||||
g_api->append_resp_body(session, output, strlen(output));
|
||||
g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_RCVD_REQ_HEADER, assignHandler, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module(lsi_module_t *pModule)
|
||||
{
|
||||
ls_shmpool_t *pShmPool = ls_shm_opengpool("testSharedM", 0);
|
||||
if (pShmPool == NULL)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_ERROR,
|
||||
"ls_shm_opengpool return NULL, so quit.\n");
|
||||
return LS_FAIL;
|
||||
}
|
||||
pShmHash = ls_shmhash_open(pShmPool, NULL, 0, NULL, NULL);
|
||||
if (pShmHash == NULL)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_ERROR,
|
||||
"ls_shmhash_open return NULL, so quit.\n");
|
||||
return LS_FAIL;
|
||||
}
|
||||
|
||||
int len = 1024, flag = LSI_SHM_INIT;
|
||||
ls_shmoff_t offset = ls_shmhash_get(pShmHash,
|
||||
(const uint8_t *)URI_PREFIX, sizeof(URI_PREFIX) - 1, &len, &flag);
|
||||
if (offset == 0)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_ERROR,
|
||||
"ls_shmhash_get return 0, so quit.\n");
|
||||
return LS_FAIL;
|
||||
}
|
||||
|
||||
if (flag == LSI_SHM_CREATED)
|
||||
{
|
||||
//Set the init value to it
|
||||
uint8_t *pBuf = ls_shmhash_off2ptr(pShmHash, offset);
|
||||
snprintf((char *)pBuf, len, "MySharedData 0\r\n");
|
||||
}
|
||||
|
||||
g_api->init_module_data(pModule, releaseCounterDataCb,
|
||||
LSI_DATA_VHOST);
|
||||
g_api->init_module_data(pModule, releaseCounterDataCb, LSI_DATA_IP);
|
||||
g_api->init_module_data(pModule, releaseCounterDataCb,
|
||||
LSI_DATA_FILE);
|
||||
|
||||
return LS_OK;
|
||||
}
|
||||
|
||||
lsi_reqhdlr_t myhandler = { PsHandlerProcess, NULL, NULL, NULL };
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, &myhandler, NULL, "", serverHooks};
|
||||
@@ -1,234 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#define _GNU_SOURCE
|
||||
#include <ls.h>
|
||||
#include <lsr/ls_strtool.h>
|
||||
#include <lsr/ls_confparser.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
#include <ctype.h>
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* This module is for testing params of different context levels.
|
||||
* You can set it with different params in server, VHost/module and context
|
||||
* under VHost/module, and VHost/context levels, use such as "param1 123\n
|
||||
* param2 10\n..."
|
||||
* The uri in each context level must have "/test/", such as /test/, /test/1/2/,
|
||||
* and so on.
|
||||
*
|
||||
* You can test "get /test/1/", "get /test/1/2/testfile"
|
||||
*
|
||||
* The handler can be registered under the VHost/context or by enable the filters
|
||||
* somewhere, and then when the context matched the url and then the filter will
|
||||
* be called so that the filter will register itself as a handler.
|
||||
*
|
||||
* The result should be
|
||||
* If the hook is enabled, the filer may run and set itself as
|
||||
* handler, the result is always the context which match the longest uri,
|
||||
* the result is different for different context level.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#define MNAME testparam
|
||||
lsi_module_t MNAME;
|
||||
|
||||
|
||||
typedef struct _param_st
|
||||
{
|
||||
int param1;
|
||||
int param21;
|
||||
int param22;
|
||||
int param31;
|
||||
int param32;
|
||||
int param33;
|
||||
int param41;
|
||||
int param42;
|
||||
int param43;
|
||||
int param44;
|
||||
int param51;
|
||||
int param52;
|
||||
int param53;
|
||||
int param54;
|
||||
int param55;
|
||||
} param_st;
|
||||
|
||||
//Setup the below array to let web server know these params
|
||||
lsi_config_key_t myParam[] =
|
||||
{
|
||||
{"param1", 0, 0},
|
||||
{"param2", 0, 0},
|
||||
{"param3", 0, 0},
|
||||
{"param4", 0, 0},
|
||||
{"param5", 0, 0},
|
||||
{NULL, 0, 0} //The last position must have a NULL to indicate end of the array
|
||||
};
|
||||
|
||||
//return 0 for correctly parsing
|
||||
static int testparam_parseList(module_param_info_t *param, param_st *pConfig)
|
||||
{
|
||||
int *pParam;
|
||||
ls_confparser_t confparser;
|
||||
ls_confparser(&confparser);
|
||||
ls_objarray_t *pList = ls_confparser_line(&confparser, param->val,
|
||||
param->val + param->val_len);
|
||||
|
||||
int count = ls_objarray_getsize(pList);
|
||||
assert(count > 0);
|
||||
|
||||
//Comment: case param2, maxParamNum is 2, the line should be param2 [21 [22]],
|
||||
unsigned long maxParamNum = param->key_index + 1;
|
||||
if (maxParamNum > 5)
|
||||
maxParamNum = 1;
|
||||
|
||||
ls_str_t *p;
|
||||
long val;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count && i < maxParamNum; ++i)
|
||||
{
|
||||
p = (ls_str_t *)ls_objarray_getobj(pList, i);
|
||||
val = strtol(ls_str_cstr(p), NULL, 10);
|
||||
|
||||
switch(param->key_index)
|
||||
{
|
||||
case 0:
|
||||
pParam = &pConfig->param1 + i;
|
||||
break;
|
||||
case 1:
|
||||
pParam = &pConfig->param21 + i;
|
||||
break;
|
||||
case 2:
|
||||
pParam = &pConfig->param31 + i;
|
||||
break;
|
||||
case 3:
|
||||
pParam = &pConfig->param41 + i;
|
||||
break;
|
||||
case 4:
|
||||
pParam = &pConfig->param51 + i;
|
||||
break;
|
||||
}
|
||||
*pParam = val;
|
||||
}
|
||||
|
||||
ls_confparser_d(&confparser);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void *testparam_parseConfig(module_param_info_t *param, int param_count,
|
||||
void *_initial_config, int level, const char *name)
|
||||
{
|
||||
int i;
|
||||
param_st *pInitConfig = (param_st *)_initial_config;
|
||||
param_st *pConfig = (param_st *) malloc(sizeof(struct _param_st));
|
||||
if (!pConfig)
|
||||
return NULL;
|
||||
|
||||
if (pInitConfig)
|
||||
memcpy(pConfig, pInitConfig, sizeof(struct _param_st));
|
||||
else
|
||||
memset(pConfig, 0, sizeof(struct _param_st));
|
||||
|
||||
if (!param)
|
||||
return (void *)pConfig;
|
||||
|
||||
for (i=0 ;i<param_count; ++i)
|
||||
{
|
||||
testparam_parseList(¶m[i], pConfig);
|
||||
}
|
||||
return (void *)pConfig;
|
||||
}
|
||||
|
||||
static void testparam_freeConfig(void *_config)
|
||||
{
|
||||
free(_config);
|
||||
}
|
||||
|
||||
static int testparam_handlerBeginProcess(const lsi_session_t *session)
|
||||
{
|
||||
g_api->set_resp_header(session, LSI_RSPHDR_CONTENT_TYPE, NULL, 0,
|
||||
"text/plain", sizeof("text/plain") - 1, LSI_HEADEROP_SET);
|
||||
|
||||
param_st *pparam_st = (param_st *) g_api->get_config(session,
|
||||
&MNAME);
|
||||
char buf[1024];
|
||||
int len;
|
||||
if (pparam_st)
|
||||
{
|
||||
sprintf(buf,
|
||||
"Current uri is %s.\nContext uri is %s.\nparam1 = %d\nparam2 = %d %d\nparam3 = %d %d %d\nparam4 = %d %d %d %d\nparam5 = %d %d %d %d %d\n",
|
||||
g_api->get_req_uri(session, NULL),
|
||||
g_api->get_mapped_context_uri(session, &len),
|
||||
pparam_st->param1, pparam_st->param21, pparam_st->param22,
|
||||
pparam_st->param31, pparam_st->param32, pparam_st->param33,
|
||||
pparam_st->param41, pparam_st->param42, pparam_st->param43,
|
||||
pparam_st->param44,
|
||||
pparam_st->param51, pparam_st->param52, pparam_st->param53,
|
||||
pparam_st->param54, pparam_st->param55);
|
||||
|
||||
}
|
||||
else
|
||||
strcpy(buf,
|
||||
"There is no parameters extracted from Module Parameters - check web admin\n");
|
||||
g_api->append_resp_body(session, buf, strlen(buf));
|
||||
g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int uri_map_cbf(lsi_param_t *rec)
|
||||
{
|
||||
const char *uri;
|
||||
int len;
|
||||
uri = g_api->get_req_uri(rec->session, &len);
|
||||
if (len >= 10 && strcasestr(uri, "/testparam"))
|
||||
g_api->register_req_handler(rec->session, &MNAME, 10);
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_URI_MAP, uri_map_cbf, LSI_HOOK_EARLY, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int testparam_init(lsi_module_t *pModule)
|
||||
{
|
||||
param_st *pparam_st = (param_st *) g_api->get_config(NULL, pModule);
|
||||
if (pparam_st)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_INFO,
|
||||
"[testparam]Global level param: param1 = %d param2 = %d %d param3 = %d %d %d param4 = %d %d %d %d param5 = %d %d %d %d %d\n",
|
||||
pparam_st->param1, pparam_st->param21, pparam_st->param22,
|
||||
pparam_st->param31, pparam_st->param32, pparam_st->param33,
|
||||
pparam_st->param41, pparam_st->param42, pparam_st->param43,
|
||||
pparam_st->param44,
|
||||
pparam_st->param51, pparam_st->param52, pparam_st->param53,
|
||||
pparam_st->param54, pparam_st->param55);
|
||||
}
|
||||
else
|
||||
g_api->log(NULL, LSI_LOG_INFO,
|
||||
"[testparam]Global level NO params, ERROR.\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_reqhdlr_t testparam_myhandler = { testparam_handlerBeginProcess, NULL, NULL, NULL };
|
||||
lsi_confparser_t testparam_dealConfig = { testparam_parseConfig, testparam_freeConfig, myParam };
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, testparam_init, &testparam_myhandler, &testparam_dealConfig, "Version 1.1", serverHooks };
|
||||
@@ -1,143 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <lsdef.h>
|
||||
|
||||
#define MNAME testredirect
|
||||
#define TEST_URL "/testredirect"
|
||||
#define TEST_URL_LEN (sizeof(TEST_URL) -1)
|
||||
|
||||
#define DEST_URL "/index.html"
|
||||
|
||||
/* This module tests redirect operations.
|
||||
* Valid urls are /testredirect?x-y
|
||||
* x is a LSI URL Operation. Valid operations are outlined in the LSI_URL_OP enum in ls.h
|
||||
* y determines who handles the operation, 0 for the server, 1 for module.
|
||||
*
|
||||
* Note: If y = 1, only the redirect URL Ops are valid.
|
||||
*/
|
||||
|
||||
lsi_module_t MNAME;
|
||||
|
||||
int parse_qs(const char *qs, int *action, int *useHandler)
|
||||
{
|
||||
int len;
|
||||
const char *pBuf;
|
||||
if (!qs || (len = strlen(qs)) <= 0)
|
||||
return LS_FAIL;
|
||||
*action = strtol(qs, NULL, 10);
|
||||
pBuf = memchr(qs, '-', len);
|
||||
if (pBuf && useHandler)
|
||||
*useHandler = strtol(pBuf + 1, NULL, 10);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void report_error(const lsi_session_t *session, const char *qs)
|
||||
{
|
||||
char errBuf[512];
|
||||
sprintf(errBuf, "Error: Invalid argument.\n"
|
||||
"Query String was %s.\n"
|
||||
"Expected d-d, where d is an integer.\n"
|
||||
"Valid values for the first d are LSI URL Ops.\n"
|
||||
"Valid values for the second d are\n"
|
||||
"\t 0 for normal operations,\n"
|
||||
"\t 1 for module handled operations.\n"
|
||||
"If using module handled operations, can only use redirect URL Ops.\n",
|
||||
qs
|
||||
);
|
||||
g_api->append_resp_body(session, errBuf, strlen(errBuf));
|
||||
g_api->end_resp(session);
|
||||
}
|
||||
|
||||
//Checks to make sure URL Action is valid. 0 for valid, -1 for invalid.
|
||||
int test_range(int action)
|
||||
{
|
||||
action = action & 127;
|
||||
if (action == 0 || action == 1)
|
||||
return LS_OK;
|
||||
else if (action > 16 && action < 23)
|
||||
return LS_OK;
|
||||
else if (action > 32 && action < 39)
|
||||
return LS_OK;
|
||||
else if (action > 48 && action < 55)
|
||||
return 0;
|
||||
return LS_FAIL;
|
||||
}
|
||||
|
||||
int check_if_redirect(lsi_param_t *rec)
|
||||
{
|
||||
const char *uri;
|
||||
const char *qs;
|
||||
int action = LSI_URL_REWRITE;
|
||||
int useHandler = 0;
|
||||
int len;
|
||||
uri = g_api->get_req_uri(rec->session, &len);
|
||||
if (len >= strlen(TEST_URL)
|
||||
&& strncasecmp(uri, TEST_URL, strlen(TEST_URL)) == 0)
|
||||
{
|
||||
qs = g_api->get_req_query_string(rec->session, NULL);
|
||||
if (parse_qs(qs, &action, &useHandler) < 0)
|
||||
{
|
||||
report_error(rec->session, qs);
|
||||
return LSI_OK;
|
||||
}
|
||||
if (test_range(action) < 0)
|
||||
report_error(rec->session, qs);
|
||||
else if (!useHandler)
|
||||
g_api->set_uri_qs(rec->session, action, DEST_URL, sizeof(DEST_URL) - 1,
|
||||
"", 0);
|
||||
else if (action > 1)
|
||||
g_api->register_req_handler(rec->session, &MNAME, TEST_URL_LEN);
|
||||
else
|
||||
report_error(rec->session, qs);
|
||||
}
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_RCVD_REQ_HEADER, check_if_redirect, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module(lsi_module_t *pModule)
|
||||
{
|
||||
return LS_OK;
|
||||
}
|
||||
|
||||
static int handlerBeginProcess(const lsi_session_t *session)
|
||||
{
|
||||
const char *qs;
|
||||
int action = LSI_URL_REWRITE;
|
||||
qs = g_api->get_req_query_string(session, NULL);
|
||||
if (parse_qs(qs, &action, NULL) < 0)
|
||||
{
|
||||
report_error(session, qs);
|
||||
return LSI_OK;
|
||||
}
|
||||
if (action == 17 || action == 33 || action == 49)
|
||||
report_error(session, qs);
|
||||
else
|
||||
g_api->set_uri_qs(session, action, DEST_URL, sizeof(DEST_URL) - 1, "", 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_reqhdlr_t myhandler = { handlerBeginProcess, NULL, NULL, NULL };
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, &myhandler, NULL, "test redirect v1.0", serverHooks };
|
||||
@@ -1,141 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define MNAME testreqenv
|
||||
lsi_module_t MNAME;
|
||||
|
||||
/** This module will do a test of basic request env setting and getting.
|
||||
*
|
||||
* After compiling the module with the ccc.sh script, move this module into
|
||||
* the $SERVERROOT/modules directory.
|
||||
*
|
||||
* I tested this by setting a context from the Example virtual host (eg. /env/)
|
||||
* Such that it is handled by this module.
|
||||
*
|
||||
* To test, access that context, i.e. http://localhost:8088/env/
|
||||
* and check the log. There should be an INFO output that should say:
|
||||
* Not a match. Key: thisWillBeDeleted, Orig Val: ifStillHereSomethingWrong, Current Val:
|
||||
*
|
||||
* If there are any more or it is not there, then there is an error.
|
||||
*/
|
||||
|
||||
|
||||
static char resp_buf[] = "This part doesn't really matter much to me.\r\n";
|
||||
|
||||
static char *pKeys[] =
|
||||
{
|
||||
"myEnvName",
|
||||
"myEnvKey",
|
||||
"aNewBeginning",
|
||||
"keepThemComing",
|
||||
"thisWillBeDeleted",
|
||||
"fewMoreStarters",
|
||||
"wishIWasMoreCreative",
|
||||
"needToComeUpWithMore",
|
||||
"iThinkOneMoreShouldSuffice",
|
||||
"done",
|
||||
"justKiddingExactlyTen",
|
||||
"!thisWillBeDeleted"
|
||||
};
|
||||
|
||||
static char *pVals[] =
|
||||
{
|
||||
"myEnvTarget",
|
||||
"myEnvVal",
|
||||
"aNewEnding",
|
||||
"keepThemGoing",
|
||||
"ifStillHereSomethingWrong",
|
||||
"fewMoreFinishers",
|
||||
"wishIWasMoreUnimaginative",
|
||||
"needToComeUpWithLess",
|
||||
"oneMoreIsTooMuch",
|
||||
"unfinishedBusiness",
|
||||
"justKiddingExactlyEleven"
|
||||
};
|
||||
|
||||
const int iSize = 11;
|
||||
const int iMaxLen = 256;
|
||||
|
||||
static int begin_process(const lsi_session_t *session)
|
||||
{
|
||||
char outBuf[iMaxLen];
|
||||
int i, iOut;
|
||||
|
||||
for (i = 0; i < iSize; ++i)
|
||||
{
|
||||
iOut = g_api->get_req_env(session, pKeys[i], strlen(pKeys[i]),
|
||||
outBuf, iMaxLen);
|
||||
if (strncmp(outBuf, pVals[i], strlen(pVals[i])) != 0)
|
||||
{
|
||||
g_api->log(session, LSI_LOG_INFO,
|
||||
"Not a match. Key: %.*s, Orig Val: %.*s, Current Val: %.*s\n",
|
||||
strlen(pKeys[i]), pKeys[i], strlen(pVals[i]), pVals[i],
|
||||
iOut, outBuf);
|
||||
}
|
||||
}
|
||||
|
||||
g_api->set_status_code(session, 200);
|
||||
g_api->set_resp_header(session, LSI_RSPHDR_CONTENT_TYPE, NULL, 0,
|
||||
"text/html", 9, LSI_HEADEROP_SET);
|
||||
g_api->append_resp_body(session, resp_buf, sizeof(resp_buf) - 1);
|
||||
g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int beginSession(lsi_param_t *rec)
|
||||
{
|
||||
int i;
|
||||
const lsi_session_t *pSession = rec->session;
|
||||
|
||||
for (i = 0; i < iSize; ++i)
|
||||
{
|
||||
g_api->set_req_env(pSession, pKeys[i], strlen(pKeys[i]), pVals[i],
|
||||
strlen(pVals[i]));
|
||||
printf("After addEnv: %.*s\n", strlen(pKeys[i]), pKeys[i]);
|
||||
}
|
||||
//Delete the ToBeDeleted one
|
||||
g_api->set_req_env(pSession, pKeys[i], strlen(pKeys[i]), pVals[4],
|
||||
strlen(pVals[4]));
|
||||
printf("After addEnv: %.*s\n", strlen(pKeys[i]), pKeys[i]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int init_module()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_HTTP_BEGIN, beginSession, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static lsi_reqhdlr_t myhandler = { begin_process, NULL, NULL, NULL };
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, &myhandler, NULL, "v1.0",
|
||||
serverHooks
|
||||
};
|
||||
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../include/ls.h"
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include "stdlib.h"
|
||||
#include <unistd.h>
|
||||
|
||||
#define MNAME testserverhook
|
||||
lsi_module_t MNAME;
|
||||
|
||||
int write_log(const char *sHookName)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_DEBUG,
|
||||
"[Module:testserverhook] launch point %s\n", sHookName);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int writeALog1(lsi_param_t *rec) { return write_log("LSI_HKPT_MAIN_INITED"); }
|
||||
int writeALog2(lsi_param_t *rec) { return write_log("LSI_HKPT_MAIN_PREFORK"); }
|
||||
int writeALog3(lsi_param_t *rec) { return write_log("LSI_HKPT_MAIN_POSTFORK"); }
|
||||
int writeALog4(lsi_param_t *rec) { return write_log("LSI_HKPT_WORKER_INIT"); }
|
||||
int writeALog5(lsi_param_t *rec) { return write_log("LSI_HKPT_WORKER_ATEXIT"); }
|
||||
int writeALog6(lsi_param_t *rec) { return write_log("LSI_HKPT_MAIN_ATEXIT"); }
|
||||
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{ LSI_HKPT_MAIN_INITED, writeALog1, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{ LSI_HKPT_MAIN_PREFORK, writeALog2, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{ LSI_HKPT_MAIN_POSTFORK, writeALog3, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{ LSI_HKPT_WORKER_INIT, writeALog4, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{ LSI_HKPT_WORKER_ATEXIT, writeALog5, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{ LSI_HKPT_MAIN_ATEXIT, writeALog6, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module(lsi_module_t *pModule)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "testserverhook v1.0", serverHooks};
|
||||
@@ -1,129 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
/**
|
||||
* HOW TO TEST
|
||||
* /testsuspend/..... to set to suspend, and ?11 to set to handle
|
||||
*
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include "../../include/ls.h"
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
|
||||
#define MNAME testsuspend
|
||||
extern lsi_module_t MNAME;
|
||||
|
||||
|
||||
void timer_callback(const void *session)
|
||||
{
|
||||
|
||||
int len;
|
||||
const char *qs = g_api->get_req_query_string((const lsi_session_t *)session,
|
||||
&len);
|
||||
if (len > 1 && strstr(qs, "11"))
|
||||
g_api->register_req_handler((const lsi_session_t *)session, &MNAME, 12);
|
||||
|
||||
|
||||
g_api->create_session_resume_event((const lsi_session_t *)session, &MNAME);
|
||||
}
|
||||
|
||||
void *thread_callback(void *session)
|
||||
{
|
||||
sleep(5);
|
||||
timer_callback(session);
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
int suspendFunc(lsi_param_t *rec)
|
||||
{
|
||||
const char *uri;
|
||||
int len;
|
||||
uri = g_api->get_req_uri(rec->session, &len);
|
||||
if (len >= 12 && strcasestr(uri, "/testsuspend"))
|
||||
{
|
||||
|
||||
// //#define USE_TIMER_HERE
|
||||
// #ifdef USE_TIMER_HERE
|
||||
// g_api->set_timer(5000, timer_callback, (void *)rec->_session);
|
||||
// return LSI_SUSPEND;
|
||||
// #else
|
||||
// pthread_t mythread;
|
||||
// int rc = pthread_create(&mythread, NULL, thread_callback, (void *)rec->_session);
|
||||
// if (rc == 0)
|
||||
// {
|
||||
// return LSI_SUSPEND; //If ret LSI_SUSPEND, should set a timer or a thread to call hookResumeCallback()
|
||||
// }
|
||||
// #endif
|
||||
|
||||
pthread_t mythread;
|
||||
int rc = pthread_create(&mythread, NULL, thread_callback,
|
||||
(void *)rec->session);
|
||||
if (rc == 0)
|
||||
{
|
||||
return LSI_SUSPEND; //If ret LSI_SUSPEND, should set a timer or a thread to call hookResumeCallback()
|
||||
}
|
||||
}
|
||||
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_RCVD_REQ_HEADER, suspendFunc, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module(lsi_module_t *pModule)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//The first time the below function will be called, then onWriteEvent will be called next and next
|
||||
static int PsHandlerProcess(const lsi_session_t *session)
|
||||
{
|
||||
char tmBuf[30];
|
||||
time_t t;
|
||||
struct tm *tmp;
|
||||
t = time(NULL);
|
||||
tmp = gmtime(&t);
|
||||
strftime(tmBuf, 30, "%a, %d %b %Y %H:%M:%S GMT", tmp);
|
||||
g_api->set_resp_header(session, LSI_RSPHDR_CONTENT_TYPE, NULL, 0,
|
||||
"text/html", sizeof("text/html") - 1, LSI_HEADEROP_SET);
|
||||
g_api->set_resp_header(session, LSI_RSPHDR_LAST_MODIFIED, NULL, 0,
|
||||
tmBuf, 29, LSI_HEADEROP_SET);
|
||||
|
||||
char buf[1024];
|
||||
sprintf(buf,
|
||||
"This test suspend for 5 seconds and resume, now time is %ld<p>",
|
||||
(long)(time(NULL)));
|
||||
g_api->append_resp_body(session, buf, strlen(buf));
|
||||
g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_reqhdlr_t myhandler = { PsHandlerProcess, NULL, NULL, NULL };
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, &myhandler, NULL, "", serverHooks};
|
||||
@@ -1,162 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* HOW TO TEST
|
||||
* test url ....../testtimer wit Get or post, request also can have a request body.
|
||||
* One line response will be displayed in browser and suspend,
|
||||
* and after 5 seconds, it will continue to display the left. *
|
||||
* If with a req body, it will be displayed in the browser
|
||||
*
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//DEFINE the module name, MUST BE the same as .so file name
|
||||
//ie. if MNAME is testmodule, then the .so must be testmodule.so
|
||||
#define MNAME testtimer
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
lsi_module_t MNAME;
|
||||
static int onReadEvent(const lsi_session_t *session);
|
||||
|
||||
int uri_map_cbf(lsi_param_t *rec)
|
||||
{
|
||||
const char *uri;
|
||||
int len;
|
||||
uri = g_api->get_req_uri(rec->session, &len);
|
||||
if (len >= 11 && strncasecmp(uri, "/testtimer/", 11) == 0)
|
||||
{
|
||||
g_api->register_req_handler(rec->session, &MNAME, 10);
|
||||
g_api->set_req_env(rec->session, "cache-control", 13, "max-age 20", 10);
|
||||
}
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_URI_MAP, uri_map_cbf, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
int nullRelease(void *p)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int init(lsi_module_t *pModule)
|
||||
{
|
||||
g_api->init_module_data(pModule, nullRelease, LSI_DATA_HTTP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void timer_cb(const void *session)
|
||||
{
|
||||
char buf[1024];
|
||||
sprintf(buf, "Timer Triggered(1 second), time: %ld<br>\n",
|
||||
(long)(time(NULL)));
|
||||
g_api->append_resp_body((const lsi_session_t *)session, buf, strlen(buf));
|
||||
}
|
||||
|
||||
void repeat_cb(const void *session)
|
||||
{
|
||||
char buf[1024];
|
||||
sprintf(buf, "Repeating timer(200ms)!, time: %ld<br>\n",
|
||||
(long)(time(NULL)));
|
||||
g_api->append_resp_body((const lsi_session_t *)session, buf, strlen(buf));
|
||||
}
|
||||
|
||||
void finish_cb(const void *session)
|
||||
{
|
||||
int id;
|
||||
char buf[1024];
|
||||
const lsi_session_t *pSession = (const lsi_session_t *)session;
|
||||
id = (int)(long)g_api->get_module_data(session, &MNAME, LSI_DATA_HTTP);
|
||||
g_api->remove_timer(id);
|
||||
sprintf(buf, "Finishing timer(5 seconds)!, time: %ld<br>\n",
|
||||
(long)(time(NULL)));
|
||||
g_api->append_resp_body(pSession, buf, strlen(buf));
|
||||
g_api->set_handler_write_state(pSession, 1);
|
||||
|
||||
}
|
||||
|
||||
//The first time the below function will be called, then onWriteEvent will be called next and next
|
||||
static int PsHandlerProcess(const lsi_session_t *session)
|
||||
{
|
||||
char tmBuf[30];
|
||||
time_t t;
|
||||
struct tm *tmp;
|
||||
t = time(NULL);
|
||||
tmp = gmtime(&t);
|
||||
strftime(tmBuf, 30, "%a, %d %b %Y %H:%M:%S GMT", tmp);
|
||||
g_api->set_resp_header(session, LSI_RSPHDR_CONTENT_TYPE, NULL, 0,
|
||||
"text/html", sizeof("text/html") - 1, LSI_HEADEROP_SET);
|
||||
g_api->set_resp_header(session, LSI_RSPHDR_LAST_MODIFIED, NULL, 0,
|
||||
tmBuf, 29, LSI_HEADEROP_SET);
|
||||
|
||||
char buf[1024];
|
||||
sprintf(buf, "This test will take 5 seconds, now time is %ld\n<p>",
|
||||
(long)(time(NULL)));
|
||||
g_api->append_resp_body(session, buf, strlen(buf));
|
||||
g_api->flush(session);
|
||||
g_api->set_handler_write_state(session, 0);
|
||||
int id = g_api->set_timer(200, 1, repeat_cb, session);
|
||||
g_api->set_timer(1000, 0, timer_cb, session);
|
||||
g_api->set_timer(2000, 0, timer_cb, session);
|
||||
g_api->set_timer(3000, 0, timer_cb, session);
|
||||
g_api->set_timer(4000, 0, timer_cb, session);
|
||||
g_api->set_timer(5000, 0, finish_cb, session);
|
||||
g_api->set_module_data(session, &MNAME, LSI_DATA_HTTP,
|
||||
(void *)(long)id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int onReadEvent(const lsi_session_t *session)
|
||||
{
|
||||
char buf[8192];
|
||||
g_api->append_resp_body(session, "I got req body:<br>\n",
|
||||
sizeof("I got req body:<br>\n") - 1);
|
||||
int ret;
|
||||
while ((ret = g_api->read_req_body(session, buf, 8192)) > 0)
|
||||
g_api->append_resp_body(session, buf, ret);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int onWriteEvent(const lsi_session_t *session)
|
||||
{
|
||||
g_api->append_resp_body(session, "<br>Writing finished, bye.\n<p>",
|
||||
sizeof("<br>Writing finished, bye.\n<p>") - 1);
|
||||
return LSI_RSP_DONE;
|
||||
}
|
||||
|
||||
static int onCleanUp(const lsi_session_t *session)
|
||||
{
|
||||
int id = (int)(long)g_api->get_module_data(session, &MNAME,
|
||||
LSI_DATA_HTTP);
|
||||
g_api->remove_timer(id);
|
||||
g_api->set_module_data(session, &MNAME, LSI_DATA_HTTP, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_reqhdlr_t myhandler = { PsHandlerProcess, onReadEvent, onWriteEvent, onCleanUp };
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init, &myhandler, NULL, "", serverHooks};
|
||||
@@ -1,71 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../include/ls.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define MNAME testviewdata
|
||||
lsi_module_t MNAME;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#define VERSION "V1.0"
|
||||
|
||||
static int viewData0(lsi_param_t *rec, const char *level)
|
||||
{
|
||||
if (rec->len1 < 100)
|
||||
g_api->log(rec->session, LSI_LOG_INFO,
|
||||
"[testautocompress] viewData [%s] %s\n",
|
||||
level, (const char *)rec->ptr1);
|
||||
else
|
||||
{
|
||||
g_api->log(rec->session, LSI_LOG_INFO,
|
||||
"[testautocompress] viewData [%s] ", level);
|
||||
g_api->lograw(rec->session, rec->ptr1, 40);
|
||||
g_api->lograw(rec->session, "(...)", 5);
|
||||
g_api->lograw(rec->session, rec->ptr1 + rec->len1 - 40, 40);
|
||||
g_api->lograw(rec->session, "\n", 1);
|
||||
}
|
||||
return g_api->stream_write_next(rec, rec->ptr1, rec->len1);
|
||||
}
|
||||
|
||||
static int viewData1(lsi_param_t *rec) { return viewData0(rec, "RECV"); }
|
||||
static int viewData2(lsi_param_t *rec) { return viewData0(rec, "SEND"); }
|
||||
|
||||
static int beginSession(lsi_param_t *rec)
|
||||
{
|
||||
int aEnableHkpts[] = {LSI_HKPT_RECV_RESP_BODY, LSI_HKPT_SEND_RESP_BODY};
|
||||
g_api->enable_hook(rec->session, &MNAME, 1,
|
||||
aEnableHkpts, 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_HTTP_BEGIN, beginSession, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{LSI_HKPT_RECV_RESP_BODY, viewData1, LSI_HOOK_NORMAL, LSI_FLAG_DECOMPRESS_REQUIRED },
|
||||
{LSI_HKPT_SEND_RESP_BODY, viewData2, LSI_HOOK_NORMAL, LSI_FLAG_DECOMPRESS_REQUIRED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module()
|
||||
{
|
||||
MNAME.about = VERSION; //set version string
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "", serverHooks};
|
||||
@@ -1,169 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
#include <lsr/ls_loopbuf.h>
|
||||
#include <lsr/ls_xpool.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
//#include <zlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//DEFINE the module name, MUST BE the same as .so file name
|
||||
//ie. if MNAME is testmodule, then the .so must be testmodule.so
|
||||
#define MNAME updatehttpout
|
||||
#define TEST_STRING "_TEST_testmodule_ADD_A_STRING_HERE_<!--->"
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
lsi_module_t MNAME;
|
||||
#define MAX_BLOCK_BUFSIZE 8192
|
||||
|
||||
typedef struct _MyData
|
||||
{
|
||||
ls_loopbuf_t inWBuf;
|
||||
ls_loopbuf_t outWBuf;
|
||||
} MyData;
|
||||
|
||||
|
||||
|
||||
int httpRelease(void *data)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### mymodulehttp %s\n", "httpRelease");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int httpinit(lsi_param_t *rec)
|
||||
{
|
||||
MyData *myData = (MyData *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_HTTP);
|
||||
ls_xpool_t *pool = g_api->get_session_pool(rec->session);
|
||||
myData = (MyData *)ls_xpool_alloc(pool, sizeof(MyData));
|
||||
ls_loopbuf_x(&myData->inWBuf, MAX_BLOCK_BUFSIZE, pool);
|
||||
ls_loopbuf_x(&myData->outWBuf, MAX_BLOCK_BUFSIZE, pool);
|
||||
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### mymodulehttp init\n");
|
||||
g_api->set_module_data(rec->session, &MNAME, LSI_DATA_HTTP,
|
||||
(void *)myData);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int httprespwrite(lsi_param_t *rec)
|
||||
{
|
||||
MyData *myData = NULL;
|
||||
ls_xpool_t *pool = g_api->get_session_pool(rec->session);
|
||||
const char *in = rec->ptr1;
|
||||
int inLen = rec->len1;
|
||||
int written, total = 0;
|
||||
// int j;
|
||||
// char s[4] = {0};
|
||||
myData = (MyData *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_HTTP);
|
||||
|
||||
// for ( j=0; j<inLen; ++j )
|
||||
// {
|
||||
// sprintf(s, "%c ", (unsigned char)in[j]);
|
||||
// ls_loopbuf_xappend( &myData->m_outWBuf, s, 2, pool );
|
||||
// total += 2;
|
||||
// }
|
||||
|
||||
//If have content, append a string for testing
|
||||
if (inLen > 0)
|
||||
{
|
||||
ls_loopbuf_xappend(&myData->outWBuf, TEST_STRING, sizeof(TEST_STRING) - 1,
|
||||
pool);
|
||||
ls_loopbuf_xappend(&myData->outWBuf, in, inLen, pool);
|
||||
total = inLen + sizeof(TEST_STRING) - 1;
|
||||
}
|
||||
|
||||
ls_loopbuf_xstraight(&myData->outWBuf, pool);
|
||||
|
||||
written = g_api->stream_write_next(rec, ls_loopbuf_begin(&myData->outWBuf),
|
||||
ls_loopbuf_size(&myData->outWBuf));
|
||||
ls_loopbuf_popfront(&myData->outWBuf, written);
|
||||
|
||||
g_api->log(NULL, LSI_LOG_DEBUG,
|
||||
"#### mymodulehttp test, next caller written %d, return %d, left %d\n",
|
||||
written, total, ls_loopbuf_size(&myData->outWBuf));
|
||||
|
||||
|
||||
if (!ls_loopbuf_empty(&myData->outWBuf))
|
||||
{
|
||||
int hasData = 1;
|
||||
rec->flag_out = &hasData;
|
||||
}
|
||||
return inLen; //Because all data used, ruturn thr orignal length
|
||||
}
|
||||
|
||||
static char *getNullEndString(const char *s, int len, char *str,
|
||||
int maxLength)
|
||||
{
|
||||
if (len >= maxLength)
|
||||
len = maxLength - 1;
|
||||
memcpy(str, s, len);
|
||||
str[len] = 0x00;
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
int httpreqHeaderRecved(lsi_param_t *rec)
|
||||
{
|
||||
const char *host, *ua, *uri, *accept;
|
||||
char *headerBuf;
|
||||
int hostLen, uaLen, acceptLen, headerLen;
|
||||
char uaBuf[1024], hostBuf[128], acceptBuf[512];
|
||||
ls_xpool_t *pPool = g_api->get_session_pool(rec->session);
|
||||
|
||||
uri = g_api->get_req_uri(rec->session, NULL);
|
||||
host = g_api->get_req_header(rec->session, "Host", 4, &hostLen);
|
||||
ua = g_api->get_req_header(rec->session, "User-Agent", 10, &uaLen);
|
||||
accept = g_api->get_req_header(rec->session, "Accept", 6, &acceptLen);
|
||||
g_api->log(NULL, LSI_LOG_DEBUG,
|
||||
"#### mymodulehttp test, httpreqHeaderRecved URI:%s host:%s, ua:%s accept:%s\n",
|
||||
uri, getNullEndString(host, hostLen, hostBuf, 128), getNullEndString(ua,
|
||||
uaLen, uaBuf, 1024), getNullEndString(accept, acceptLen, acceptBuf, 512));
|
||||
|
||||
headerLen = g_api->get_req_raw_headers_length(rec->session);
|
||||
headerBuf = (char *)ls_xpool_alloc(pPool, headerLen + 1);
|
||||
memset(headerBuf, 0, headerLen + 1);
|
||||
g_api->get_req_raw_headers(rec->session, headerBuf, headerLen);
|
||||
g_api->log(NULL, LSI_LOG_DEBUG,
|
||||
"#### mymodulehttp test, httpreqHeaderRecved whole header: %s, length: %d\n",
|
||||
headerBuf, headerLen);
|
||||
|
||||
ls_xpool_free(pPool, headerBuf);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_HTTP_BEGIN, httpinit, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{LSI_HKPT_RECV_RESP_BODY, httprespwrite, LSI_HOOK_NORMAL, LSI_FLAG_TRANSFORM | LSI_FLAG_DECOMPRESS_REQUIRED | LSI_FLAG_ENABLED},
|
||||
{LSI_HKPT_RCVD_REQ_HEADER, httpreqHeaderRecved, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module(lsi_module_t *pModule)
|
||||
{
|
||||
g_api->init_module_data(pModule, httpRelease, LSI_DATA_HTTP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "", serverHooks};
|
||||
@@ -1,145 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
#include <lsr/ls_base64.h>
|
||||
#include <lsr/ls_loopbuf.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
#include <lsdef.h>
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//DEFINE the module name, MUST BE the same as .so file name
|
||||
//ie. if MNAME is testmodule, then the .so must be testmodule.so
|
||||
#define MNAME updatetcpin1
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
lsi_module_t MNAME;
|
||||
#define MAX_BLOCK_BUFSIZE 8192
|
||||
|
||||
typedef struct _MyData
|
||||
{
|
||||
ls_loopbuf_t inBuf;
|
||||
ls_loopbuf_t outBuf;
|
||||
} MyData;
|
||||
|
||||
int l4release(void *data)
|
||||
{
|
||||
MyData *myData = (MyData *)data;
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### updatetcpin1 test %s\n",
|
||||
"l4release");
|
||||
|
||||
if (myData)
|
||||
{
|
||||
ls_loopbuf_d(&myData->inBuf);
|
||||
ls_loopbuf_d(&myData->outBuf);
|
||||
free(myData);
|
||||
}
|
||||
|
||||
return LS_OK;
|
||||
}
|
||||
|
||||
|
||||
int l4init1(lsi_param_t *rec)
|
||||
{
|
||||
MyData *myData = (MyData *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_L4);
|
||||
if (!myData)
|
||||
{
|
||||
myData = (MyData *) malloc(sizeof(MyData));
|
||||
ls_loopbuf(&myData->inBuf, MAX_BLOCK_BUFSIZE);
|
||||
ls_loopbuf(&myData->outBuf, MAX_BLOCK_BUFSIZE);
|
||||
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### updatetcpin1 test %s\n", "l4init");
|
||||
g_api->set_module_data(rec->session, &MNAME, LSI_DATA_L4,
|
||||
(void *)myData);
|
||||
}
|
||||
else
|
||||
{
|
||||
ls_loopbuf_clear(&myData->inBuf);
|
||||
ls_loopbuf_clear(&myData->outBuf);
|
||||
}
|
||||
|
||||
return LS_OK;
|
||||
}
|
||||
|
||||
//expand the recieved data to base64 encode
|
||||
int l4recv1(lsi_param_t *rec)
|
||||
{
|
||||
#define PLAIN_BLOCK_SIZE 600
|
||||
#define ENCODE_BLOCK_SIZE (PLAIN_BLOCK_SIZE * 4 / 3 + 1)
|
||||
|
||||
MyData *myData = NULL;
|
||||
char *pBegin;
|
||||
char tmpBuf[ENCODE_BLOCK_SIZE];
|
||||
int len, sz;
|
||||
|
||||
myData = (MyData *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_L4);
|
||||
if (!myData)
|
||||
return LS_FAIL;
|
||||
|
||||
while ((len = g_api->stream_read_next(rec, tmpBuf, ENCODE_BLOCK_SIZE)) > 0)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_DEBUG,
|
||||
"#### updatetcpin1 test l4recv, inLn = %d\n", len);
|
||||
ls_loopbuf_append(&myData->inBuf, tmpBuf, len);
|
||||
}
|
||||
|
||||
while (!ls_loopbuf_empty(&myData->inBuf))
|
||||
{
|
||||
ls_loopbuf_straight(&myData->inBuf);
|
||||
pBegin = ls_loopbuf_begin(&myData->inBuf);
|
||||
sz = ls_loopbuf_size(&myData->inBuf);
|
||||
if (sz > PLAIN_BLOCK_SIZE)
|
||||
sz = PLAIN_BLOCK_SIZE;
|
||||
len = ls_base64_encode((const char *)pBegin, sz, tmpBuf);
|
||||
if (len > 0)
|
||||
{
|
||||
ls_loopbuf_append(&myData->outBuf, tmpBuf, len);
|
||||
ls_loopbuf_popfront(&myData->inBuf, sz);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
if (ls_loopbuf_size(&myData->outBuf) < rec->len1)
|
||||
rec->len1 = ls_loopbuf_size(&myData->outBuf);
|
||||
|
||||
if (rec->len1 > 0)
|
||||
ls_loopbuf_moveto(&myData->outBuf, (char *)rec->ptr1, rec->len1);
|
||||
|
||||
return rec->len1;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_L4_BEGINSESSION, l4init1, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{LSI_HKPT_L4_RECVING, l4recv1, LSI_HOOK_EARLY, LSI_FLAG_TRANSFORM | LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init(lsi_module_t *pModule)
|
||||
{
|
||||
g_api->init_module_data(pModule, l4release, LSI_DATA_L4);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init, NULL, NULL, "", serverHooks};
|
||||
@@ -1,145 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
#include <lsr/ls_base64.h>
|
||||
#include <lsr/ls_loopbuf.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
#include <lsdef.h>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//DEFINE the module name, MUST BE the same as .so file name
|
||||
//ie. if MNAME is testmodule, then the .so must be testmodule.so
|
||||
#define MNAME updatetcpin2
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
lsi_module_t MNAME;
|
||||
#define MAX_BLOCK_BUFSIZE 8192
|
||||
|
||||
typedef struct _MyData2
|
||||
{
|
||||
ls_loopbuf_t inBuf;
|
||||
ls_loopbuf_t outBuf;
|
||||
} MyData2;
|
||||
|
||||
static int l4release2(void *data)
|
||||
{
|
||||
MyData2 *myData = (MyData2 *)data;
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### updatetcpin1 test %s\n",
|
||||
"l4release");
|
||||
|
||||
if (myData)
|
||||
{
|
||||
ls_loopbuf_d(&myData->inBuf);
|
||||
ls_loopbuf_d(&myData->outBuf);
|
||||
free(myData);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int l4init2(lsi_param_t *rec)
|
||||
{
|
||||
MyData2 *myData = (MyData2 *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_L4);
|
||||
if (!myData)
|
||||
{
|
||||
myData = (MyData2 *) malloc(sizeof(MyData2));
|
||||
ls_loopbuf(&myData->inBuf, MAX_BLOCK_BUFSIZE);
|
||||
ls_loopbuf(&myData->outBuf, MAX_BLOCK_BUFSIZE);
|
||||
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### updatetcpin2 test %s\n", "l4init");
|
||||
g_api->set_module_data(rec->session, &MNAME, LSI_DATA_L4,
|
||||
(void *)myData);
|
||||
}
|
||||
else
|
||||
{
|
||||
ls_loopbuf_clear(&myData->inBuf);
|
||||
ls_loopbuf_clear(&myData->outBuf);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//expand the recieved data to base64 encode
|
||||
static int l4recv2(lsi_param_t *rec)
|
||||
{
|
||||
#define ENCODE_BLOCK_SIZE 800
|
||||
#define DECODE_BLOCK_SIZE (ENCODE_BLOCK_SIZE * 3 / 4 + 4)
|
||||
|
||||
MyData2 *myData = NULL;
|
||||
char *pBegin;
|
||||
char tmpBuf[ENCODE_BLOCK_SIZE];
|
||||
int len, sz;
|
||||
|
||||
myData = (MyData2 *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_L4);
|
||||
if (!myData)
|
||||
return LS_FAIL;
|
||||
|
||||
while ((len = g_api->stream_read_next(rec, tmpBuf, ENCODE_BLOCK_SIZE)) > 0)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_DEBUG,
|
||||
"#### updatetcpin2 test l4recv, inLn = %d\n", len);
|
||||
ls_loopbuf_append(&myData->inBuf, tmpBuf, len);
|
||||
}
|
||||
|
||||
while (!ls_loopbuf_empty(&myData->inBuf))
|
||||
{
|
||||
ls_loopbuf_straight(&myData->inBuf);
|
||||
pBegin = ls_loopbuf_begin(&myData->inBuf);
|
||||
sz = ls_loopbuf_size(&myData->inBuf);
|
||||
if (sz > ENCODE_BLOCK_SIZE)
|
||||
sz = ENCODE_BLOCK_SIZE;
|
||||
|
||||
len = ls_base64_decode((const char *)pBegin, sz, tmpBuf);
|
||||
if (len > 0)
|
||||
{
|
||||
ls_loopbuf_append(&myData->outBuf, tmpBuf, len);
|
||||
ls_loopbuf_popfront(&myData->inBuf, sz);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
if (ls_loopbuf_size(&myData->outBuf) < rec->len1)
|
||||
rec->len1 = ls_loopbuf_size(&myData->outBuf);
|
||||
|
||||
if (rec->len1 > 0)
|
||||
ls_loopbuf_moveto(&myData->outBuf, (char *)rec->ptr1, rec->len1);
|
||||
|
||||
return rec->len1;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_L4_BEGINSESSION, l4init2, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{LSI_HKPT_L4_RECVING, l4recv2, LSI_HOOK_EARLY + 1, LSI_FLAG_TRANSFORM | LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init(lsi_module_t *pModule)
|
||||
{
|
||||
g_api->init_module_data(pModule, l4release2, LSI_DATA_L4);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init, NULL, NULL, "", serverHooks };
|
||||
@@ -1,139 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
#include <lsr/ls_loopbuf.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
//#include <zlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//DEFINE the module name, MUST BE the same as .so file name
|
||||
//ie. if MNAME is testmodule, then the .so must be testmodule.so
|
||||
#define MNAME updatetcpout1
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
lsi_module_t MNAME;
|
||||
#define MAX_BLOCK_BUFSIZE 8192
|
||||
|
||||
typedef struct _MyData
|
||||
{
|
||||
ls_loopbuf_t writeBuf;
|
||||
} MyData;
|
||||
|
||||
int l4release(void *data)
|
||||
{
|
||||
MyData *myData = (MyData *)data;
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### updatetcpout1 test %s\n",
|
||||
"l4release");
|
||||
|
||||
if (myData)
|
||||
{
|
||||
ls_loopbuf_d(&myData->writeBuf);
|
||||
free(myData);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int l4init(lsi_param_t *rec)
|
||||
{
|
||||
|
||||
MyData *myData = (MyData *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_L4);
|
||||
if (!myData)
|
||||
{
|
||||
myData = (MyData *) malloc(sizeof(MyData));
|
||||
ls_loopbuf(&myData->writeBuf, MAX_BLOCK_BUFSIZE);
|
||||
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### updatetcpout1 test %s\n", "l4init");
|
||||
|
||||
g_api->set_module_data(rec->session, &MNAME, LSI_DATA_L4,
|
||||
(void *)myData);
|
||||
}
|
||||
else
|
||||
ls_loopbuf_clear(&myData->writeBuf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l4send(lsi_param_t *rec)
|
||||
{
|
||||
MyData *myData = NULL;
|
||||
char *pBegin;
|
||||
struct iovec *iov = (struct iovec *)rec->ptr1;
|
||||
int count = rec->len1;
|
||||
int total = 0;
|
||||
char s[4] = {0};
|
||||
int written = 0;
|
||||
int i, j;
|
||||
struct iovec iovOut;
|
||||
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### updatetcpoutdata test %s\n",
|
||||
"tcpsend");
|
||||
myData = (MyData *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_L4);
|
||||
if (MAX_BLOCK_BUFSIZE > ls_loopbuf_size(&myData->writeBuf))
|
||||
{
|
||||
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
pBegin = (char *)iov[i].iov_base;
|
||||
|
||||
for (j = 0; j < iov[i].iov_len; ++j)
|
||||
{
|
||||
sprintf(s, "=%02X", (unsigned char)pBegin[j]);
|
||||
ls_loopbuf_append(&myData->writeBuf, s, 3);
|
||||
++ total;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ls_loopbuf_straight(&myData->writeBuf);
|
||||
iovOut.iov_base = ls_loopbuf_begin(&myData->writeBuf);
|
||||
iovOut.iov_len = ls_loopbuf_size(&myData->writeBuf);
|
||||
written = g_api->stream_writev_next(rec, &iovOut, 1);
|
||||
ls_loopbuf_popfront(&myData->writeBuf, written);
|
||||
|
||||
g_api->log(NULL, LSI_LOG_DEBUG,
|
||||
"#### updatetcpoutdata test, next caller written %d, return %d, left %d\n",
|
||||
written, total, ls_loopbuf_size(&myData->writeBuf));
|
||||
|
||||
int hasData = 1;
|
||||
if (ls_loopbuf_size(&myData->writeBuf))
|
||||
rec->flag_out = (void *)&hasData;
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_L4_BEGINSESSION, l4init, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{LSI_HKPT_L4_SENDING, l4send, LSI_HOOK_EARLY, LSI_FLAG_TRANSFORM | LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init(lsi_module_t *pModule)
|
||||
{
|
||||
g_api->init_module_data(pModule, l4release, LSI_DATA_L4);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init, NULL, NULL, "", serverHooks};
|
||||
@@ -1,147 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
#include <lsr/ls_loopbuf.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
//#include <zlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//DEFINE the module name, MUST BE the same as .so file name
|
||||
//ie. if MNAME is testmodule, then the .so must be testmodule.so
|
||||
#define MNAME updatetcpout2
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
lsi_module_t MNAME;
|
||||
#define MAX_BLOCK_BUFSIZE 8192
|
||||
|
||||
typedef struct _MyData
|
||||
{
|
||||
ls_loopbuf_t writeBuf;
|
||||
} MyData;
|
||||
|
||||
int l4release(void *data)
|
||||
{
|
||||
MyData *myData = (MyData *)data;
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### updatetcpout2 test %s\n",
|
||||
"l4release");
|
||||
|
||||
if (myData)
|
||||
{
|
||||
ls_loopbuf_d(&myData->writeBuf);
|
||||
free(myData);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int l4init(lsi_param_t *rec)
|
||||
{
|
||||
|
||||
MyData *myData = (MyData *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_L4);
|
||||
if (!myData)
|
||||
{
|
||||
myData = (MyData *) malloc(sizeof(MyData));
|
||||
ls_loopbuf(&myData->writeBuf, MAX_BLOCK_BUFSIZE);
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### updatetcpout2 test %s\n", "l4init");
|
||||
g_api->set_module_data(rec->session, &MNAME, LSI_DATA_L4,
|
||||
(void *)myData);
|
||||
}
|
||||
else
|
||||
ls_loopbuf_clear(&myData->writeBuf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int l4send(lsi_param_t *rec)
|
||||
{
|
||||
int total = 0;
|
||||
|
||||
MyData *myData = NULL;
|
||||
char *pBegin;
|
||||
struct iovec *iov = (struct iovec *)rec->ptr1;
|
||||
int count = rec->len1;
|
||||
char s[4] = {0};
|
||||
int written = 0;
|
||||
int i, j;
|
||||
int c;
|
||||
struct iovec iovOut;
|
||||
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### updatetcpout2 test %s\n", "l4send");
|
||||
myData = (MyData *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_L4);
|
||||
|
||||
if (MAX_BLOCK_BUFSIZE > ls_loopbuf_size(&myData->writeBuf))
|
||||
{
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
total += iov[i].iov_len;
|
||||
pBegin = (char *)iov[i].iov_base;
|
||||
|
||||
for (j = 0; j < iov[i].iov_len; j += 3)
|
||||
{
|
||||
memcpy(s, pBegin + j, 3);
|
||||
if (*s == '=')
|
||||
c = strtol(s + 1, NULL, 16);
|
||||
else
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_INFO,
|
||||
"[Module: updatetcpout2] Error: Invalid entry in l4send.\n");
|
||||
return total;
|
||||
}
|
||||
s[0] = c;
|
||||
ls_loopbuf_append(&myData->writeBuf, s, 1);
|
||||
total += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ls_loopbuf_straight(&myData->writeBuf);
|
||||
iovOut.iov_base = ls_loopbuf_begin(&myData->writeBuf);
|
||||
iovOut.iov_len = ls_loopbuf_size(&myData->writeBuf);
|
||||
written = g_api->stream_writev_next(rec, &iovOut, 1);
|
||||
ls_loopbuf_popfront(&myData->writeBuf, written);
|
||||
|
||||
g_api->log(NULL, LSI_LOG_DEBUG,
|
||||
"#### updatetcpout2 test, next caller written %d, return %d, left %d\n",
|
||||
written, total, ls_loopbuf_size(&myData->writeBuf));
|
||||
|
||||
int hasData = 1;
|
||||
if (ls_loopbuf_size(&myData->writeBuf))
|
||||
rec->flag_out = (void *)&hasData;
|
||||
return total;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_L4_BEGINSESSION, l4init, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{LSI_HKPT_L4_SENDING, l4send, LSI_HOOK_EARLY + 1, LSI_FLAG_TRANSFORM | LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init(lsi_module_t *pModule)
|
||||
{
|
||||
g_api->init_module_data(pModule, l4release, LSI_DATA_L4);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init, NULL, NULL, "", serverHooks };
|
||||
@@ -1,97 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#define _GNU_SOURCE
|
||||
#include "../include/ls.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#define MNAME uploadchecker
|
||||
lsi_module_t MNAME;
|
||||
|
||||
static int is_bad_file(const char *path)
|
||||
{
|
||||
FILE *fp = fopen(path, "rb");
|
||||
if (!fp)
|
||||
return -1;
|
||||
|
||||
/**
|
||||
* In this example, we check if this file contains a string "_BAD_FILE_"
|
||||
* if yes, treat it as a bad file
|
||||
*/
|
||||
int ret = 0;
|
||||
char buf[8192];
|
||||
int len;
|
||||
while (len = fread(buf, 1, 8191, fp), len > 0)
|
||||
{
|
||||
buf[len] = 0x00;
|
||||
if (strstr(buf, "_BAD_FILE_"))
|
||||
{
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int check_req_uploaded_file(lsi_param_t *param)
|
||||
{
|
||||
char *path;
|
||||
int i;
|
||||
int count = g_api->get_req_args_count(param->session);
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
if (g_api->is_post_file_upload(param->session, i))
|
||||
{
|
||||
g_api->get_req_arg_by_idx(param->session, i, NULL, &path);
|
||||
|
||||
if (is_bad_file(path))
|
||||
return LSI_ERROR;
|
||||
}
|
||||
}
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
static int set_session(lsi_param_t *param)
|
||||
{
|
||||
g_api->parse_req_args(param->session, 1, 1, "/tmp/", 0666);
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
static int init_module(lsi_module_t *pModule)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static lsi_serverhook_t server_hooks[] =
|
||||
{
|
||||
{ LSI_HKPT_RCVD_REQ_HEADER, set_session, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED },
|
||||
{ LSI_HKPT_RCVD_REQ_BODY, check_req_uploaded_file, LSI_HOOK_EARLY, LSI_FLAG_ENABLED },
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
lsi_module_t MNAME =
|
||||
{
|
||||
LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "", server_hooks
|
||||
};
|
||||
|
||||
@@ -1,246 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <ls.h>
|
||||
#include <lsdef.h>
|
||||
#include <lsr/ls_loopbuf.h>
|
||||
#include <lsr/ls_xpool.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* Define the module name, MUST BE the same as .so file name;
|
||||
* i.e., if MNAME is testmodule, then the .so must be testmodule.so.
|
||||
* You can call the below to set to wait req body read and then start
|
||||
* to handle the req either in the filter or in the begin_process()
|
||||
* of the handler struct.
|
||||
*/
|
||||
|
||||
#define MNAME waitfullreqbody
|
||||
lsi_module_t MNAME;
|
||||
|
||||
#define VERSION "V1.2"
|
||||
|
||||
static char testuri[] = "/waitfullreqbody";
|
||||
|
||||
#define CONTENT_HEAD "<html><head><title>waitfullreqbody</title></head><body><p>\r\nHead<p>\r\n"
|
||||
#define CONTENT_FORMAT "<tr><td>%s</td><td>%s</td></tr><p>\r\n"
|
||||
#define CONTENT_TAIL "</body></html><p>\r\n"
|
||||
|
||||
#define MAX_BLOCK_BUFSIZE 8192
|
||||
|
||||
typedef struct mydata_s
|
||||
{
|
||||
ls_loopbuf_t inbuf;
|
||||
} mydata_t;
|
||||
|
||||
|
||||
static int httprelease(void *data)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### waitfullreqbody %s\n",
|
||||
"httprelease");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int httpinit(lsi_param_t *param)
|
||||
{
|
||||
mydata_t *mydata;
|
||||
ls_xpool_t *pool = g_api->get_session_pool(param->session);
|
||||
mydata = ls_xpool_alloc(pool, sizeof(mydata_t));
|
||||
ls_loopbuf_x(&mydata->inbuf, MAX_BLOCK_BUFSIZE, pool);
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### waitfullreqbody init\n");
|
||||
g_api->set_module_data(param->session, &MNAME, LSI_DATA_HTTP,
|
||||
(void *)mydata);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* httpreqread will try to read as much as possible from the next step
|
||||
* of the stream and hold the data, then double each char to the buffer.
|
||||
* If finally it has hold data, set the hasBufferedData to 1 with *((int *)param->_flag_out) = 1;
|
||||
* DO NOT SET TO 0, because the other module may already set to 1 when pass in this function.
|
||||
*
|
||||
*/
|
||||
static int httpreqread(lsi_param_t *param)
|
||||
{
|
||||
mydata_t *mydata = NULL;
|
||||
ls_xpool_t *pool = g_api->get_session_pool(param->session);
|
||||
char *pbegin;
|
||||
char tmpBuf[MAX_BLOCK_BUFSIZE];
|
||||
int len, sz, i;
|
||||
char *p = (char *)param->ptr1;
|
||||
|
||||
mydata = (mydata_t *)g_api->get_module_data(param->session, &MNAME,
|
||||
LSI_DATA_HTTP);
|
||||
if (mydata == NULL)
|
||||
return LS_FAIL;
|
||||
|
||||
while ((len = g_api->stream_read_next(param, tmpBuf,
|
||||
MAX_BLOCK_BUFSIZE)) > 0)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_DEBUG,
|
||||
"#### waitfullreqbody httpreqread, inLn = %d\n", len);
|
||||
ls_loopbuf_xappend(&mydata->inbuf, tmpBuf, len, pool);
|
||||
}
|
||||
|
||||
while (!ls_loopbuf_empty(&mydata->inbuf)
|
||||
&& (p - (char *)param->ptr1 < param->len1))
|
||||
{
|
||||
ls_loopbuf_xstraight(&mydata->inbuf, pool);
|
||||
pbegin = ls_loopbuf_begin(&mydata->inbuf);
|
||||
sz = ls_loopbuf_size(&mydata->inbuf);
|
||||
|
||||
//#define TESTCASE_2
|
||||
#ifndef TESTCASE_2
|
||||
//test case 1: double each cahr
|
||||
if (sz > param->len1 / 2)
|
||||
sz = param->len1 / 2;
|
||||
for (i = 0; i < sz; ++i)
|
||||
{
|
||||
*p++ = *pbegin;
|
||||
*p++ = *pbegin;
|
||||
++pbegin;
|
||||
}
|
||||
#else
|
||||
//test case 2: shink to half of the org req body
|
||||
if (sz > param->_param_len * 2)
|
||||
sz = param->_param_len * 2;
|
||||
for (i = 0; i < sz / 2; ++i)
|
||||
{
|
||||
*p++ = *pbegin;
|
||||
pbegin += 2;
|
||||
}
|
||||
#endif
|
||||
|
||||
ls_loopbuf_popfront(&mydata->inbuf, sz);
|
||||
}
|
||||
|
||||
param->len1 = p - (char *)param->ptr1;
|
||||
if (!ls_loopbuf_empty(&mydata->inbuf))
|
||||
*((int *)param->flag_out) = 1;
|
||||
|
||||
return param->len1;
|
||||
}
|
||||
|
||||
|
||||
static int rcvd_req_header_cbf(lsi_param_t *param)
|
||||
{
|
||||
const char *uri;
|
||||
int len;
|
||||
uri = g_api->get_req_uri(param->session, &len);
|
||||
if ((len >= sizeof(testuri) - 1)
|
||||
&& (strncasecmp(uri, testuri, sizeof(testuri) - 1) == 0))
|
||||
{
|
||||
g_api->register_req_handler(param->session, &MNAME, sizeof(testuri) - 1);
|
||||
//g_api->set_req_wait_full_body(param->_session);
|
||||
}
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
|
||||
static int init_module(lsi_module_t *module)
|
||||
{
|
||||
module->about = VERSION; //set version string
|
||||
g_api->init_module_data(module, httprelease, LSI_DATA_HTTP);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int on_read(const lsi_session_t *session)
|
||||
{
|
||||
char buf[MAX_BLOCK_BUFSIZE];
|
||||
int ret;
|
||||
int count = 0;
|
||||
char *txt;
|
||||
if (!g_api->is_req_body_finished(session))
|
||||
{
|
||||
sprintf(buf, CONTENT_FORMAT, "ERROR",
|
||||
"You must forget to set wait all req body!!!<p>\r\n");
|
||||
g_api->append_resp_body(session, buf, strlen(buf));
|
||||
return 1;
|
||||
}
|
||||
|
||||
txt = (char *)"<tr><td>";
|
||||
g_api->append_resp_body(session, txt, strlen(txt));
|
||||
txt = (char *)"WHOLE REQ BODY";
|
||||
g_api->append_resp_body(session, txt, strlen(txt));
|
||||
txt = "</td><td>";
|
||||
g_api->append_resp_body(session, txt, strlen(txt));
|
||||
|
||||
while ((ret = g_api->read_req_body(session, buf, MAX_BLOCK_BUFSIZE)) > 0)
|
||||
{
|
||||
g_api->append_resp_body(session, buf, ret);
|
||||
count += ret;
|
||||
}
|
||||
txt = (char *)"</td></tr><p>\r\n";
|
||||
g_api->append_resp_body(session, txt, strlen(txt));
|
||||
|
||||
sprintf(buf, "<p>total req length read is %d<p>\r\n", count);
|
||||
g_api->append_resp_body(session, buf, strlen(buf));
|
||||
g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int begin_process(const lsi_session_t *session)
|
||||
{
|
||||
char *txt;
|
||||
g_api->set_req_wait_full_body(session);
|
||||
txt = (char *)CONTENT_HEAD;
|
||||
g_api->append_resp_body(session, txt, strlen(txt));
|
||||
if (g_api->is_req_body_finished(session))
|
||||
{
|
||||
txt = (char *)"Action in begin_process<p>\r\n";
|
||||
g_api->append_resp_body(session, txt, strlen(txt));
|
||||
on_read(session);
|
||||
}
|
||||
else
|
||||
g_api->flush(session);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int clean_up(const lsi_session_t *session)
|
||||
{
|
||||
g_api->free_module_data(session, &MNAME, LSI_DATA_HTTP,
|
||||
httprelease);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static lsi_serverhook_t server_hooks[] =
|
||||
{
|
||||
{ LSI_HKPT_RCVD_REQ_HEADER, rcvd_req_header_cbf, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED },
|
||||
{ LSI_HKPT_HTTP_BEGIN, httpinit, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED },
|
||||
{ LSI_HKPT_RECV_REQ_BODY, httpreqread, LSI_HOOK_EARLY, LSI_FLAG_TRANSFORM | LSI_FLAG_ENABLED },
|
||||
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static lsi_reqhdlr_t myhandler = { begin_process, on_read, NULL, clean_up };
|
||||
|
||||
lsi_module_t MNAME =
|
||||
{
|
||||
LSI_MODULE_SIGNATURE, init_module, &myhandler, NULL, "", server_hooks
|
||||
};
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../include/ls.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define MNAME waitfullrespbody
|
||||
lsi_module_t MNAME;
|
||||
|
||||
#define VERSION "V1.0"
|
||||
|
||||
|
||||
static char testuri[] = "waitfullrespbody";
|
||||
static char desturl[] = "/index.html";
|
||||
|
||||
static int type2hook[] =
|
||||
{
|
||||
LSI_HKPT_RCVD_RESP_HEADER,
|
||||
LSI_HKPT_RECV_RESP_BODY,
|
||||
LSI_HKPT_RCVD_RESP_BODY,
|
||||
LSI_HKPT_SEND_RESP_HEADER,
|
||||
LSI_HKPT_RCVD_RESP_HEADER,
|
||||
LSI_HKPT_RECV_RESP_BODY,
|
||||
LSI_HKPT_RCVD_RESP_BODY,
|
||||
LSI_HKPT_SEND_RESP_HEADER,
|
||||
};
|
||||
|
||||
|
||||
static int internal_redir(lsi_param_t *param)
|
||||
{
|
||||
int action = LSI_URL_REDIRECT_INTERNAL;
|
||||
g_api->set_uri_qs(
|
||||
param->session, action, desturl, sizeof(desturl) - 1, "", 0);
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
|
||||
static int deny_access(lsi_param_t *param)
|
||||
{
|
||||
g_api->set_status_code(param->session, 406);
|
||||
return LSI_ERROR;
|
||||
}
|
||||
|
||||
|
||||
static int get_testtype(lsi_param_t *param)
|
||||
{
|
||||
int type = 0;
|
||||
int len;
|
||||
const char *qs = g_api->get_req_query_string(param->session, &len);
|
||||
char buf[256];
|
||||
if ((len >= sizeof(testuri) - 1)
|
||||
&& (strncasecmp(qs, testuri, sizeof(testuri) - 1) == 0))
|
||||
type = strtol(qs + sizeof(testuri) - 1, NULL, 10);
|
||||
else
|
||||
return 0;
|
||||
|
||||
if ((type < 1) || (type > 10))
|
||||
{
|
||||
snprintf(buf, sizeof(buf),
|
||||
"Error: Invalid argument. There must be a number\n"
|
||||
"between 1 and 10 (inclusive) after \'waitfullrespbody\'.\n"
|
||||
"Query String: [%.*s].\n", len, qs);
|
||||
g_api->append_resp_body(param->session, buf, strlen(buf));
|
||||
g_api->end_resp(param->session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
g_api->set_resp_wait_full_body(param->session);
|
||||
if (type <= 8)
|
||||
{
|
||||
g_api->enable_hook(param->session, &MNAME, 1,
|
||||
&type2hook[type - 1], 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int init_module(lsi_module_t *module)
|
||||
{
|
||||
module->about = VERSION; //set version string
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int session_hook_func(lsi_param_t *param)
|
||||
{
|
||||
int len;
|
||||
const char *qs = g_api->get_req_query_string(param->session, &len);
|
||||
if ((qs == NULL) || (len < sizeof(testuri)))
|
||||
return 0;
|
||||
|
||||
int type = strtol(qs + sizeof(testuri) - 1, NULL, 10);
|
||||
return (type < 5) ? internal_redir(param) : deny_access(param);
|
||||
}
|
||||
|
||||
|
||||
static lsi_serverhook_t server_hooks[] =
|
||||
{
|
||||
{ LSI_HKPT_RCVD_REQ_HEADER, get_testtype, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED },
|
||||
|
||||
{ LSI_HKPT_RCVD_RESP_HEADER, session_hook_func, LSI_HOOK_NORMAL, 0 },
|
||||
{ LSI_HKPT_RECV_RESP_BODY, session_hook_func, LSI_HOOK_NORMAL, 0 },
|
||||
{ LSI_HKPT_RCVD_RESP_BODY, session_hook_func, LSI_HOOK_NORMAL, 0 },
|
||||
{ LSI_HKPT_SEND_RESP_HEADER, session_hook_func, LSI_HOOK_NORMAL, 0 },
|
||||
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
lsi_module_t MNAME =
|
||||
{
|
||||
LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "", server_hooks
|
||||
};
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
SSL_COUNTRY=US
|
||||
SSL_STATE=NJ
|
||||
SSL_LOCALITY=Virtual
|
||||
SSL_ORG=LiteSpeedCommunity
|
||||
SSL_ORGUNIT=Testing
|
||||
SSL_HOSTNAME=webadmin
|
||||
SSL_EMAIL=.
|
||||
@@ -1,311 +0,0 @@
|
||||
# This file was generated.
|
||||
# It contains the lists of macros which have been traced.
|
||||
# It can be safely removed.
|
||||
|
||||
@request = (
|
||||
bless( [
|
||||
'0',
|
||||
1,
|
||||
[
|
||||
'/usr/share/autoconf'
|
||||
],
|
||||
[
|
||||
'/usr/share/autoconf/autoconf/autoconf.m4f',
|
||||
'-',
|
||||
'/usr/share/aclocal-1.13/internal/ac-config-macro-dirs.m4',
|
||||
'/usr/share/aclocal/argz.m4',
|
||||
'/usr/share/aclocal/libtool.m4',
|
||||
'/usr/share/aclocal/ltdl.m4',
|
||||
'/usr/share/aclocal/ltoptions.m4',
|
||||
'/usr/share/aclocal/ltsugar.m4',
|
||||
'/usr/share/aclocal/ltversion.m4',
|
||||
'/usr/share/aclocal/lt~obsolete.m4',
|
||||
'/usr/share/aclocal-1.13/amversion.m4',
|
||||
'/usr/share/aclocal-1.13/auxdir.m4',
|
||||
'/usr/share/aclocal-1.13/cond.m4',
|
||||
'/usr/share/aclocal-1.13/depend.m4',
|
||||
'/usr/share/aclocal-1.13/depout.m4',
|
||||
'/usr/share/aclocal-1.13/init.m4',
|
||||
'/usr/share/aclocal-1.13/install-sh.m4',
|
||||
'/usr/share/aclocal-1.13/lead-dot.m4',
|
||||
'/usr/share/aclocal-1.13/make.m4',
|
||||
'/usr/share/aclocal-1.13/missing.m4',
|
||||
'/usr/share/aclocal-1.13/obsolete.m4',
|
||||
'/usr/share/aclocal-1.13/options.m4',
|
||||
'/usr/share/aclocal-1.13/runlog.m4',
|
||||
'/usr/share/aclocal-1.13/sanity.m4',
|
||||
'/usr/share/aclocal-1.13/silent.m4',
|
||||
'/usr/share/aclocal-1.13/strip.m4',
|
||||
'/usr/share/aclocal-1.13/substnot.m4',
|
||||
'/usr/share/aclocal-1.13/tar.m4',
|
||||
'configure.ac'
|
||||
],
|
||||
{
|
||||
'AC_ENABLE_SHARED' => 1,
|
||||
'LT_SYS_MODULE_EXT' => 1,
|
||||
'_LT_AC_SHELL_INIT' => 1,
|
||||
'AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE' => 1,
|
||||
'_AM_IF_OPTION' => 1,
|
||||
'LT_AC_PROG_SED' => 1,
|
||||
'_LT_AC_LANG_RC_CONFIG' => 1,
|
||||
'AC_LIBTOOL_LANG_GCJ_CONFIG' => 1,
|
||||
'AC_LIBTOOL_PROG_LD_SHLIBS' => 1,
|
||||
'_AM_AUTOCONF_VERSION' => 1,
|
||||
'_LT_AC_FILE_LTDLL_C' => 1,
|
||||
'AX_LIB_EXPAT' => 1,
|
||||
'_AM_DEPENDENCIES' => 1,
|
||||
'_LT_AC_PROG_CXXCPP' => 1,
|
||||
'AC_LIBTOOL_LANG_C_CONFIG' => 1,
|
||||
'_AM_OUTPUT_DEPENDENCY_COMMANDS' => 1,
|
||||
'AC_LIBTOOL_SETUP' => 1,
|
||||
'LT_CONFIG_LTDL_DIR' => 1,
|
||||
'_LT_COMPILER_OPTION' => 1,
|
||||
'_LT_PREPARE_SED_QUOTE_VARS' => 1,
|
||||
'AC_CONFIG_MACRO_DIR_TRACE' => 1,
|
||||
'LT_SYS_SYMBOL_USCORE' => 1,
|
||||
'AM_OUTPUT_DEPENDENCY_COMMANDS' => 1,
|
||||
'AM_PROG_INSTALL_SH' => 1,
|
||||
'AC_LIBTOOL_COMPILER_OPTION' => 1,
|
||||
'AM_SANITY_CHECK' => 1,
|
||||
'LT_WITH_LTDL' => 1,
|
||||
'AC_ENABLE_STATIC' => 1,
|
||||
'_LT_AC_LANG_F77_CONFIG' => 1,
|
||||
'_m4_warn' => 1,
|
||||
'CHECK_SSL' => 1,
|
||||
'_LT_WITH_SYSROOT' => 1,
|
||||
'_LT_AC_TAGVAR' => 1,
|
||||
'AC_LTDL_PREOPEN' => 1,
|
||||
'AM_RUN_LOG' => 1,
|
||||
'AC_DISABLE_STATIC' => 1,
|
||||
'AM_DISABLE_SHARED' => 1,
|
||||
'_AM_SET_OPTIONS' => 1,
|
||||
'LT_OUTPUT' => 1,
|
||||
'_LT_COMPILER_BOILERPLATE' => 1,
|
||||
'AM_PROG_NM' => 1,
|
||||
'AM_DEP_TRACK' => 1,
|
||||
'_AC_PROG_LIBTOOL' => 1,
|
||||
'_LT_CC_BASENAME' => 1,
|
||||
'LT_CMD_MAX_LEN' => 1,
|
||||
'gl_PREREQ_ARGZ' => 1,
|
||||
'AC_LIBTOOL_SYS_HARD_LINK_LOCKS' => 1,
|
||||
'AM_SUBST_NOTMAKE' => 1,
|
||||
'_LT_PROG_LTMAIN' => 1,
|
||||
'AC_DEFUN' => 1,
|
||||
'AM_CONDITIONAL' => 1,
|
||||
'AC_DEFUN_ONCE' => 1,
|
||||
'AC_WITH_LTDL' => 1,
|
||||
'm4_include' => 1,
|
||||
'AC_BROTLI_CHECK' => 1,
|
||||
'AC_PROG_LD_RELOAD_FLAG' => 1,
|
||||
'AM_SILENT_RULES' => 1,
|
||||
'AC_DEPLIBS_CHECK_METHOD' => 1,
|
||||
'LT_INIT' => 1,
|
||||
'AM_CONFIG_HEADER' => 1,
|
||||
'AC_IP2LOCATION_CHECK' => 1,
|
||||
'_LT_PROG_CXX' => 1,
|
||||
'_LT_AC_LANG_CXX' => 1,
|
||||
'AC_LIBTOOL_LANG_CXX_CONFIG' => 1,
|
||||
'AC_LTDL_SHLIBEXT' => 1,
|
||||
'_LT_AC_LANG_GCJ' => 1,
|
||||
'AC_LIBLTDL_INSTALLABLE' => 1,
|
||||
'gl_FUNC_ARGZ' => 1,
|
||||
'AC_LIBTOOL_SYS_OLD_ARCHIVE' => 1,
|
||||
'CHECK_ZLIB' => 1,
|
||||
'AC_PROG_LD_GNU' => 1,
|
||||
'_LT_PATH_TOOL_PREFIX' => 1,
|
||||
'_LT_AC_CHECK_DLFCN' => 1,
|
||||
'AC_LTDL_SYSSEARCHPATH' => 1,
|
||||
'include' => 1,
|
||||
'AC_PATH_TOOL_PREFIX' => 1,
|
||||
'AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH' => 1,
|
||||
'_AC_AM_CONFIG_HEADER_HOOK' => 1,
|
||||
'AC_LIBTOOL_DLOPEN' => 1,
|
||||
'AC_CONFIG_MACRO_DIR' => 1,
|
||||
'LT_SYS_DLOPEN_DEPLIBS' => 1,
|
||||
'LTVERSION_VERSION' => 1,
|
||||
'_LT_AC_LANG_C_CONFIG' => 1,
|
||||
'AC_DISABLE_FAST_INSTALL' => 1,
|
||||
'LT_AC_PROG_EGREP' => 1,
|
||||
'AX_CHECK_ZLIB' => 1,
|
||||
'AC_LTDL_SYMBOL_USCORE' => 1,
|
||||
'AM_PROG_INSTALL_STRIP' => 1,
|
||||
'_LT_AC_SYS_LIBPATH_AIX' => 1,
|
||||
'_LT_AC_PROG_ECHO_BACKSLASH' => 1,
|
||||
'AM_PROG_LIBTOOL' => 1,
|
||||
'_LT_LINKER_BOILERPLATE' => 1,
|
||||
'LTOBSOLETE_VERSION' => 1,
|
||||
'_LT_REQUIRED_DARWIN_CHECKS' => 1,
|
||||
'LT_LIB_M' => 1,
|
||||
'LTSUGAR_VERSION' => 1,
|
||||
'AC_LIBTOOL_RC' => 1,
|
||||
'LTDL_CONVENIENCE' => 1,
|
||||
'AC_LIBTOOL_OBJDIR' => 1,
|
||||
'AC_LIBTOOL_PROG_COMPILER_PIC' => 1,
|
||||
'AM_MISSING_PROG' => 1,
|
||||
'_AM_SET_OPTION' => 1,
|
||||
'AC_LTDL_SYS_DLOPEN_DEPLIBS' => 1,
|
||||
'AC_LIBTOOL_LANG_RC_CONFIG' => 1,
|
||||
'LT_SYS_DLOPEN_SELF' => 1,
|
||||
'AC_LIBTOOL_SYS_MAX_CMD_LEN' => 1,
|
||||
'LT_AC_PROG_GCJ' => 1,
|
||||
'AC_LIBLTDL_CONVENIENCE' => 1,
|
||||
'LTDL_INSTALLABLE' => 1,
|
||||
'AM_PROG_CC_STDC' => 1,
|
||||
'AC_PROG_LIBTOOL' => 1,
|
||||
'_LT_PROG_F77' => 1,
|
||||
'AC_LTDL_DLLIB' => 1,
|
||||
'_AM_MANGLE_OPTION' => 1,
|
||||
'AC_LIBTOOL_CONFIG' => 1,
|
||||
'LT_PROG_GCJ' => 1,
|
||||
'AM_AUX_DIR_EXPAND' => 1,
|
||||
'AC_LIBTOOL_SYS_LIB_STRIP' => 1,
|
||||
'AC_LIBTOOL_PICMODE' => 1,
|
||||
'LT_PATH_NM' => 1,
|
||||
'LT_LANG' => 1,
|
||||
'AM_MAKE_INCLUDE' => 1,
|
||||
'AX_PATH_LIB_PCRE' => 1,
|
||||
'LT_LIB_DLLOAD' => 1,
|
||||
'LT_SYS_DLSEARCH_PATH' => 1,
|
||||
'LTDL_INIT' => 1,
|
||||
'LTOPTIONS_VERSION' => 1,
|
||||
'AM_ENABLE_SHARED' => 1,
|
||||
'_LT_PROG_FC' => 1,
|
||||
'AM_DISABLE_STATIC' => 1,
|
||||
'AC_DISABLE_SHARED' => 1,
|
||||
'AC_CHECK_LIBM' => 1,
|
||||
'AM_C_PROTOTYPES' => 1,
|
||||
'AM_PROG_LD' => 1,
|
||||
'_LT_PROG_ECHO_BACKSLASH' => 1,
|
||||
'LT_PATH_LD' => 1,
|
||||
'LT_FUNC_DLSYM_USCORE' => 1,
|
||||
'AC_LIB_LTDL' => 1,
|
||||
'AC_LIBTOOL_SYS_DYNAMIC_LINKER' => 1,
|
||||
'AM_SET_LEADING_DOT' => 1,
|
||||
'AC_PROG_LD' => 1,
|
||||
'_LT_AC_TAGCONFIG' => 1,
|
||||
'AC_LIBTOOL_CXX' => 1,
|
||||
'LT_PROG_RC' => 1,
|
||||
'AC_LIBTOOL_POSTDEP_PREDEP' => 1,
|
||||
'AM_MISSING_HAS_RUN' => 1,
|
||||
'm4_pattern_forbid' => 1,
|
||||
'LT_PROG_GO' => 1,
|
||||
'AC_LIBTOOL_LANG_F77_CONFIG' => 1,
|
||||
'AC_LIBTOOL_PROG_CC_C_O' => 1,
|
||||
'AC_LIBTOOL_PROG_COMPILER_NO_RTTI' => 1,
|
||||
'AX_CHECK_OPENSSL' => 1,
|
||||
'LT_SUPPORTED_TAG' => 1,
|
||||
'AC_LTDL_SHLIBPATH' => 1,
|
||||
'_LT_AC_LANG_F77' => 1,
|
||||
'AC_LTDL_OBJDIR' => 1,
|
||||
'AM_SET_DEPDIR' => 1,
|
||||
'_LT_AC_TRY_DLOPEN_SELF' => 1,
|
||||
'fp_C_PROTOTYPES' => 1,
|
||||
'_LTDL_SETUP' => 1,
|
||||
'_LT_AC_SYS_COMPILER' => 1,
|
||||
'm4_pattern_allow' => 1,
|
||||
'AC_LIBTOOL_DLOPEN_SELF' => 1,
|
||||
'_AM_SUBST_NOTMAKE' => 1,
|
||||
'_AM_CONFIG_MACRO_DIRS' => 1,
|
||||
'AM_ENABLE_STATIC' => 1,
|
||||
'AC_LIBTOOL_F77' => 1,
|
||||
'_AM_PROG_TAR' => 1,
|
||||
'AM_SET_CURRENT_AUTOMAKE_VERSION' => 1,
|
||||
'AC_LIBLUA_CHECK' => 1,
|
||||
'AC_LIBTOOL_LINKER_OPTION' => 1,
|
||||
'_LT_AC_LOCK' => 1,
|
||||
'_LT_AC_LANG_CXX_CONFIG' => 1,
|
||||
'AC_ENABLE_FAST_INSTALL' => 1,
|
||||
'AC_LIBTOOL_GCJ' => 1,
|
||||
'AC_PATH_MAGIC' => 1,
|
||||
'_LT_LINKER_OPTION' => 1,
|
||||
'LT_AC_PROG_RC' => 1,
|
||||
'AC_PROG_EGREP' => 1,
|
||||
'AC_LIBTOOL_WIN32_DLL' => 1,
|
||||
'AC_PROG_NM' => 1,
|
||||
'AM_AUTOMAKE_VERSION' => 1,
|
||||
'AC_LTDL_DLSYM_USCORE' => 1,
|
||||
'_LT_LIBOBJ' => 1,
|
||||
'AM_INIT_AUTOMAKE' => 1,
|
||||
'AX_PATH_LIB_UDNS' => 1,
|
||||
'AC_LIBTOOL_FC' => 1,
|
||||
'AU_DEFUN' => 1,
|
||||
'_LT_AC_LANG_GCJ_CONFIG' => 1,
|
||||
'LT_SYS_MODULE_PATH' => 1,
|
||||
'AC_LTDL_ENABLE_INSTALL' => 1
|
||||
}
|
||||
], 'Autom4te::Request' ),
|
||||
bless( [
|
||||
'1',
|
||||
1,
|
||||
[
|
||||
'/usr/share/autoconf'
|
||||
],
|
||||
[
|
||||
'/usr/share/autoconf/autoconf/autoconf.m4f',
|
||||
'aclocal.m4',
|
||||
'configure.ac'
|
||||
],
|
||||
{
|
||||
'AC_LIBSOURCE' => 1,
|
||||
'_m4_warn' => 1,
|
||||
'AC_CANONICAL_TARGET' => 1,
|
||||
'AC_SUBST_TRACE' => 1,
|
||||
'AM_ENABLE_MULTILIB' => 1,
|
||||
'AC_CONFIG_FILES' => 1,
|
||||
'AC_PROG_LIBTOOL' => 1,
|
||||
'AC_CONFIG_AUX_DIR' => 1,
|
||||
'AC_CANONICAL_SYSTEM' => 1,
|
||||
'AC_FC_PP_DEFINE' => 1,
|
||||
'AC_FC_FREEFORM' => 1,
|
||||
'include' => 1,
|
||||
'_AM_MAKEFILE_INCLUDE' => 1,
|
||||
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
|
||||
'AM_GNU_GETTEXT' => 1,
|
||||
'AM_PROG_MOC' => 1,
|
||||
'AM_MAKEFILE_INCLUDE' => 1,
|
||||
'AC_CONFIG_LIBOBJ_DIR' => 1,
|
||||
'_AM_COND_ENDIF' => 1,
|
||||
'AM_XGETTEXT_OPTION' => 1,
|
||||
'AM_PROG_F77_C_O' => 1,
|
||||
'AM_PATH_GUILE' => 1,
|
||||
'AM_MAINTAINER_MODE' => 1,
|
||||
'AM_PROG_MKDIR_P' => 1,
|
||||
'AM_AUTOMAKE_VERSION' => 1,
|
||||
'AC_REQUIRE_AUX_FILE' => 1,
|
||||
'AM_INIT_AUTOMAKE' => 1,
|
||||
'AM_POT_TOOLS' => 1,
|
||||
'AC_FC_PP_SRCEXT' => 1,
|
||||
'AM_PROG_FC_C_O' => 1,
|
||||
'_AM_COND_IF' => 1,
|
||||
'_LT_AC_TAGCONFIG' => 1,
|
||||
'AM_PROG_AR' => 1,
|
||||
'AM_CONDITIONAL' => 1,
|
||||
'sinclude' => 1,
|
||||
'AM_PROG_CC_C_O' => 1,
|
||||
'AC_CONFIG_LINKS' => 1,
|
||||
'AC_INIT' => 1,
|
||||
'LT_SUPPORTED_TAG' => 1,
|
||||
'AC_CANONICAL_BUILD' => 1,
|
||||
'm4_sinclude' => 1,
|
||||
'm4_pattern_forbid' => 1,
|
||||
'm4_include' => 1,
|
||||
'm4_pattern_allow' => 1,
|
||||
'AH_OUTPUT' => 1,
|
||||
'AC_FC_SRCEXT' => 1,
|
||||
'AM_SILENT_RULES' => 1,
|
||||
'AM_PROG_CXX_C_O' => 1,
|
||||
'LT_CONFIG_LTDL_DIR' => 1,
|
||||
'LT_INIT' => 1,
|
||||
'AC_CONFIG_SUBDIRS' => 1,
|
||||
'AM_NLS' => 1,
|
||||
'AC_CONFIG_HEADERS' => 1,
|
||||
'AC_SUBST' => 1,
|
||||
'_AM_SUBST_NOTMAKE' => 1,
|
||||
'AM_EXTRA_RECURSIVE_TARGETS' => 1,
|
||||
'_AM_COND_ELSE' => 1,
|
||||
'AC_CANONICAL_HOST' => 1,
|
||||
'AC_DEFINE_TRACE_LITERAL' => 1
|
||||
}
|
||||
], 'Autom4te::Request' )
|
||||
);
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
#
|
||||
# AC_BROTLI_CHECK
|
||||
#
|
||||
AC_DEFUN([AC_BROTLI_CHECK],[
|
||||
|
||||
if test "x$brotli_dir" != "x"
|
||||
then
|
||||
BROTLI_INCLUDES="$brotli_dir"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -I$brotli_dir"
|
||||
save_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS -I$brotli_dir"
|
||||
else
|
||||
save_CFLAGS="$CFLAGS"
|
||||
save_CPPFLAGS="$CPPFLAGS"
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADERS(brotli/encode.h brotli/decode.h ,,
|
||||
[
|
||||
if test "x$brotli_dir" != "x"
|
||||
then
|
||||
AC_MSG_ERROR([brotli header not found in directory specified in --with-brotli])
|
||||
else
|
||||
if test "x$need_brotli" = "xyes"
|
||||
then
|
||||
AC_MSG_ERROR(Header file brotli/encode.h not found.)
|
||||
else
|
||||
need_brotli=no
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
if test "x$need_brotli" != "xno"
|
||||
then
|
||||
BROTLI_LIBS="-lbrotlidec -lbrotlienc -lbrotlicommon"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
CPPFLAGS="$save_CPPFLAGS"
|
||||
AC_SUBST(BROTLI_INCLUDES)
|
||||
AC_SUBST([BROTLI_LIBS])
|
||||
|
||||
fi
|
||||
])
|
||||
@@ -1,42 +0,0 @@
|
||||
#
|
||||
# AC_IP2LOCATION_CHECK
|
||||
#
|
||||
AC_DEFUN([AC_IP2LOCATION_CHECK],[
|
||||
|
||||
if test "x$ip2location_dir" != "x"
|
||||
then
|
||||
IP2LOCATION_INCLUDES="$ip2location_dir"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -I$ip2location_dir"
|
||||
save_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS -I$ip2location_dir"
|
||||
else
|
||||
save_CFLAGS="$CFLAGS"
|
||||
save_CPPFLAGS="$CPPFLAGS"
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADERS(IP2Location.h IP2Loc_DBInterface.h ,,
|
||||
[
|
||||
if test "x$ip2location_dir" != "x"
|
||||
then
|
||||
AC_MSG_ERROR([IP2Location header not found in directory specified in --with-ip2loc])
|
||||
else
|
||||
if test "x$need_ip2location" = "xyes"
|
||||
then
|
||||
AC_MSG_ERROR(Header file IP2Location.h not found.)
|
||||
else
|
||||
need_ip2location=no
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
if test "x$need_ip2location" != "xno"
|
||||
then
|
||||
IP2LOCATION_LIBS="-lIP2Location"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
CPPFLAGS="$save_CPPFLAGS"
|
||||
AC_SUBST(IP2LOCATION_INCLUDES)
|
||||
AC_SUBST([IP2LOCATION_LIBS])
|
||||
|
||||
fi
|
||||
])
|
||||
@@ -1,39 +0,0 @@
|
||||
#
|
||||
# AC_LIBLUA_CHECK
|
||||
#
|
||||
AC_DEFUN([AC_LIBLUA_CHECK],[
|
||||
|
||||
if test "x$lua_dir" != "x"
|
||||
then
|
||||
LUA_INCLUDES="$lua_dir"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -I$lua_dir"
|
||||
save_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS -I$lua_dir"
|
||||
else
|
||||
save_CFLAGS="$CFLAGS"
|
||||
save_CPPFLAGS="$CPPFLAGS"
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADERS(lua.h lualib.h lauxlib.h,,
|
||||
[
|
||||
if test "x$lua_dir" != "x"
|
||||
then
|
||||
AC_MSG_ERROR([liblua header not found in directory specified in --with-lua])
|
||||
else
|
||||
if test "x$need_lua" = "xyes"
|
||||
then
|
||||
AC_MSG_ERROR(Header file lua.h not found.)
|
||||
else
|
||||
need_lua=no
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
if test "x$need_lua" != "xno"
|
||||
then
|
||||
CFLAGS="$save_CFLAGS"
|
||||
CPPFLAGS="$save_CPPFLAGS"
|
||||
AC_SUBST(LUA_INCLUDES)
|
||||
fi
|
||||
])
|
||||
@@ -1,88 +0,0 @@
|
||||
#
|
||||
# AC_LIBUDNS_CHECK
|
||||
#
|
||||
AC_DEFUN([AX_PATH_LIB_UDNS],[dnl
|
||||
AC_MSG_CHECKING([lib udns])
|
||||
UDNS_HOME=
|
||||
AC_ARG_WITH(udns,
|
||||
[ --with-udns=DIR root directory path of udns installation (defaults to
|
||||
/usr/local or /usr if not found in /usr/local)],
|
||||
[
|
||||
UDNS_HOME="$withval"
|
||||
if test ! -f "${UDNS_HOME}/include/udns.h"
|
||||
then
|
||||
AC_MSG_WARN([Sorry, $withval does not contains include/udns.h, checking usual places])
|
||||
UDNS_HOME=/usr/local
|
||||
if test ! -f "${UDNS_HOME}/include/udns.h"
|
||||
then
|
||||
UDNS_HOME=/usr
|
||||
fi
|
||||
fi
|
||||
],
|
||||
[
|
||||
UDNS_HOME=/usr/local
|
||||
if test ! -f "${UDNS_HOME}/include/udns.h"
|
||||
then
|
||||
UDNS_HOME=/usr
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
UDNS_OLD_LDFLAGS=$LDFLAGS
|
||||
UDNS_OLD_CPPFLAGS=$CPPFLAGS
|
||||
LDFLAGS="$LDFLAGS -L${UDNS_HOME}/$OPENLSWS_LIBDIR"
|
||||
CPPFLAGS="$CPPFLAGS -I${UDNS_HOME}/include"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
AC_CHECK_LIB(udns, dns_init, [udns_lib=yes], [udns_lib=no])
|
||||
AC_CHECK_HEADER(udns.h, [udns_h=yes], [udns_h=no])
|
||||
AC_LANG_RESTORE
|
||||
if test "$udns_lib" = "yes" -a "$udns_h" = "yes"
|
||||
then
|
||||
UDNS_LIBS="-ludns"
|
||||
UDNS_CFLAGS="-I${UDNS_HOME}/include"
|
||||
AC_MSG_CHECKING(udns in ${UDNS_HOME})
|
||||
AC_MSG_RESULT(ok)
|
||||
AC_MSG_RESULT([$UDNS_LIBS])
|
||||
m4_ifval($1,$1)
|
||||
else
|
||||
LDFLAGS="$UDNS_OLD_LDFLAGS"
|
||||
CPPFLAGS="$UDNS_OLD_CPPFLAGS"
|
||||
AC_MSG_WARN([Cannot find udns, will try to build from source code])
|
||||
./installudns.sh
|
||||
UDNS_HOME="`pwd`/udns-0.4/"
|
||||
echo UDNS_HOME is ${UDNS_HOME}
|
||||
|
||||
LDFLAGS="$LDFLAGS -L${UDNS_HOME} "
|
||||
CPPFLAGS="$CPPFLAGS -I${UDNS_HOME} "
|
||||
echo UDNS location ${UDNS_HOME}, $LDFLAGS, $CPPFLAGS
|
||||
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
unset ac_cv_lib_udns_dns_init
|
||||
unset ac_cv_header_udns_h
|
||||
AC_CHECK_LIB(udns, dns_init, [udns_lib=yes], [udns_lib=no])
|
||||
AC_CHECK_HEADER(udns.h, [udns_h=yes], [udns_h=no])
|
||||
AC_LANG_RESTORE
|
||||
if test "$udns_lib" = "yes" -a "$udns_h" = "yes"
|
||||
then
|
||||
UDNS_LIBS=" -ludns "
|
||||
UDNS_CFLAGS=" -I${UDNS_HOME} "
|
||||
AC_MSG_CHECKING(udns in ${UDNS_HOME})
|
||||
AC_MSG_RESULT(ok)
|
||||
AC_MSG_RESULT([$UDNS_LIBS])
|
||||
m4_ifval($1,$1)
|
||||
else
|
||||
AC_MSG_CHECKING(udns in ${UDNS_HOME})
|
||||
LDFLAGS="$UDNS_OLD_LDFLAGS"
|
||||
CPPFLAGS="$UDNS_OLD_CPPFLAGS"
|
||||
AC_MSG_RESULT(failed)
|
||||
AC_MSG_ERROR(Can not find and build udns library.)
|
||||
m4_ifval($2,$2)
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
AC_SUBST([UDNS_LIBS])
|
||||
AC_SUBST([UDNS_CFLAGS])
|
||||
])
|
||||
@@ -1,123 +0,0 @@
|
||||
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_check_openssl.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CHECK_OPENSSL([action-if-found[, action-if-not-found]])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Look for OpenSSL in a number of default spots, or in a user-selected
|
||||
# spot (via --with-openssl). Sets
|
||||
#
|
||||
# OPENSSL_INCLUDES to the include directives required
|
||||
# OPENSSL_LIBS to the -l directives required
|
||||
# OPENSSL_LDFLAGS to the -L or -R flags required
|
||||
#
|
||||
# and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately
|
||||
#
|
||||
# This macro sets OPENSSL_INCLUDES such that source files should use the
|
||||
# openssl/ directory in include directives:
|
||||
#
|
||||
# #include <openssl/hmac.h>
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2009,2010 Zmanda Inc. <http://www.zmanda.com/>
|
||||
# Copyright (c) 2009,2010 Dustin J. Mitchell <dustin@zmanda.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 8
|
||||
|
||||
AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL])
|
||||
AC_DEFUN([AX_CHECK_OPENSSL], [
|
||||
AC_ARG_WITH([openssl],
|
||||
[AS_HELP_STRING([--with-openssl=DIR],
|
||||
[root of the OpenSSL directory])],
|
||||
[
|
||||
case "$withval" in
|
||||
"" | y | ye | yes | n | no)
|
||||
AC_MSG_ERROR([Invalid --with-openssl value])
|
||||
;;
|
||||
*) ssldirs="$withval"
|
||||
;;
|
||||
esac
|
||||
], [
|
||||
# use some default ssldirs
|
||||
ssldirs="/usr/local /usr/local/ssl /usr /usr/ssl /usr/lib/ssl /usr/pkg "
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
# note that we #include <openssl/foo.h>, so the OpenSSL headers have to be in
|
||||
# an 'openssl' subdirectory
|
||||
|
||||
OPENSSL_INCLUDES=
|
||||
for ssldir in $ssldirs; do
|
||||
AC_MSG_CHECKING([for openssl/ssl.h in $ssldir])
|
||||
if test -f "$ssldir/include/openssl/ssl.h"; then
|
||||
OPENSSL_INCLUDES="-I$ssldir/include"
|
||||
OPENSSL_LDFLAGS="$ssldir/$OPENLSWS_LIBDIR"
|
||||
OPENSSL_LIBS="-lssl -lcrypto"
|
||||
AC_MSG_RESULT([yes])
|
||||
break
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
# try the preprocessor and linker with our new flags,
|
||||
# being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
|
||||
|
||||
AC_MSG_CHECKING([whether compiling and linking against OpenSSL works])
|
||||
echo "Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS;" \
|
||||
"OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_INCLUDES=$OPENSSL_INCLUDES" >&AS_MESSAGE_LOG_FD
|
||||
|
||||
save_LIBS="$LIBS"
|
||||
save_LDFLAGS="$LDFLAGS"
|
||||
save_CPPFLAGS="$CPPFLAGS"
|
||||
LDFLAGS="-L$OPENSSL_LDFLAGS $LDFLAGS"
|
||||
if test "$OPENLSWS_DISABLE_RPATH" = "no" ; then
|
||||
LDFLAGS="$LDFLAGS -Wl,-rpath,$OPENSSL_LDFLAGS"
|
||||
fi
|
||||
|
||||
LIBS="$OPENSSL_LIBS $LIBS"
|
||||
CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)])],
|
||||
[
|
||||
AC_MSG_RESULT([yes])
|
||||
$1
|
||||
], [
|
||||
AC_MSG_RESULT([no])
|
||||
|
||||
# when fail, add -ldl and try again
|
||||
echo "Add -ldl and try test linking again..."
|
||||
LDFLAGS="-ldl $LDFLAGS"
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)])],
|
||||
[
|
||||
AC_MSG_RESULT([yes])
|
||||
$1
|
||||
], [
|
||||
AC_MSG_RESULT([no])
|
||||
$2
|
||||
])
|
||||
])
|
||||
|
||||
|
||||
CPPFLAGS="$save_CPPFLAGS"
|
||||
# LDFLAGS="$OPENSSL_LDFLAGS $save_LDFLAGS"
|
||||
# LIBS="$save_LIBS"
|
||||
|
||||
AC_SUBST([OPENSSL_INCLUDES])
|
||||
AC_SUBST([OPENSSL_LIBS])
|
||||
AC_SUBST([OPENSSL_LDFLAGS])
|
||||
])
|
||||
@@ -1,124 +0,0 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_check_zlib.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CHECK_ZLIB()
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# This macro searches for an installed zlib library. If nothing was
|
||||
# specified when calling configure, it searches first in /usr/local and
|
||||
# then in /usr. If the --with-zlib=DIR is specified, it will try to find
|
||||
# it in DIR/include/zlib.h and DIR/lib/libz.a. If --without-zlib is
|
||||
# specified, the library is not searched at all.
|
||||
#
|
||||
# If either the header file (zlib.h) or the library (libz) is not found,
|
||||
# the configuration exits on error, asking for a valid zlib installation
|
||||
# directory or --without-zlib.
|
||||
#
|
||||
# The macro defines the symbol HAVE_LIBZ if the library is found. You
|
||||
# should use autoheader to include a definition for this symbol in a
|
||||
# config.h file. Sample usage in a C/C++ source is as follows:
|
||||
#
|
||||
# #ifdef HAVE_LIBZ
|
||||
# #include <zlib.h>
|
||||
# #endif /* HAVE_LIBZ */
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Loic Dachary <loic@senga.org>
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 7
|
||||
|
||||
AU_ALIAS([CHECK_ZLIB], [AX_CHECK_ZLIB])
|
||||
AC_DEFUN([AX_CHECK_ZLIB],
|
||||
#
|
||||
# Handle user hints
|
||||
#
|
||||
[AC_MSG_CHECKING(if zlib is wanted)
|
||||
AC_ARG_WITH(zlib,
|
||||
[ --with-zlib=DIR root directory path of zlib installation [defaults to
|
||||
/usr/local or /usr if not found in /usr/local]
|
||||
--without-zlib to disable zlib usage completely],
|
||||
[if test "$withval" != no ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
if test -d "$withval"
|
||||
then
|
||||
ZLIB_HOME="$withval"
|
||||
else
|
||||
AC_MSG_WARN([Sorry, $withval does not exist, checking usual places])
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi],
|
||||
[AC_MSG_RESULT(yes)])
|
||||
|
||||
ZLIB_HOME=/usr/local
|
||||
if test ! -f "${ZLIB_HOME}/include/zlib.h"
|
||||
then
|
||||
ZLIB_HOME=/usr
|
||||
fi
|
||||
|
||||
#
|
||||
# Locate zlib, if wanted
|
||||
#
|
||||
if test -n "${ZLIB_HOME}"
|
||||
then
|
||||
ZLIB_OLD_LDFLAGS=$LDFLAGS
|
||||
ZLIB_OLD_CPPFLAGS=$LDFLAGS
|
||||
LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/$OPENLSWS_LIBDIR"
|
||||
CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
AC_CHECK_LIB(z, inflateEnd, [zlib_cv_libz=yes], [zlib_cv_libz=no])
|
||||
AC_CHECK_HEADER(zlib.h, [zlib_cv_zlib_h=yes], [zlib_cv_zlib_h=no])
|
||||
AC_LANG_RESTORE
|
||||
if test "$zlib_cv_libz" = "yes" -a "$zlib_cv_zlib_h" = "yes"
|
||||
then
|
||||
#
|
||||
# If both library and header were found, use them
|
||||
#
|
||||
AC_CHECK_LIB(z, inflateEnd)
|
||||
AC_MSG_CHECKING(zlib in ${ZLIB_HOME})
|
||||
AC_MSG_RESULT(ok)
|
||||
else
|
||||
#
|
||||
# If either header or library was not found, revert and bomb
|
||||
#
|
||||
AC_MSG_CHECKING(zlib in ${ZLIB_HOME})
|
||||
LDFLAGS="$ZLIB_OLD_LDFLAGS"
|
||||
CPPFLAGS="$ZLIB_OLD_CPPFLAGS"
|
||||
AC_MSG_RESULT(failed)
|
||||
AC_MSG_ERROR(either specify a valid zlib installation with --with-zlib=DIR or disable zlib usage with --without-zlib)
|
||||
fi
|
||||
fi
|
||||
|
||||
])
|
||||
@@ -1,275 +0,0 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_lib_expat.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_LIB_EXPAT([MINIMUM-VERSION])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# This macro provides tests of availability of Expat XML Parser of
|
||||
# particular version or newer. This macro checks for Expat XML Parser
|
||||
# headers and libraries and defines compilation flags
|
||||
#
|
||||
# Macro supports following options and their values:
|
||||
#
|
||||
# 1) Single-option usage:
|
||||
#
|
||||
# --with-expat -- yes, no, or path to Expat XML Parser
|
||||
# installation prefix
|
||||
#
|
||||
# 2) Three-options usage (all options are required):
|
||||
#
|
||||
# --with-expat=yes
|
||||
# --with-expat-inc -- path to base directory with Expat headers
|
||||
# --with-expat-lib -- linker flags for Expat
|
||||
#
|
||||
# This macro calls:
|
||||
#
|
||||
# AC_SUBST(EXPAT_CFLAGS)
|
||||
# AC_SUBST(EXPAT_LIBS)
|
||||
# AC_SUBST(EXPAT_VERSION) -- only if version requirement is used
|
||||
#
|
||||
# And sets:
|
||||
#
|
||||
# HAVE_EXPAT
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Mateusz Loskot <mateusz@loskot.net>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 9
|
||||
|
||||
AC_DEFUN([AX_LIB_EXPAT],
|
||||
[
|
||||
AC_ARG_WITH([expat],
|
||||
AS_HELP_STRING([--with-expat=@<:@ARG@:>@],
|
||||
[use Expat XML Parser from given prefix (ARG=path); check standard prefixes (ARG=yes); disable (ARG=no)]
|
||||
),
|
||||
[
|
||||
if test "$withval" = "yes"; then
|
||||
if test -f /usr/local/include/expat.h ; then
|
||||
expat_prefix=/usr/local
|
||||
elif test -f /usr/include/expat.h ; then
|
||||
expat_prefix=/usr
|
||||
else
|
||||
expat_prefix=""
|
||||
fi
|
||||
expat_requested="yes"
|
||||
elif test -d "$withval"; then
|
||||
expat_prefix="$withval"
|
||||
expat_requested="yes"
|
||||
else
|
||||
expat_prefix=""
|
||||
expat_requested="no"
|
||||
fi
|
||||
],
|
||||
[
|
||||
dnl Default behavior is implicit yes
|
||||
if test -f /usr/local/include/expat.h ; then
|
||||
expat_prefix=/usr/local
|
||||
elif test -f /usr/include/expat.h ; then
|
||||
expat_prefix=/usr
|
||||
else
|
||||
expat_prefix=""
|
||||
fi
|
||||
]
|
||||
)
|
||||
|
||||
AC_ARG_WITH([expat-inc],
|
||||
AS_HELP_STRING([--with-expat-inc=@<:@DIR@:>@],
|
||||
[path to Expat XML Parser headers]
|
||||
),
|
||||
[expat_include_dir="$withval"],
|
||||
[expat_include_dir=""]
|
||||
)
|
||||
AC_ARG_WITH([expat-lib],
|
||||
AS_HELP_STRING([--with-expat-lib=@<:@ARG@:>@],
|
||||
[link options for Expat XML Parser libraries]
|
||||
),
|
||||
[expat_lib_flags="$withval"],
|
||||
[expat_lib_flags=""]
|
||||
)
|
||||
|
||||
EXPAT_CFLAGS=""
|
||||
EXPAT_LIBS=""
|
||||
EXPAT_VERSION=""
|
||||
|
||||
dnl
|
||||
dnl Collect include/lib paths and flags
|
||||
dnl
|
||||
run_expat_test="no"
|
||||
|
||||
if test -n "$expat_prefix"; then
|
||||
expat_include_dir="$expat_prefix/include"
|
||||
expat_lib_flags="-L$expat_prefix/$OPENLSWS_LIBDIR -lexpat"
|
||||
run_expat_test="yes"
|
||||
elif test "$expat_requested" = "yes"; then
|
||||
if test -n "$expat_include_dir" -a -n "$expat_lib_flags"; then
|
||||
run_expat_test="yes"
|
||||
fi
|
||||
else
|
||||
run_expat_test="no"
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Check Expat XML Parser files
|
||||
dnl
|
||||
if test "$run_expat_test" = "yes"; then
|
||||
|
||||
saved_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS -I$expat_include_dir"
|
||||
|
||||
saved_LDFLAGS="$LDFLAGS"
|
||||
LIBS="$LDFLAGS $expat_lib_flags"
|
||||
|
||||
dnl
|
||||
dnl Check Expat headers
|
||||
dnl
|
||||
AC_MSG_CHECKING([for Expat XML Parser headers in $expat_include_dir])
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM(
|
||||
[[
|
||||
@%:@include <expat.h>
|
||||
]],
|
||||
[[]]
|
||||
)],
|
||||
[
|
||||
EXPAT_CFLAGS="-I$expat_include_dir"
|
||||
expat_header_found="yes"
|
||||
AC_MSG_RESULT([found])
|
||||
],
|
||||
[
|
||||
expat_header_found="no"
|
||||
AC_MSG_RESULT([not found])
|
||||
]
|
||||
)
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
dnl
|
||||
dnl Check Expat libraries
|
||||
dnl
|
||||
if test "$expat_header_found" = "yes"; then
|
||||
|
||||
AC_MSG_CHECKING([for Expat XML Parser libraries])
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM(
|
||||
[[
|
||||
@%:@include <expat.h>
|
||||
]],
|
||||
[[
|
||||
XML_Parser p = XML_ParserCreate(NULL);
|
||||
XML_ParserFree(p);
|
||||
p = NULL;
|
||||
]]
|
||||
)],
|
||||
[
|
||||
EXPAT_LIBS="$expat_lib_flags"
|
||||
expat_lib_found="yes"
|
||||
AC_MSG_RESULT([found])
|
||||
],
|
||||
[
|
||||
expat_lib_found="no"
|
||||
AC_MSG_RESULT([not found])
|
||||
]
|
||||
)
|
||||
AC_LANG_POP([C++])
|
||||
fi
|
||||
|
||||
CPPFLAGS="$saved_CPPFLAGS"
|
||||
LDFLAGS="$saved_LDFLAGS"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for Expat XML Parser])
|
||||
|
||||
if test "$run_expat_test" = "yes"; then
|
||||
if test "$expat_header_found" = "yes" -a "$expat_lib_found" = "yes"; then
|
||||
|
||||
AC_SUBST([EXPAT_CFLAGS])
|
||||
AC_SUBST([EXPAT_LIBS])
|
||||
|
||||
HAVE_EXPAT="yes"
|
||||
else
|
||||
HAVE_EXPAT="no"
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT([$HAVE_EXPAT])
|
||||
|
||||
dnl
|
||||
dnl Check Expat version
|
||||
dnl
|
||||
if test "$HAVE_EXPAT" = "yes"; then
|
||||
|
||||
expat_version_req=ifelse([$1], [], [], [$1])
|
||||
|
||||
if test -n "$expat_version_req"; then
|
||||
|
||||
AC_MSG_CHECKING([if Expat XML Parser version is >= $expat_version_req])
|
||||
|
||||
if test -f "$expat_include_dir/expat.h"; then
|
||||
|
||||
expat_major=`cat $expat_include_dir/expat.h | \
|
||||
grep '^#define.*XML_MAJOR_VERSION.*[0-9]$' | \
|
||||
sed -e 's/#define XML_MAJOR_VERSION.//'`
|
||||
|
||||
expat_minor=`cat $expat_include_dir/expat.h | \
|
||||
grep '^#define.*XML_MINOR_VERSION.*[0-9]$' | \
|
||||
sed -e 's/#define XML_MINOR_VERSION.//'`
|
||||
|
||||
expat_revision=`cat $expat_include_dir/expat.h | \
|
||||
grep '^#define.*XML_MICRO_VERSION.*[0-9]$' | \
|
||||
sed -e 's/#define XML_MICRO_VERSION.//'`
|
||||
|
||||
EXPAT_VERSION="$expat_major.$expat_minor.$expat_revision"
|
||||
AC_SUBST([EXPAT_VERSION])
|
||||
|
||||
dnl Decompose required version string and calculate numerical representation
|
||||
expat_version_req_major=`expr $expat_version_req : '\([[0-9]]*\)'`
|
||||
expat_version_req_minor=`expr $expat_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
|
||||
expat_version_req_revision=`expr $expat_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
|
||||
if test "x$expat_version_req_revision" = "x"; then
|
||||
expat_version_req_revision="0"
|
||||
fi
|
||||
|
||||
expat_version_req_number=`expr $expat_version_req_major \* 10000 \
|
||||
\+ $expat_version_req_minor \* 100 \
|
||||
\+ $expat_version_req_revision`
|
||||
|
||||
dnl Calculate numerical representation of detected version
|
||||
expat_version_number=`expr $expat_major \* 10000 \
|
||||
\+ $expat_minor \* 100 \
|
||||
\+ $expat_revision`
|
||||
|
||||
expat_version_check=`expr $expat_version_number \>\= $expat_version_req_number`
|
||||
if test "$expat_version_check" = "1"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_WARN([Found Expat XML Parser $EXPAT_VERSION, which is older than required. Possible compilation failure.])
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_WARN([Missing expat.h header. Unable to determine Expat version.])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
HAVE_EXPAT="no"
|
||||
AC_MSG_RESULT([$HAVE_EXPAT])
|
||||
|
||||
if test "$expat_requested" = "yes"; then
|
||||
AC_MSG_WARN([Expat XML Parser support requested but headers or library not found. Specify valid prefix of Expat using --with-expat=@<:@DIR@:>@ or provide include directory and linker flags using --with-expat-inc and --with-expat-lib])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
@@ -1,100 +0,0 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_path_lib_pcre.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_PATH_LIB_PCRE [(A/NA)]
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# check for pcre lib and set PCRE_LIBS and PCRE_CFLAGS accordingly.
|
||||
#
|
||||
# also provide --with-pcre option that may point to the $prefix of the
|
||||
# pcre installation - the macro will check $pcre/include and $pcre/lib to
|
||||
# contain the necessary files.
|
||||
#
|
||||
# the usual two ACTION-IF-FOUND / ACTION-IF-NOT-FOUND are supported and
|
||||
# they can take advantage of the LIBS/CFLAGS additions.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 6
|
||||
|
||||
AC_DEFUN([AX_PATH_LIB_PCRE],[dnl
|
||||
AC_MSG_CHECKING([lib pcre])
|
||||
PCRE_LDFLAGS=
|
||||
AC_ARG_WITH(pcre,
|
||||
[ --with-pcre[[=prefix]] compile xmlpcre part (via libpcre check)],,
|
||||
with_pcre="yes")
|
||||
if test ".$with_pcre" = ".no" ; then
|
||||
AC_MSG_RESULT([disabled])
|
||||
m4_ifval($2,$2)
|
||||
else
|
||||
AC_MSG_RESULT([(testing)])
|
||||
AC_CHECK_LIB(pcre, pcre_study)
|
||||
if test "$ac_cv_lib_pcre_pcre_study" = "yes" ; then
|
||||
PCRE_LIBS="-lpcre"
|
||||
if test "$with_pcre" != "yes" ; then
|
||||
PCRE_LDFLAGS="-L$with_pcre/$OPENLSWS_LIBDIR"
|
||||
LDFLAGS="$LDFLAGS $PCRE_LDFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS -I$with_pcre/include"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([$OPENLSWS_LIBDIR pcre])
|
||||
AC_MSG_RESULT([$PCRE_LIBS])
|
||||
m4_ifval($1,$1)
|
||||
else
|
||||
PCRE_LDFLAGS="-L$with_pcre/$OPENLSWS_LIBDIR"
|
||||
OLDLDFLAGS="$LDFLAGS" ; LDFLAGS="$LDFLAGS $PCRE_LDFLAGS"
|
||||
OLDCPPFLAGS="$CPPFLAGS" ; CPPFLAGS="$CPPFLAGS -I$with_pcre/include"
|
||||
AC_CHECK_LIB(pcre, pcre_compile)
|
||||
CPPFLAGS="$OLDCPPFLAGS"
|
||||
LDFLAGS="$OLDLDFLAGS"
|
||||
if test "$ac_cv_lib_pcre_pcre_compile" = "yes" ; then
|
||||
AC_MSG_RESULT(.setting PCRE_LIBS $PCRE_LDFLAGS -lpcre)
|
||||
PCRE_LIBS="$PCRE_LDFLAGS -lpcre"
|
||||
test -d "$with_pcre/include" && PCRE_CFLAGS="-I$with_pcre/include"
|
||||
AC_MSG_CHECKING([$OPENLSWS_LIBDIR pcre])
|
||||
AC_MSG_RESULT([$PCRE_LIBS])
|
||||
m4_ifval($1,$1)
|
||||
else
|
||||
PCRE_LDFLAGS=
|
||||
AC_MSG_CHECKING([$OPENLSWS_LIBDIR pcre])
|
||||
AC_MSG_RESULT([no, (WARNING)])
|
||||
m4_ifval($2,$2)
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([PCRE_LIBS])
|
||||
AC_SUBST([PCRE_CFLAGS])
|
||||
AC_SUBST([PCRE_LDFLAGS])
|
||||
])
|
||||
1441
install/openlitespeed-1.4.28/config.guess
vendored
1813
install/openlitespeed-1.4.28/config.sub
vendored
21083
install/openlitespeed-1.4.28/configure
vendored
@@ -1,479 +0,0 @@
|
||||
m4_include(ax_check_zlib.m4)
|
||||
m4_include(ax_check_openssl.m4)
|
||||
m4_include(ax_path_lib_pcre.m4)
|
||||
m4_include(ax_lib_expat.m4)
|
||||
m4_include(ax_check_liblua.m4)
|
||||
m4_include(ax_check_libudns.m4)
|
||||
m4_include(ax_check_brotli.m4)
|
||||
m4_include(ax_check_ip2location.m4)
|
||||
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ([2.69])
|
||||
AC_INIT([openlitespeed],[1.4.28],[info@litespeedtech.com],[openlitespeed],[http://www.litespeedtech.com/])
|
||||
AM_INIT_AUTOMAKE([1.0 foreign no-define ])
|
||||
|
||||
AM_CONFIG_HEADER(src/config.h:src/config.h.in)
|
||||
|
||||
dnl NOW change the default installation directory!
|
||||
AC_PREFIX_DEFAULT('/usr/local/lsws')
|
||||
|
||||
# General "with" options
|
||||
# ----------------------------------------------------------------------------
|
||||
dnl Checks for programs.
|
||||
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_INSTALL
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_AWK
|
||||
AC_PROG_CXX
|
||||
AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_RANLIB
|
||||
LT_INIT
|
||||
|
||||
OSTYPE=`uname -m`
|
||||
OSNAME=`uname -s`
|
||||
|
||||
# Checks for header files.
|
||||
AC_CHECK_HEADER([pthread.h],
|
||||
[AC_CHECK_LIB([pthread],[pthread_join],[
|
||||
AC_DEFINE([HAVE_LIBPTHREAD],[],[Define if pthread (-lpthread)])
|
||||
AC_DEFINE([HAVE_PTHREAD_H],[],[Define if <pthread.h>])
|
||||
LIBS="-lpthread $LIBS"
|
||||
])])
|
||||
|
||||
AC_CHECK_HEADERS(arpa/inet.h fcntl.h inttypes.h limits.h netdb.h netinet/in.h stddef.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h unistd.h)
|
||||
|
||||
AC_HEADER_ASSERT
|
||||
|
||||
## ##Set option --with-user
|
||||
AC_ARG_WITH([user],
|
||||
AS_HELP_STRING([--with-user],[Set user name to run openlitespeed/lscpd [default: nobody]]),
|
||||
[OPENLSWS_USER="$withval"], [OPENLSWS_USER=nobody])
|
||||
AC_DEFINE_UNQUOTED([OPENLSWS_USER], ["$OPENLSWS_USER"], [Defined the user name])
|
||||
AC_SUBST([OPENLSWS_USER])
|
||||
|
||||
## ##Set option --with-group
|
||||
AC_ARG_WITH([group],
|
||||
AS_HELP_STRING([--with-group],[Set group of the user [default: nobody]]),
|
||||
[OPENLSWS_GROUP="$withval"], [OPENLSWS_GROUP=nobody])
|
||||
AC_DEFINE_UNQUOTED([OPENLSWS_GROUP], ["$OPENLSWS_GROUP"], [Defined the group of the user])
|
||||
AC_SUBST([OPENLSWS_GROUP])
|
||||
|
||||
## ##Set option --with-admin
|
||||
AC_ARG_WITH([admin],
|
||||
AS_HELP_STRING([--with-admin],[Set administrator user name [default: admin]]),
|
||||
[OPENLSWS_ADMIN="$withval"], [OPENLSWS_ADMIN=admin])
|
||||
AC_SUBST([OPENLSWS_ADMIN])
|
||||
|
||||
## ##Set option --with-adminport
|
||||
AC_ARG_WITH([adminport],
|
||||
AS_HELP_STRING([--with-adminport],[Set administrator listener port [default: 7080]]),
|
||||
[OPENLSWS_ADMINPORT="$withval"], [OPENLSWS_ADMINPORT=7080])
|
||||
AC_SUBST([OPENLSWS_ADMINPORT])
|
||||
|
||||
|
||||
## ##Set option --with-password
|
||||
AC_ARG_WITH([password],
|
||||
AS_HELP_STRING([--with-password],[Set password of administrator [default: 123456]]),
|
||||
[OPENLSWS_PASSWORD="$withval"], [OPENLSWS_PASSWORD=123456])
|
||||
AC_SUBST([OPENLSWS_PASSWORD])
|
||||
|
||||
## ##Set option --with-email
|
||||
AC_ARG_WITH([email],
|
||||
AS_HELP_STRING([--with-email],[Set email of administrator [default: root@localhost]]),
|
||||
[OPENLSWS_EMAIL="$withval"], [OPENLSWS_EMAIL=root@localhost])
|
||||
AC_SUBST([OPENLSWS_EMAIL])
|
||||
|
||||
|
||||
AC_ARG_ENABLE([adminssl],
|
||||
[AC_HELP_STRING([--enable-adminssl=@<:@yes/no@:>@],
|
||||
[Enable HTTPS for admin console (modify adminssl.conf before installation) @<:@default=yes@:>@])],
|
||||
[OPENLSWS_ADMINSSL="$enableval"], [OPENLSWS_ADMINSSL=yes])
|
||||
AC_SUBST([OPENLSWS_ADMINSSL])
|
||||
|
||||
AC_ARG_WITH([exampleport],
|
||||
AS_HELP_STRING([--with-exampleport],[Set example listener port [default: 8088]]),
|
||||
[OPENLSWS_EXAMPLEPORT="$withval"], [OPENLSWS_EXAMPLEPORT=8088])
|
||||
AC_SUBST([OPENLSWS_EXAMPLEPORT])
|
||||
|
||||
|
||||
|
||||
|
||||
AC_ARG_WITH([lsphp7],
|
||||
AS_HELP_STRING([--with-lsphp7],[Set lsphp7 as default php script handler[default: yes]]),
|
||||
[USE_LSPHP7="$withval"], [USE_LSPHP7=no])
|
||||
|
||||
AC_ARG_WITH([tempdir],
|
||||
AS_HELP_STRING([--with-tempdir],[Set a customized temprary directory[default: /tmp/lshttpd]]),
|
||||
[DEFAULT_TMP_DIR="$withval"], [DEFAULT_TMP_DIR=/tmp/lshttpd])
|
||||
|
||||
AC_ARG_WITH([pidfile],
|
||||
AS_HELP_STRING([--with-pidfile],[Set a customized pid file path name[default: $DEFAULT_TMP_DIR/lshttpd.pid]]),
|
||||
[PID_FILE="$withval"], [PID_FILE=$DEFAULT_TMP_DIR/lshttpd.pid])
|
||||
|
||||
AC_ARG_WITH([lscpd],
|
||||
AS_HELP_STRING([--with-lscpd],[Set to build lscpd instead of openlitespeed[default: yes]]),
|
||||
[IS_LSCPD="$withval"], [IS_LSCPD=no])
|
||||
echo IS_LSCPD=$IS_LSCPD
|
||||
if test "$IS_LSCPD" = "yes" ; then
|
||||
DEFAULT_TMP_DIR=/tmp/lscpd
|
||||
PID_FILE=$DEFAULT_TMP_DIR/lscpd.pid
|
||||
USE_LSPHP7=yes
|
||||
OPENLSWS_ADMINSSL=no
|
||||
AC_DEFINE_UNQUOTED([IS_LSCPD], [1], [Defined to build lscpd])
|
||||
AC_SUBST([IS_LSCPD])
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL([BUILD_LSCPD], [test x$IS_LSCPD = xyes])
|
||||
AC_DEFINE_UNQUOTED([DEFAULT_TMP_DIR], ["$DEFAULT_TMP_DIR"], [Defined the temprary directory])
|
||||
AC_SUBST([DEFAULT_TMP_DIR])
|
||||
AC_DEFINE_UNQUOTED([PID_FILE], ["$PID_FILE"], [Defined the pid file path])
|
||||
AC_SUBST([PID_FILE])
|
||||
AC_SUBST([USE_LSPHP7])
|
||||
AC_SUBST([OPENLSWS_ADMINSSL])
|
||||
echo "OPENLSWS_ADMINSSL=$OPENLSWS_ADMINSSL"
|
||||
echo USE_LSPHP7=$USE_LSPHP7
|
||||
echo DEFAULT_TMP_DIR=$DEFAULT_TMP_DIR
|
||||
echo PID_FILE=$PID_FILE
|
||||
|
||||
|
||||
OPENLSWS_HTTP2="?"
|
||||
AC_ARG_ENABLE([spdy],
|
||||
[AC_HELP_STRING([--enable-spdy=@<:@yes/no@:>@],
|
||||
[Enable SPDY and http2 over HTTPS @<:@default=yes@:>@])],
|
||||
[OPENLSWS_HTTP2="$enableval"], [])
|
||||
|
||||
AC_ARG_ENABLE([http2],
|
||||
[AC_HELP_STRING([--enable-http2=@<:@yes/no@:>@],
|
||||
[Enable SPDY and http2 over HTTPS @<:@default=yes@:>@])],
|
||||
[OPENLSWS_HTTP2="$enableval"], [])
|
||||
if test "$OPENLSWS_HTTP2" = "no" ; then
|
||||
echo "SPDY/http2 disabled!!!"
|
||||
else
|
||||
AC_DEFINE([LS_ENABLE_SPDY], [1], [Define if need spdy/http2 feature])
|
||||
echo "SPDY/http2 enabled!!!"
|
||||
fi
|
||||
|
||||
|
||||
#AC_ARG_ENABLE([cacheredis],
|
||||
# [AC_HELP_STRING([--enable-redis],
|
||||
# [Enable redis for cache module (Using redis is disabled by default)])],
|
||||
# [ AC_DEFINE([LS_ENABLE_REDIS], [1], [Define if cache module needs redis feature])
|
||||
# echo "Cache redis enabled!!!" ], [])
|
||||
|
||||
AC_ARG_ENABLE([debug],
|
||||
[AC_HELP_STRING([--enable-debug],
|
||||
[Enable debugging symbols (Debug is disabled by default)])],
|
||||
[OPENLSWS_DEBUG="$enableval"
|
||||
if test "$OPENLSWS_DEBUG" = "yes" ; then
|
||||
CFLAGS="-g3 -O0"
|
||||
CXXFLAGS="-g3 -O0"
|
||||
else
|
||||
CFLAGS="-g -O3"
|
||||
CXXFLAGS="-g -O3"
|
||||
fi
|
||||
echo "OPENLSWS_DEBUG='$OPENLSWS_DEBUG'"
|
||||
], [])
|
||||
|
||||
AC_ARG_ENABLE([profiling],
|
||||
[AC_HELP_STRING([--enable-profiling],
|
||||
[Enable cpu profiling (profiling is disabled by default)])],
|
||||
[OPENLSWS_PROF="$enableval"
|
||||
if test "$OPENLSWS_PROF" = "yes" ; then
|
||||
CFLAGS="$CFLAGS -pg"
|
||||
CXXFLAGS="$CXXFLAGS -pg"
|
||||
fi
|
||||
echo "OPENLSWS_PROF='$OPENLSWS_PROF'"
|
||||
], [])
|
||||
|
||||
dnl liblua check
|
||||
AC_MSG_CHECKING(whether to compile mod_lua module)
|
||||
|
||||
|
||||
AC_ARG_WITH(lua,
|
||||
[ --with-lua[[=DIR]] use liblua (located in directory DIR, if supplied) for compiling mod_lua module. [[default=no]]],
|
||||
[
|
||||
if test $withval = no
|
||||
then
|
||||
need_lua=no
|
||||
elif test $withval = yes
|
||||
then
|
||||
need_lua=yes
|
||||
else
|
||||
need_lua=yes
|
||||
lua_dir=$withval
|
||||
fi
|
||||
],[
|
||||
need_lua=no
|
||||
lua_dir=
|
||||
])
|
||||
if test "x$need_lua" = "xno" ; then
|
||||
AC_MSG_RESULT(no)
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_LIBLUA_CHECK
|
||||
if test "x$need_lua" = "xno" ; then
|
||||
AC_MSG_RESULT(liblua header files not found - disabling compile mod_lua module)
|
||||
fi
|
||||
fi
|
||||
AM_CONDITIONAL([HAVE_LIBLUA], [test x$need_lua = xyes])
|
||||
echo "Lua inlcude = $LUA_INCLUDES, need_lua = $need_lua"
|
||||
|
||||
CFLAGS="$CFLAGS -D_GLIBCXX_USE_CXX11_ABI=0 -fstack-protector $(getconf LFS_CFLAGS) "
|
||||
CXXFLAGS="$CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0 -fstack-protector $(getconf LFS_CFLAGS) "
|
||||
|
||||
## ##Set option --with-bssl
|
||||
AC_ARG_WITH(bssl,
|
||||
[ --with-bssl[[=DIR]] Set to use BoringSSL instead of OpenSSL [[default=no]]],
|
||||
[
|
||||
if test $withval = no
|
||||
then
|
||||
OPENLSWS_BSSL=no
|
||||
elif test $withval = yes
|
||||
then
|
||||
OPENLSWS_BSSL=yes
|
||||
else
|
||||
OPENLSWS_BSSL="$withval"
|
||||
fi
|
||||
],[OPENLSWS_BSSL=no])
|
||||
AC_SUBST([OPENLSWS_BSSL])
|
||||
|
||||
if test "$OPENLSWS_BSSL" = no ; then
|
||||
if test "$OSNAME" = Darwin ; then
|
||||
usedynossl=yes
|
||||
CPPFLAGS="$CPPFLAGS -I../../src -I../../include -I/usr/local/include -I/usr/local -I/usr -I/usr/pkg "
|
||||
else
|
||||
usedynossl=no
|
||||
CPPFLAGS="$CPPFLAGS -I../../ssl/include -I../../src -I../../include -I/usr/local/include -I/usr/local -I/usr -I/usr/pkg "
|
||||
echo "Will build latest stable openssl libraries for you, this may take several minutes ..."
|
||||
OSSL=`. $srcdir/dlossl.sh`
|
||||
echo "Finsihed building openssl."
|
||||
fi
|
||||
echo "Openssl: use_dyn_ossl = $usedynossl"
|
||||
else
|
||||
#### Not provide location, use default location, will not copy files
|
||||
usedynossl=no
|
||||
AC_DEFINE_UNQUOTED([USE_BORINGSSL], [1], [Defined to use BoringSSL instead of OpenSSL])
|
||||
CPPFLAGS=" -I../../ssl/include $CPPFLAGS -I../../src -I../../include -I/usr/local/include -I/usr/local -I/usr -I/usr/pkg -DUSE_BORINGSSL=1 "
|
||||
if test "$OPENLSWS_BSSL" = yes ; then
|
||||
echo "Will use exist BoringSSL files in $srcdir/ssl/."
|
||||
else
|
||||
OSSL=`. $srcdir/dlossl.sh use_bssl "$OPENLSWS_BSSL"`
|
||||
echo "BoringSSL files copied to $srcdir/ssl/ from $OPENLSWS_BSSL."
|
||||
fi
|
||||
OPENLSWS_BSSL=yes
|
||||
fi
|
||||
AM_CONDITIONAL([USE_DYN_OSSL], [test x$usedynossl = xyes])
|
||||
AM_CONDITIONAL([USE_BSSL], [test x$OPENLSWS_BSSL = xyes])
|
||||
|
||||
AC_ARG_WITH(brotli,
|
||||
[ --with-brotli[[=DIR]] enable brotli compression (located in directory DIR, if supplied). [[default=no]]],
|
||||
[
|
||||
if test "x$withval" = "x" ; then
|
||||
need_brotli=no
|
||||
elif test $withval = no ; then
|
||||
need_brotli=no
|
||||
elif test $withval = yes ; then
|
||||
need_brotli=yes
|
||||
else
|
||||
need_brotli=yes
|
||||
brotli_dir=$withval
|
||||
fi
|
||||
],[
|
||||
need_brotli=no
|
||||
brotli_dir=
|
||||
])
|
||||
AC_SUBST([need_brotli])
|
||||
AC_SUBST([brotli_dir])
|
||||
|
||||
AC_MSG_CHECKING(whether to check if brotli library exists)
|
||||
if test "x$need_brotli" = "xno" ; then
|
||||
AC_MSG_RESULT(no)
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE_UNQUOTED([USE_BROTLI], [1], [Defined to compile with Brotli compression included])
|
||||
AC_BROTLI_CHECK
|
||||
if test "x$need_brotli" = "xno" ; then
|
||||
AC_MSG_RESULT(brotli header files not found - disabling brotli)
|
||||
elif test "x$need_brotli" = "xcheck" ; then
|
||||
need_brotli=yes
|
||||
AC_MSG_RESULT(brotli header files found - enable brotli)
|
||||
fi
|
||||
fi
|
||||
AM_CONDITIONAL([HAVE_BROTLI], [test x$need_brotli = xyes])
|
||||
echo "Brotli include = $BROTLI_INCLUDES, need_brotli = $need_brotli"
|
||||
|
||||
AC_ARG_WITH(ip2loc,
|
||||
[ --with-ip2loc[[=DIR]] enable ip2location (located in directory DIR, if supplied). [[default=no]]],
|
||||
[
|
||||
if test "x$withval" = "x" ; then
|
||||
need_ip2location=no
|
||||
elif test $withval = no ; then
|
||||
need_ip2location=no
|
||||
elif test $withval = yes ; then
|
||||
need_ip2location=yes
|
||||
else
|
||||
need_ip2location=yes
|
||||
ip2location_dir=$withval
|
||||
fi
|
||||
],[
|
||||
need_ip2location=no
|
||||
ip2location_dir=
|
||||
])
|
||||
AC_SUBST([need_ip2location])
|
||||
AC_SUBST([ip2location_dir])
|
||||
|
||||
AC_MSG_CHECKING(whether to check if ip2location library exists)
|
||||
if test "x$need_ip2location" = "xno" ; then
|
||||
AC_MSG_RESULT(no)
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE_UNQUOTED([USE_IP2LOCATION], [1], [Defined to compile with IP2Location included])
|
||||
AC_IP2LOCATION_CHECK
|
||||
if test "x$need_ip2location" = "xno" ; then
|
||||
AC_MSG_RESULT(ip2location header files not found - disabling ip2location)
|
||||
elif test "x$need_ip2location" = "xcheck" ; then
|
||||
need_ip2location=yes
|
||||
AC_MSG_RESULT(ip2location header files found - enable ip2location)
|
||||
fi
|
||||
fi
|
||||
AM_CONDITIONAL([HAVE_IP2LOCATION], [test x$need_ip2location = xyes])
|
||||
echo "IP2Location include = $IP2LOCATION_INCLUDES, need_ip2location = $need_ip2location"
|
||||
|
||||
AC_ARG_ENABLE([rpath],
|
||||
[AC_HELP_STRING([--disable-rpath],
|
||||
[Disable rpath (It is 'no' by default)])],
|
||||
[OPENLSWS_DISABLE_RPATH=yes
|
||||
echo "OPENLSWS_DISABLE_RPATH=yes"], [OPENLSWS_DISABLE_RPATH=no])
|
||||
AC_SUBST([OPENLSWS_DISABLE_RPATH])
|
||||
|
||||
AC_ARG_WITH([libdir],
|
||||
AS_HELP_STRING([--with-libdir],[Set system lib directory. It is lib or lib64 and will be automatically checked by default]),
|
||||
[OPENLSWS_LIBDIR="$withval"], [
|
||||
|
||||
OPENLSWS_LIBDIR=lib
|
||||
if test "$OSNAME" = Linux ; then
|
||||
if test "$OSTYPE" = x86_64 ; then
|
||||
OPENLSWS_LIBDIR=lib64
|
||||
elif test "$OSTYPE" = i686 ; then
|
||||
|
||||
CFLAGS="$CFLAGS -march=i686"
|
||||
CXXFLAGS="$CXXFLAGS -march=i686"
|
||||
elif test "$OSTYPE" = armv7l ; then
|
||||
# Raspberry Pi 2, Scaleway C1, Parallella
|
||||
CFLAGS="$CFLAGS -march=armv7"
|
||||
CXXFLAGS="$CXXFLAGS -march=armv7"
|
||||
elif test "$OSTYPE" = armv6l ; then
|
||||
# Raspberry Pi (not Pi 2)
|
||||
CFLAGS="$CFLAGS -march=armv6 -mfloat-abi=hard -mfpu=vfp"
|
||||
CXXFLAGS="$CXXFLAGS -march=armv6 -mfloat-abi=hard -mfpu=vfp"
|
||||
|
||||
fi
|
||||
fi
|
||||
])
|
||||
echo "Final CFLAGS='$CFLAGS' CXXFLAGS='$CXXFLAGS' CPPFLAGS='$CPPFLAGS'"
|
||||
|
||||
echo "Default system lib directory = $OPENLSWS_LIBDIR"
|
||||
AC_SUBST([OPENLSWS_LIBDIR])
|
||||
|
||||
|
||||
AX_CHECK_ZLIB(, AC_MSG_ERROR(Can not find zlib. You must install it before continuing.))
|
||||
|
||||
|
||||
if test "$OSNAME" = Darwin ; then
|
||||
AX_CHECK_OPENSSL(, AC_MSG_ERROR(Can not find openssl. You must install it before continuing.))
|
||||
fi
|
||||
|
||||
AX_PATH_LIB_PCRE(, AC_MSG_ERROR(Can not find pcre. You must install it before continuing.))
|
||||
AX_PATH_LIB_UDNS(, AC_MSG_ERROR(Can not find udns library. You must install it before continuing.))
|
||||
|
||||
AX_LIB_EXPAT(0.5)
|
||||
AC_CHECK_LIB([GeoIP], [GeoIP_id_by_addr])
|
||||
AC_CHECK_LIB(crypt,crypt,LIBS="-lcrypt $LIBS")
|
||||
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_CHECK_HEADER_STDBOOL
|
||||
AC_TYPE_UID_T
|
||||
AC_C_INLINE
|
||||
AC_TYPE_INT16_T
|
||||
AC_TYPE_INT32_T
|
||||
AC_TYPE_INT8_T
|
||||
AC_TYPE_MODE_T
|
||||
AC_TYPE_OFF_T
|
||||
AC_TYPE_PID_T
|
||||
AC_TYPE_SIZE_T
|
||||
AC_TYPE_SSIZE_T
|
||||
AC_TYPE_UINT16_T
|
||||
AC_TYPE_UINT32_T
|
||||
AC_CHECK_TYPES(ptrdiff_t)
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_CHOWN
|
||||
AC_FUNC_ERROR_AT_LINE
|
||||
AC_FUNC_FORK
|
||||
AC_FUNC_FSEEKO
|
||||
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
|
||||
#AC_FUNC_MALLOC disable due to this replacing malloc() with non-existing rpl_malloc() issue on some systems
|
||||
AC_FUNC_MMAP
|
||||
AC_FUNC_REALLOC
|
||||
AC_CHECK_FUNCS(malloc bzero dup2 ftruncate getcwd gethostbyaddr gethostbyname gettimeofday inet_ntoa localtime_r memchr memmove memset mkdir munmap select socket strcasecmp strchr strcspn strdup strerror strncasecmp strpbrk strrchr strspn strstr strtol)
|
||||
|
||||
RT_LIB_OPTION=" -lrt"
|
||||
DL_LIB_OPTION=" -ldl"
|
||||
if test "$OSNAME" = Linux ; then
|
||||
LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
|
||||
fi
|
||||
|
||||
if test "$OSNAME" = FreeBSD ; then
|
||||
LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
|
||||
DL_LIB_OPTION=
|
||||
fi
|
||||
|
||||
#For Mac OS, add special falgs for LuaJit
|
||||
if test "$OSNAME" = Darwin ; then
|
||||
LDFLAGS="$LDFLAGS -Wl,-export_dynamic -pagezero_size 10000 -image_base 100000000"
|
||||
RT_LIB_OPTION=
|
||||
fi
|
||||
|
||||
LDFLAGS="$LDFLAGS $PCRE_LDFLAGS $UDNS_LDFLAGS -D_GLIBCXX_USE_CXX11_ABI=0"
|
||||
echo "Final LDFLAGS='$LDFLAGS'"
|
||||
AC_SUBST([DL_LIB_OPTION])
|
||||
AC_SUBST([RT_LIB_OPTION])
|
||||
|
||||
MODULE_VERSION_INFO=`. $srcdir/modverinfo.sh`
|
||||
AC_DEFINE_UNQUOTED([LS_MODULE_VERSION_INFO], ["$MODULE_VERSION_INFO"], [The pre-defined modules version info])
|
||||
|
||||
AC_CONFIG_FILES(Makefile
|
||||
src/Makefile
|
||||
src/edio/Makefile
|
||||
src/extensions/Makefile
|
||||
src/http/Makefile
|
||||
src/spdy/Makefile
|
||||
src/log4cxx/Makefile
|
||||
src/main/Makefile
|
||||
src/socket/Makefile
|
||||
src/sslpp/Makefile
|
||||
src/ssi/Makefile
|
||||
src/lsiapi/Makefile
|
||||
src/modules/Makefile
|
||||
src/shm/Makefile
|
||||
src/adns/Makefile
|
||||
src/modules/cache/Makefile
|
||||
src/modules/modinspector/Makefile
|
||||
src/modules/modreqparser/Makefile
|
||||
src/modules/uploadprogress/Makefile)
|
||||
|
||||
if test x$need_lua = xyes ; then
|
||||
AC_CONFIG_FILES(src/modules/lua/Makefile)
|
||||
echo "Will compile and build mod_lua module."
|
||||
else
|
||||
echo "Will NOT compile and build mod_lua module."
|
||||
fi
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
@@ -1,791 +0,0 @@
|
||||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2013-05-30.07; # UTC
|
||||
|
||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
||||
|
||||
# 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, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# 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.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by 'PROGRAMS ARGS'.
|
||||
object Object file output by 'PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputting dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
# Get the directory component of the given path, and save it in the
|
||||
# global variables '$dir'. Note that this directory component will
|
||||
# be either empty or ending with a '/' character. This is deliberate.
|
||||
set_dir_from ()
|
||||
{
|
||||
case $1 in
|
||||
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
|
||||
*) dir=;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Get the suffix-stripped basename of the given path, and save it the
|
||||
# global variable '$base'.
|
||||
set_base_from ()
|
||||
{
|
||||
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
|
||||
}
|
||||
|
||||
# If no dependency file was actually created by the compiler invocation,
|
||||
# we still have to create a dummy depfile, to avoid errors with the
|
||||
# Makefile "include basename.Plo" scheme.
|
||||
make_dummy_depfile ()
|
||||
{
|
||||
echo "#dummy" > "$depfile"
|
||||
}
|
||||
|
||||
# Factor out some common post-processing of the generated depfile.
|
||||
# Requires the auxiliary global variable '$tmpdepfile' to be set.
|
||||
aix_post_process_depfile ()
|
||||
{
|
||||
# If the compiler actually managed to produce a dependency file,
|
||||
# post-process it.
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form 'foo.o: dependency.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# $object: dependency.h
|
||||
# and one to simply output
|
||||
# dependency.h:
|
||||
# which is needed to avoid the deleted-header problem.
|
||||
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
|
||||
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
|
||||
} > "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
}
|
||||
|
||||
# A tabulation character.
|
||||
tab=' '
|
||||
# A newline character.
|
||||
nl='
|
||||
'
|
||||
# Character ranges might be problematic outside the C locale.
|
||||
# These definitions help.
|
||||
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
lower=abcdefghijklmnopqrstuvwxyz
|
||||
digits=0123456789
|
||||
alpha=${upper}${lower}
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Avoid interferences from the environment.
|
||||
gccflag= dashmflag=
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
if test "$depmode" = msvc7msys; then
|
||||
# This is just like msvc7 but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvc7
|
||||
fi
|
||||
|
||||
if test "$depmode" = xlc; then
|
||||
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
|
||||
gccflag=-qmakedep=gcc,-MF
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
|
||||
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
|
||||
## (see the conditional assignment to $gccflag above).
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say). Also, it might not be
|
||||
## supported by the other compilers which use the 'gcc' depmode.
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The second -e expression handles DOS-style file names with drive
|
||||
# letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the "deleted header file" problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
## Some versions of gcc put a space before the ':'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well. hp depmode also adds that space, but also prefixes the VPATH
|
||||
## to the object. Take care to not repeat it in the output.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like '#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
|
||||
| tr "$nl" ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
xlc)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts '$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
tcc)
|
||||
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
|
||||
# FIXME: That version still under development at the moment of writing.
|
||||
# Make that this statement remains true also for stable, released
|
||||
# versions.
|
||||
# It will wrap lines (doesn't matter whether long or short) with a
|
||||
# trailing '\', as in:
|
||||
#
|
||||
# foo.o : \
|
||||
# foo.c \
|
||||
# foo.h \
|
||||
#
|
||||
# It will put a trailing '\' even on the last line, and will use leading
|
||||
# spaces rather than leading tabs (at least since its commit 0394caf7
|
||||
# "Emit spaces for -MD").
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
|
||||
# We have to change lines of the first kind to '$object: \'.
|
||||
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
|
||||
# And for each line of the second kind, we have to emit a 'dep.h:'
|
||||
# dummy dependency, to avoid the deleted-header problem.
|
||||
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
## The order of this option in the case statement is important, since the
|
||||
## shell code in configure will try each of these formats in the order
|
||||
## listed in this file. A plain '-MD' option would be understood by many
|
||||
## compilers, so we must ensure this comes after the gcc and icc options.
|
||||
pgcc)
|
||||
# Portland's C compiler understands '-MD'.
|
||||
# Will always output deps to 'file.d' where file is the root name of the
|
||||
# source file under compilation, even if file resides in a subdirectory.
|
||||
# The object file name does not affect the name of the '.d' file.
|
||||
# pgcc 10.2 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using '\' :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
set_dir_from "$object"
|
||||
# Use the source, not the object, to determine the base name, since
|
||||
# that's sadly what pgcc will do too.
|
||||
set_base_from "$source"
|
||||
tmpdepfile=$base.d
|
||||
|
||||
# For projects that build the same source file twice into different object
|
||||
# files, the pgcc approach of using the *source* file root name can cause
|
||||
# problems in parallel builds. Use a locking strategy to avoid stomping on
|
||||
# the same $tmpdepfile.
|
||||
lockdir=$base.d-lock
|
||||
trap "
|
||||
echo '$0: caught signal, cleaning up...' >&2
|
||||
rmdir '$lockdir'
|
||||
exit 1
|
||||
" 1 2 13 15
|
||||
numtries=100
|
||||
i=$numtries
|
||||
while test $i -gt 0; do
|
||||
# mkdir is a portable test-and-set.
|
||||
if mkdir "$lockdir" 2>/dev/null; then
|
||||
# This process acquired the lock.
|
||||
"$@" -MD
|
||||
stat=$?
|
||||
# Release the lock.
|
||||
rmdir "$lockdir"
|
||||
break
|
||||
else
|
||||
# If the lock is being held by a different process, wait
|
||||
# until the winning process is done or we timeout.
|
||||
while test -d "$lockdir" && test $i -gt 0; do
|
||||
sleep 1
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
fi
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
trap - 1 2 13 15
|
||||
if test $i -le 0; then
|
||||
echo "$0: failed to acquire lock after $numtries attempts" >&2
|
||||
echo "$0: check lockdir '$lockdir'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add 'dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in 'foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# Libtool generates 2 separate objects for the 2 libraries. These
|
||||
# two compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
|
||||
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
# Same post-processing that is required for AIX mode.
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
msvc7)
|
||||
if test "$libtool" = yes; then
|
||||
showIncludes=-Wc,-showIncludes
|
||||
else
|
||||
showIncludes=-showIncludes
|
||||
fi
|
||||
"$@" $showIncludes > "$tmpdepfile"
|
||||
stat=$?
|
||||
grep -v '^Note: including file: ' "$tmpdepfile"
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The first sed program below extracts the file names and escapes
|
||||
# backslashes for cygpath. The second sed program outputs the file
|
||||
# name when reading, but also accumulates all include files in the
|
||||
# hold buffer in order to output them again at the end. This only
|
||||
# works with sed implementations that can handle large buffers.
|
||||
sed < "$tmpdepfile" -n '
|
||||
/^Note: including file: *\(.*\)/ {
|
||||
s//\1/
|
||||
s/\\/\\\\/g
|
||||
p
|
||||
}' | $cygpath_u | sort -u | sed -n '
|
||||
s/ /\\ /g
|
||||
s/\(.*\)/'"$tab"'\1 \\/p
|
||||
s/.\(.*\) \\/\1:/
|
||||
H
|
||||
$ {
|
||||
s/.*/'"$tab"'/
|
||||
G
|
||||
p
|
||||
}' >> "$depfile"
|
||||
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvc7msys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for ':'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this sed invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
# makedepend may prepend the VPATH from the source file name to the object.
|
||||
# No need to regex-escape $object, excess matching of '.' is harmless.
|
||||
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process the last invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed '1,2d' "$tmpdepfile" \
|
||||
| tr ' ' "$nl" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E \
|
||||
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
| sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
|
||||
echo "$tab" >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
date=`date -u '+%a, %d %b %Y %H:%M:%S %Z'`
|
||||
|
||||
cat << EOF
|
||||
Content-type: text/plain
|
||||
Expires: $date
|
||||
|
||||
Hello World
|
||||
|
||||
EOF
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Blocked page</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div align="Center"><br>
|
||||
<h1>You should not be able to see this page unlesss remove the "/blocked/" context.</h1>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,465 +0,0 @@
|
||||
h1 {
|
||||
margin: .67em 0;
|
||||
font-size: 2em;
|
||||
color: #888;
|
||||
|
||||
}
|
||||
|
||||
h1,h2,h3,h4,h5,h6 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #666699;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:focus,a:hover {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
/*a:focus {
|
||||
outline: 5px auto -webkit-focus-ring-color;
|
||||
outline-offset: -2px;
|
||||
}*/
|
||||
ul {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.text-center {
|
||||
text-align: center;
|
||||
color: #888;
|
||||
/* [disabled]vertical-align: bottom; */
|
||||
}
|
||||
|
||||
.container {
|
||||
padding-right: 0px;
|
||||
padding-left: 0px;
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
}
|
||||
|
||||
@media (min-width: 992px) {
|
||||
}
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
.container {
|
||||
width: auto
|
||||
}
|
||||
}
|
||||
|
||||
.row {
|
||||
margin-right: -10px;
|
||||
margin-left: -10px;
|
||||
min-height: 50px;
|
||||
display: inherit;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
/* [disabled]alignment-adjust: middle; */
|
||||
}
|
||||
|
||||
.nav>li>a:focus,.nav>li>a:hover {
|
||||
text-decoration: none;
|
||||
background-color: rgba(0,0,0,0.25);
|
||||
color: #FFF;
|
||||
}
|
||||
|
||||
.navbar {
|
||||
position: fixed;
|
||||
min-height: 50px;
|
||||
margin-bottom: 20px;
|
||||
border: 1px transparent #f8f8ff;
|
||||
background-color: rgba(230,230,230,0.8);
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.navbar-nav {
|
||||
float: left;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.navbar-nav>li {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.navbar-nav>li>a {
|
||||
padding-top: 15px;
|
||||
padding-bottom: 15px;
|
||||
color: #669;
|
||||
}
|
||||
}
|
||||
|
||||
.navbar-right {
|
||||
float: right!important;
|
||||
margin-right: 50px;
|
||||
}
|
||||
|
||||
.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9 {
|
||||
position: relative;
|
||||
min-height: 50px;
|
||||
padding-right: 15px;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
.col-sm-2 {
|
||||
width: 15%;
|
||||
}
|
||||
|
||||
.col-md-4 {
|
||||
width: 25%;
|
||||
min-width: 250px;
|
||||
}
|
||||
|
||||
.col-md-3 {
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
.col-md-2 {
|
||||
width: 18%;
|
||||
}
|
||||
|
||||
.col-md-offset-1 {
|
||||
margin-left: 5%;
|
||||
}
|
||||
|
||||
.col-xs-5ths, .col-sm-5ths, .col-md-5ths, .col-lg-5ths {
|
||||
position: relative;
|
||||
min-height: 500px;
|
||||
padding-right: 15px;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
.col-xs-5ths {
|
||||
width: 15%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.col-sm-5ths {
|
||||
width: 15%;
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 992px) {
|
||||
.col-md-5ths {
|
||||
width: 15%;
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
.col-lg-5ths {
|
||||
width: 15%;
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: inline-block;
|
||||
padding: 6px 12px;
|
||||
margin-bottom: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
line-height: 1.42857143;
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
-ms-touch-action: manipulation;
|
||||
touch-action: manipulation;
|
||||
cursor: pointer;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
background-image: none;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 4px
|
||||
}
|
||||
|
||||
.btn.active.focus,.btn.active:focus,.btn.focus,.btn:active.focus,.btn:active:focus,.btn:focus {
|
||||
outline: 5px auto -webkit-focus-ring-color;
|
||||
outline-offset: -2px;
|
||||
background-color: #36C;
|
||||
}
|
||||
|
||||
.btn-default.active.focus,.btn-default.active:focus,.btn-default.active:hover,.btn-default:active.focus,.btn-default:active:focus,.btn-default:active:hover,.open>.dropdown-toggle.btn-default.focus,.open>.dropdown-toggle.btn-default:focus,.open>.dropdown-toggle.btn-default:hover {
|
||||
color: #333;
|
||||
background-color: #d4d4d4;
|
||||
border-color: #8c8c8c;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
color: #fff;
|
||||
background-color: #666699;
|
||||
border-color: #666699;
|
||||
}
|
||||
|
||||
.btn-primary.focus,.btn-primary:focus {
|
||||
color: #fff;
|
||||
background-color: #666699;
|
||||
border-color: #666699;
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
color: #fff;
|
||||
background-color: #6666CC;
|
||||
border-color: #6666CC;
|
||||
}
|
||||
|
||||
.btn-primary.active,.btn-primary:active,.open>.dropdown-toggle.btn-primary {
|
||||
color: #fff;
|
||||
background-color: #6666CC;
|
||||
border-color: #6666CC;
|
||||
}
|
||||
|
||||
.btn-primary.active.focus,.btn-primary.active:focus,.btn-primary.active:hover,.btn-primary:active.focus,.btn-primary:active:focus,.btn-primary:active:hover,.open>.dropdown-toggle.btn-primary.focus,.open>.dropdown-toggle.btn-primary:focus,.open>.dropdown-toggle.btn-primary:hover {
|
||||
color: #fff;
|
||||
background-color: #666699;
|
||||
border-color: #122b40;
|
||||
}
|
||||
|
||||
.btn-warning {
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
.container .jumbotron,.container-fluid .jumbotron {
|
||||
padding-right: 15px;
|
||||
padding-left: 15px;
|
||||
/* [disabled]border-radius:6px; */
|
||||
}
|
||||
|
||||
.jumbotron {
|
||||
padding-top: 30px;
|
||||
padding-bottom: 30px;
|
||||
margin-bottom: 30px;
|
||||
color: #FFF;
|
||||
background-color: #3f3664;
|
||||
}
|
||||
|
||||
.jumbotron .h1,.jumbotron h1 {
|
||||
/* color: #FFF;*/
|
||||
}
|
||||
|
||||
.jumbotron p {
|
||||
margin-bottom: 15px;
|
||||
font-size: 24px;
|
||||
font-weight: 200;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.img-size {
|
||||
width:40%;
|
||||
}
|
||||
|
||||
.modalDialog {
|
||||
position: fixed;
|
||||
/* font-family: "Open Sans", "Adobe Garamond Pro";*/
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
color:#333;
|
||||
z-index: 99999;
|
||||
opacity: 0;
|
||||
-webkit-transition: opacity 400ms ease-in;
|
||||
-moz-transition: opacity 400ms ease-in;
|
||||
transition: opacity 400ms ease-in;
|
||||
pointer-events: none;
|
||||
/* [disabled]padding-left: 50px; */
|
||||
/* [disabled]padding-right: 50px; */
|
||||
}
|
||||
|
||||
.modalDialog:target {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.modalDialog > div {
|
||||
width: 720px;
|
||||
position: relative;
|
||||
margin: 10% auto;
|
||||
padding: 5px 20px 13px 20px;
|
||||
border-radius: 5px;
|
||||
background: #fff;
|
||||
/* [disabled]background: -moz-linear-gradient(#fff, #999); */
|
||||
/* [disabled]background: -webkit-linear-gradient(#fff, #999); */
|
||||
/* [disabled]background: -o-linear-gradient(#fff, #999); */
|
||||
}
|
||||
|
||||
.modalDialog .close {
|
||||
color: #666666;
|
||||
font-size:18px;
|
||||
/* line-height: inherit; */
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
text-align: center;
|
||||
/* top: 0px; */
|
||||
width: 24px;
|
||||
/* text-decoration: none; */
|
||||
/* -webkit-border-radius: 5px; */
|
||||
-moz-border-radius: 5px;
|
||||
-moz-box-shadow: 1px 1px 3px #000;
|
||||
/* -webkit-box-shadow: 1px 1px 3px #000; */
|
||||
}
|
||||
|
||||
.modalDialog .close a:focus, .modalDialog .close a:hover {
|
||||
color: #FF9900;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
opacity: 1;
|
||||
cursor: pointer;
|
||||
/* [disabled]filter: alpha(opacity=50); */
|
||||
|
||||
}
|
||||
|
||||
.modalDialog p {
|
||||
font-size: 18px;
|
||||
text-align: justify;
|
||||
padding-left: 5%;
|
||||
padding-right: 5%;
|
||||
padding-bottom: 30px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.modalDialog a {
|
||||
font-weight:600;
|
||||
}
|
||||
|
||||
.modalDialog a:hover {
|
||||
font-weight: 600;
|
||||
color: #66C;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
.modalDialog h1 {
|
||||
color:#333;
|
||||
}
|
||||
|
||||
|
||||
.list-group-item {
|
||||
padding: 10px 30px;
|
||||
}
|
||||
|
||||
a.list-group-item,button.list-group-item {
|
||||
color: #669;
|
||||
/* [disabled]border: 1px solid #669; */
|
||||
}
|
||||
|
||||
a.list-group-item:focus,a.list-group-item:hover,button.list-group-item:focus,button.list-group-item:hover {
|
||||
color: #66C;
|
||||
text-decoration: none;
|
||||
/* [disabled]background-color:#f5f5f5; */
|
||||
}
|
||||
|
||||
li {
|
||||
list-style:none;
|
||||
}
|
||||
|
||||
.panel {
|
||||
margin-bottom: 20px;
|
||||
background-color: #fff;
|
||||
border: 1px solid #666699;
|
||||
border-radius: 5px;
|
||||
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
|
||||
box-shadow: 0 1px 1px rgba(0,0,0,.05);
|
||||
min-height: 350px;
|
||||
min-width: 375px;
|
||||
}
|
||||
|
||||
.panel-body {
|
||||
padding: 15px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.panel-heading {
|
||||
padding: 10px 15px;
|
||||
border-bottom: 1px solid transparent;
|
||||
border-top-left-radius: 3px;
|
||||
border-top-right-radius: 3px;
|
||||
}
|
||||
|
||||
.panel-heading h3 {
|
||||
color:#669;
|
||||
}
|
||||
|
||||
.panel-default:hover {
|
||||
background-color: #f8fbfe;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.panel-primary>.panel-heading {
|
||||
color: #fff;
|
||||
background-color: #666699;
|
||||
border-color: #666699;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.center-block {
|
||||
display: block;
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
/* [disabled]float: none; */
|
||||
}
|
||||
|
||||
.pull-right {
|
||||
float: right!important;
|
||||
margin-right: 50px;
|
||||
}
|
||||
|
||||
.centered {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
/* bring your own prefixes */
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
position: relative;
|
||||
left: 7%;
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.panel-default>.panel-heading {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
ul {
|
||||
margin-left:0:
|
||||
}
|
||||
|
||||
.panel-body-left {
|
||||
text-align:left;
|
||||
|
||||
}
|
||||
|
||||
/* centered columns styles */
|
||||
.row-centered {
|
||||
text-align: center;
|
||||
margin-left: 10%;
|
||||
margin-right: 10%;
|
||||
}
|
||||
|
||||
.col-centered {
|
||||
display: inline-table;
|
||||
float: none;
|
||||
/* reset the text-align */
|
||||
text-align: left;
|
||||
/* inline-block space fix */
|
||||
margin-right: 0px;
|
||||
}
|
||||
|
||||
|
||||
.copyright-center {
|
||||
text-align: center;
|
||||
padding-left: 100px;
|
||||
}
|
||||
|
||||
/*# sourceMappingURL=bootstrap.min.css.map */
|
||||
@@ -1,11 +0,0 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Page Not Found</TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<HR>
|
||||
<H1>Request Page Not Found</H1>
|
||||
This is a customized error page for missing pages.
|
||||
<HR>
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
@@ -1,253 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
|
||||
<title>Welcome</title>
|
||||
<!-- Bootstrap -->
|
||||
<link href="css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="css/custom.css" rel="stylesheet">
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
<!-- Navigation Menu Starts-->
|
||||
<nav class="navbar navbar-fixed-top">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="#home">Home<span class="sr-only">(current)</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#demo">Demos</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#features">Features</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#resources">Resources</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#news">News</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav><!-- Navigation Menu Ends-->
|
||||
<a id="home"></a>
|
||||
<!-- Navigation Menu Ends-->
|
||||
<div class="container">
|
||||
<div class="header clearfix">
|
||||
<div class="row"></div>
|
||||
<!--Jumbotron Starts-->
|
||||
<div class="jumbotron">
|
||||
<div><img class="center-block img-responsive img-size" src="img/olsws_logo.png" alt="openlitespeed logo"></div>
|
||||
<h1>Congratulations</h1>
|
||||
<p class="lead">You have successfully installed the OpenLiteSpeed Web Server!</p>
|
||||
<div class="row"></div>
|
||||
<!--Button Starts-->
|
||||
<div class="text-center">
|
||||
<a class="btn btn-lg btn-warning" href="#openModal" role="button">READ ME!</a>
|
||||
</div>
|
||||
<!--Button Ends-->
|
||||
<!--Modal Starts-->
|
||||
<div id="openModal" class="modalDialog">
|
||||
<div>
|
||||
<div class="close"><a href="#close" title="Close" >X</a></div>
|
||||
<h1><span class="text-muted">{</span> Read Me <span class="text-muted">}</span></h1>
|
||||
<div class="row">
|
||||
<p>You should replace this page with your own web pages.</p>
|
||||
<p>It is not recommended to copy files into the directory where this page located, they might be over-written during upgrade or reinstallation.</p>
|
||||
<p>Create a new virtual host and map a listener to it. Have no clue? Please read the <a href="/docs/index.html" title="Documentation" target="_blank">Documentation</a>.</p>
|
||||
<p>For your web administration login page, please refer to the installation guide.</p>
|
||||
<p>Add <a href="https://www.litespeedtech.com/" target="_blank"><img src="img/powered_by_ols-new.png" alt="openlitespeed logo"></a> the OpenLiteSpeed logo to your web site if you'd like to help us promote the server.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div><!--Modal Ends-->
|
||||
</div><!--Jumbotron Ends-->
|
||||
</div>
|
||||
<a id="demo"></a>
|
||||
<div class="row">
|
||||
</div>
|
||||
<!-- 5 Panel Starts-->
|
||||
<!--Row Starts-->
|
||||
<div class="row row-centered">
|
||||
<h1>Simple Feature Demos</h1>
|
||||
<div class="row"></div>
|
||||
<!--Column 1 Starts-->
|
||||
<div class="col-md-4 col-sm-4 col-lg-4 col-centered">
|
||||
<!--Panel 1 Starts-->
|
||||
<div class="panel panel-default">
|
||||
<img class="center-block img-responsive" src="img/cgi-icon.png" alt="cgi">
|
||||
<div class="panel-heading">
|
||||
<h3>CGI script</h3>
|
||||
</div>
|
||||
<div class="panel-body">Hello World from CGI script
|
||||
</div>
|
||||
<br> <!--use for btn vertical alignment-->
|
||||
<div class="text-center"><a class="btn btn-primary" role="button" onclick="window.open('/cgi-bin/helloworld', 'myWin', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=no, scrollbars=yes, width=600, height=400'); return false">Click Here »</a>
|
||||
</div>
|
||||
<div class="row"></div>
|
||||
</div><!--Panel 1 Starts-->
|
||||
</div><!--Column 1 Ends-->
|
||||
<!--Column 2 Starts-->
|
||||
<div class="col-md-4 col-sm-4 col-lg-4 col-centered">
|
||||
<!--Panel 2 Starts-->
|
||||
<div class="panel panel-default">
|
||||
<img class="center-block img-responsive" src="img/php-icon.png" alt="php">
|
||||
<div class="panel-heading">
|
||||
<h3> Test PHP</h3>
|
||||
</div>
|
||||
<div class="panel-body">If you enabled PHP during installation, <br>click here to test it
|
||||
</div>
|
||||
<div class="text-center"><a class="btn btn-primary" role="button" onclick="window.open('/phpinfo.php', 'myWin', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=yes, scrollbars=yes, width=1024, height=768'); return false">Click Here »</a>
|
||||
</div>
|
||||
<div class="row"></div>
|
||||
</div><!--Panel 2 Ends-->
|
||||
</div><!--Column 2 Ends-->
|
||||
<!--Column 3 Starts-->
|
||||
<div class="col-md-4 col-sm-4 col-lg-4 col-centered">
|
||||
<!--Panel 3 Starts-->
|
||||
<div class="panel panel-default">
|
||||
<img class="center-block img-responsive" src="img/404-icon.png" alt="404">
|
||||
<div class="panel-heading">
|
||||
<h3 >Customized Error Page</h3>
|
||||
</div>
|
||||
<div class="panel-body">Missing page
|
||||
</div>
|
||||
<br> <!--use for btn vertical alignment-->
|
||||
<div class="text-center"><a class="btn btn-primary" role="button" onclick="window.open('/page_does_not_exist.html', 'myWin', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=no, scrollbars=yes, width=600, height=400'); return false">Click Here »</a>
|
||||
</div>
|
||||
<div class="row"></div>
|
||||
</div><!--Panel 3 Ends-->
|
||||
</div><!--Column 3 Ends-->
|
||||
<!--Column 4 Starts-->
|
||||
<div class="col-md-4 col-sm-4 col-lg-4 col-centered">
|
||||
<!--Panel 4 Starts-->
|
||||
<div class="panel panel-default">
|
||||
<img class="center-block img-responsive" src="img/pwd_protect-icon.png" alt="password protection">
|
||||
<div class="panel-heading">
|
||||
<h3>Authentication</h3>
|
||||
</div>
|
||||
<div class="panel-body">Password protected content, <br>user name: test, password: test123
|
||||
</div>
|
||||
<div class="text-center"><a class="btn btn-primary" role="button" onclick="window.open('/protected/', 'myWin', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=no, scrollbars=yes, width=600, height=400'); return false">Click Here »</a>
|
||||
</div>
|
||||
<div class="row"></div>
|
||||
</div><!--Panel 4 Ends-->
|
||||
</div><!--Column 4 Ends-->
|
||||
|
||||
<!--Column 5 Starts-->
|
||||
<div class="col-md-4 col-sm-4 col-lg-4 col-centered">
|
||||
<!--Panel 5 Starts-->
|
||||
<div class="panel panel-default">
|
||||
<img class="center-block img-responsive" src="img/blocked_content-icon.png" alt="blocked content">
|
||||
<div class="panel-heading">
|
||||
<h3>Blocked Content</h3>
|
||||
</div>
|
||||
<div class="panel-body">Blocked area
|
||||
</div>
|
||||
<br> <!--use for btn vertical alignment-->
|
||||
<div class="text-center"><a class="btn btn-primary" role="button" onclick="window.open('/blocked/', 'myWin', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=no, scrollbars=yes, width=600, height=400'); return false">Click Here »</a>
|
||||
</div>
|
||||
<div class="row"></div>
|
||||
</div><!--Panel 5 Ends-->
|
||||
</div><!--Column 5 Ends-->
|
||||
<!--Column 6 Starts-->
|
||||
<div class="col-md-4 col-sm-4 col-lg-4 col-centered">
|
||||
<!--Panel 6 Starts-->
|
||||
<div class="panel panel-default">
|
||||
<img class="center-block img-responsive" src="img/file_upload-icon.png" alt="file upload">
|
||||
<div class="panel-heading">
|
||||
<h3>File Upload</h3>
|
||||
</div>
|
||||
<div class="panel-body">Test file upload progress module
|
||||
</div>
|
||||
<br> <!--use for btn vertical alignment-->
|
||||
<div class="text-center"><a class="btn btn-primary" role="button" onclick="window.open('/upload.html', 'myWin', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=no, scrollbars=yes, width=875, height=650'); return false">Click Here »</a>
|
||||
</div>
|
||||
<div class="row"></div>
|
||||
</div><!--Panel 6 Ends-->
|
||||
</div><!--Column 6 Ends-->
|
||||
</div> <!-- Row Ends -->
|
||||
<div class="row"></div>
|
||||
<!--6 panel ends-->
|
||||
<div class="row"></div>
|
||||
<a id=features></a>
|
||||
<a id=resources></a>
|
||||
<a id=news></a>
|
||||
<hr class="featurette-divider">
|
||||
<div class="row"></div>
|
||||
<div class="text-center">
|
||||
<h1>About OpenLiteSpeed</h1>
|
||||
</div>
|
||||
<div class="row"></div>
|
||||
<!--Row Starts-->
|
||||
<div class="row row-centered">
|
||||
<!--Column 1 Starts-->
|
||||
<div class="col-xs-3 col-centered">
|
||||
<!--Panel 1 Starts-->
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading text-center">Features</div>
|
||||
<p></p>
|
||||
<ul>
|
||||
<li class="list-group-item">Event-driven architecture and extremely low resource overhead</li>
|
||||
<li class="list-group-item">Apache compatible rewrite rules</li>
|
||||
<li class="list-group-item">User friendly WebAdmin GUI</li>
|
||||
<li class="list-group-item">HTTP2, ESI, liteMage cache and Websocket Proxies support</li>
|
||||
<li class="list-group-item">PageSpeed, Lua and Cache Support </li>
|
||||
</ul>
|
||||
</div><!--Panel 1 Ends-->
|
||||
</div><!--Column 1 Ends-->
|
||||
<!--Column 2 Starts-->
|
||||
<div class="col-xs-3 col-centered">
|
||||
<!--Panel 2 Starts-->
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading text-center">Resources</div>
|
||||
<p></p>
|
||||
<ul>
|
||||
<li><a href="http://open.litespeedtech.com/mediawiki/index.php/Help:1-Click_Install" class="list-group-item" target="_blank">1-Click Installation</a></li>
|
||||
<li><a href="http://open.litespeedtech.com/mediawiki/index.php/Help:Installation" class="list-group-item" target="_blank">OpenLiteSpeed Installation Guide</a></li>
|
||||
<li><a href="https://groups.google.com/forum/#!forum/openlitespeed-development" class="list-group-item" target="_blank">OpenLiteSpeed Google Group</a></li>
|
||||
<li><a href="http://open.litespeedtech.com/" class="list-group-item" target="_blank">OpenLiteSpeed Wiki</a></li>
|
||||
<li><a href="http://openlitespeed.com/" class="list-group-item" target="_blank">Forum</a></li>
|
||||
</ul>
|
||||
</div><!--Panel 2 Ends-->
|
||||
</div><!--Column 2 Ends-->
|
||||
<!--Column 3 Starts-->
|
||||
<div class="col-xs-3 col-centered">
|
||||
<!--Panel 3 Starts-->
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading text-center">News</div>
|
||||
<p></p>
|
||||
<ul>
|
||||
<li><a href="http://open.litespeedtech.com/mediawiki/index.php/Help:1-Click_Install" class="list-group-item" target="_blank">1-Click to install WordPress on OpenLiteSpeed</a></li>
|
||||
<li><a href="http://open.litespeedtech.com/mediawiki/index.php/Help:4_Line_Install" class="list-group-item" target="_blank">Fully working OpenLiteSpeed install in 4 lines</a></li>
|
||||
<li><a href="http://open.litespeedtech.com/mediawiki/index.php/Help:Multiple_PHPs" class="list-group-item" target="_blank">Set up multiple PHPs</a></li>
|
||||
<li><a href="http://open.litespeedtech.com/mediawiki/index.php/Help:1.4_VHost_Config_Change" class="list-group-item" target="_blank">Virtual host configuration location changes in 1.4</a></li>
|
||||
<li><a href="http://open.litespeedtech.com/mediawiki/index.php/Help:PHP_via_RPM" class="list-group-item" target="_blank">Installing PHP from a Repository</a></li>
|
||||
</ul>
|
||||
</div><!--Panel 3 Ends-->
|
||||
</div><!--Column 3 Ends-->
|
||||
</div><!--Row Ends-->
|
||||
<div class="row"></div>
|
||||
<hr class="featurette-divider">
|
||||
<div class="row"></div>
|
||||
<!-- FOOTER -->
|
||||
<footer>
|
||||
<img class="center-block img-responsive" src="img/powered_by_ols-new.png" alt="power by openlitespeed">
|
||||
<div class="row"></div>
|
||||
<p class="pull-right"><a href="#">Back to top</a></p>
|
||||
<div class="text-center copyright-center"><p>© 2017 LiteSpeed Technologies, Inc. All Rights Reserved.</p>
|
||||
</div>
|
||||
</footer>
|
||||
</div> <!--Container Close-->
|
||||
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
|
||||
<!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>-->
|
||||
<!-- Include all compiled plugins (below), or include individual files as needed -->
|
||||
<!--<script src="js/bootstrap.min.js"></script> -->
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,4 +0,0 @@
|
||||
<?php
|
||||
date_default_timezone_set('America/New_York');
|
||||
phpinfo();
|
||||
?>
|
||||
@@ -1,14 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Protected page</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div align="Center"><br>
|
||||
<h1>Congratulation! You gave the right user name and password.</h1>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,139 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>openlitespeed upload files and module uploadprogress</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: arial;
|
||||
font-size: 12px;
|
||||
}
|
||||
#statbar_box {
|
||||
width: 800px;
|
||||
height: 20px;
|
||||
background-color: #FFF;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
margin-bottom: 12px;
|
||||
display: none;
|
||||
border-radius: 4px;
|
||||
}
|
||||
#statbar_bar {
|
||||
position: absolute;
|
||||
height: 20px;
|
||||
top: 0px;
|
||||
background-color: green;
|
||||
text-align: center;
|
||||
z-index: 100;
|
||||
border-radius: 4px;
|
||||
}
|
||||
#status {
|
||||
margin-bottom: 12px;
|
||||
text-align: center;
|
||||
width: 800px;
|
||||
color: blue;
|
||||
}
|
||||
iframe {
|
||||
background-color: #AAFFFF;
|
||||
width: 100%;
|
||||
height: 400px;
|
||||
margin-bottom: 0;
|
||||
position: relative;
|
||||
}
|
||||
#footer {
|
||||
text-align: center;
|
||||
width: 800px;
|
||||
background: #ddd;
|
||||
padding: 5px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
#base {
|
||||
width: 800px;
|
||||
padding: 20px;
|
||||
background: #EFEFEF;
|
||||
border-radius: 4px;
|
||||
position: relative;
|
||||
margin: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="http://code.jquery.com/jquery-1.8.3.min.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
(function ($) {
|
||||
var interv;
|
||||
var test = 1;
|
||||
var statbarWidth;
|
||||
$(document).ready(function () {
|
||||
statbarWidth = $("#statbar_box").width();
|
||||
$("#upload").submit(function () {
|
||||
uuid = "";
|
||||
/*
|
||||
* You may want to do more to make the uuid more random, such as to use
|
||||
* some kinds of seed or to use a longer uuid.
|
||||
*/
|
||||
for (i = 0; i < 32; i++) {
|
||||
uuid += Math.floor(Math.random() * 16).toString(16);
|
||||
}
|
||||
$("#upload").attr("action", "/upload.php?X-Progress-ID=" + uuid);
|
||||
$("#statbar_bar").css("width", "1px");
|
||||
$("#statbar_box").fadeIn(500);
|
||||
$(this).disabled = false;
|
||||
interv = setInterval(function () {
|
||||
progress(uuid)
|
||||
}, 800);
|
||||
});
|
||||
});
|
||||
var firststart = true;
|
||||
function progress(uuid) {
|
||||
$.ajax({
|
||||
url: "progress?X-Progress-ID=" + uuid,
|
||||
type: "GET",
|
||||
dataType: "json"
|
||||
})
|
||||
.done(function (data) {
|
||||
console.log(data);
|
||||
if (data.state == 'done') {
|
||||
clearInterval(interv);
|
||||
$("#statbar_bar").animate({"width": statbarWidth + "px"});
|
||||
$("#status").html('100% (Done)');
|
||||
} else {
|
||||
var ratio = Math.round((data.received * 100) / data.size);
|
||||
ratio = !ratio?0:ratio;
|
||||
var pixel = Math.round((ratio * statbarWidth) / 100);
|
||||
firststart = false;
|
||||
$("#statbar_bar").animate({"width": pixel + "px"});
|
||||
$("#status").html(ratio + '%');
|
||||
|
||||
}
|
||||
})
|
||||
.fail(function() {
|
||||
clearInterval(interv);
|
||||
$("#statbar_box").fadeTo(500, 0.6);
|
||||
$("#status").html('ERROR -- uploadProgress module not enabled?');
|
||||
});
|
||||
}
|
||||
})(jQuery);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="base">
|
||||
<div id="comments"><p><h4>This page is designed to test the uploading of files as well as the displaying of a progress bar when uploading. <br>
|
||||
If the server side "uploadpassbypath" is set to "enabled", remember that the files path will be uploaded but not it's content. <br>
|
||||
If context "/progress" is set to be handled by the "uploadprogress" module, then the progress request for this file will work as intended, displaying a working progress bar.</h4></p></div>
|
||||
<div id="status">0%</div>
|
||||
<div id="statbar_box">
|
||||
<div id="statbar_bar"></div>
|
||||
</div>
|
||||
|
||||
<form id="upload" action="upload.php" target="resultwindow" method="post" enctype="multipart/form-data">
|
||||
<div>
|
||||
<input type="file" name="file1"/>
|
||||
<input type="file" name="file2"/>
|
||||
<p><input type="submit"/>
|
||||
</div>
|
||||
</form>
|
||||
<iframe src="about:blank" name="resultwindow" frameborder="0" scrolling="no">Your browser does not support iframe.</iframe>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,84 +0,0 @@
|
||||
<!--
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* 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 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
-->
|
||||
<html>
|
||||
<head><style>
|
||||
body {
|
||||
font-family: monospace;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style></head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
function moveAndShow($src, $dest)
|
||||
{
|
||||
if (empty($src)) {
|
||||
echo "<p>file is empty, not stored.</p>\n";
|
||||
} else {
|
||||
rename($src, $dest);
|
||||
echo "<p>Moved: " . $src . " ====> " . $dest . "<br>";
|
||||
echo "MD5 : " . md5_file($dest). "<br>";
|
||||
echo "Size : " . filesize($dest). " bytes</p>\n";
|
||||
}
|
||||
}
|
||||
|
||||
function disaplyParsedFile($filekey)
|
||||
{
|
||||
echo "<p>File : " . $filekey . "<br>";
|
||||
echo "Name : " . $_POST["{$filekey}_name"] . "<br>";
|
||||
echo "Type : " . $_POST["{$filekey}_content-type"] . "<br>";
|
||||
echo "Path : " . $_POST["{$filekey}_path"] . "<br>";
|
||||
echo "MD5 : " . $_POST["{$filekey}_md5"] . "<br>";
|
||||
echo "Size : " . $_POST["{$filekey}_size"] . " Bytes<br></p>\n";
|
||||
}
|
||||
|
||||
function displayNoParsedFile($filekey)
|
||||
{
|
||||
echo "<p>File : " . $filekey . "<br>";
|
||||
echo "Name : " . $_FILES["{$filekey}"]['name'] . "<br>";
|
||||
echo "Type : " . $_FILES["{$filekey}"]['type'] . "<br>";
|
||||
echo "Path : " . $_FILES["{$filekey}"]['tmp_name'] . "<br>";
|
||||
echo "Size : " . $_FILES["{$filekey}"]['size'] . "</p>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if(empty($_FILES["file1"]))
|
||||
{
|
||||
echo "<h1>Request body updated by Parser</h1>\n";
|
||||
|
||||
for ($i = 1; $i <= 2; $i++) {
|
||||
disaplyParsedFile("file{$i}");
|
||||
$moved_to_path = '/tmp/uploadfile_' . $_POST["file{$i}_name"];
|
||||
moveAndShow($_POST["file{$i}_path"], $moved_to_path);
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "<h1>No Parser used</h1>\n";
|
||||
for ($i = 1; $i <= 2; $i++) {
|
||||
displayNoParsedFile("file{$i}");
|
||||
$moved_to_path = '/tmp/uploadfile_' . $_FILES["file{$i}"]["name"];
|
||||
moveAndShow($_FILES["file{$i}"]["tmp_name"], $moved_to_path);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</body></html>
|
||||
674
install/openlitespeed-1.4.28/dist/GPL.txt
vendored
@@ -1,674 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
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.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
1
install/openlitespeed-1.4.28/dist/VERSION
vendored
@@ -1 +0,0 @@
|
||||
1.4.28
|
||||
@@ -1,12 +0,0 @@
|
||||
LiteSpeed SNMPD Bridge + Cacti Templates
|
||||
----------------------------------------
|
||||
|
||||
For the most up-to-date installation documentation, please refer to our online "SNMP Monitoring" wiki:
|
||||
|
||||
http://www.litespeedtech.com/support/wiki/doku.php?id=litespeed_wiki:snmp_cacti_monitoring
|
||||
|
||||
Release Log:
|
||||
-----------
|
||||
1.0 08-23-2006
|
||||
|
||||
|
||||
@@ -1,250 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*----------------------------------------
|
||||
LiteSpeed_Stats to SNMP bridge. Relay stats to SNMPD.
|
||||
|
||||
Copyright (C) 2006 LiteSpeed Technologies, Inc.
|
||||
This library 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.
|
||||
|
||||
This library 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.
|
||||
|
||||
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
|
||||
|
||||
Version: 1.0 @ 08/23/2006
|
||||
Contact: bug@litespeedtech.com
|
||||
Url: http://www.litespeedtech.com
|
||||
|
||||
Requirement:
|
||||
|
||||
1)LiteSpeed Web Server version >= 2.1.18
|
||||
2)PHP 5+
|
||||
|
||||
----------------------------------------*/
|
||||
|
||||
require_once("class.litespeed_stats.php");
|
||||
|
||||
class litespeed_snmp_bridge
|
||||
{
|
||||
public $processes = 1;
|
||||
public $report_path = "/tmp/lshttpd/";
|
||||
public $cache_time = 0;
|
||||
public $cache_file = null;
|
||||
public $stats = null;
|
||||
|
||||
public function __construct($processes = 1, $report_path = "/tmp/lshttpd/", $cache_time = 0, $cache_file = null)
|
||||
{
|
||||
$this->processes = (int) $processes;
|
||||
$this->report_path = trim($report_path);
|
||||
|
||||
//prepare parser
|
||||
if($this->cache_time > 0 && strlen($this->cache_file) > 0) {
|
||||
if(file_exists($this->cache_file) && time() - filemtime($this->cache_file) <= $this->cache_time) {
|
||||
$unserial = unserialize(file_get_contents($this->cache_file));
|
||||
|
||||
if(is_a($unserial,"litespeed_stats")) {
|
||||
$this->stats = $unserial;
|
||||
} else {
|
||||
$this->stats = new litespeed_stats($this->processes,$this->report_path);
|
||||
$this->stats->parse();
|
||||
$this->save_cache($this->cache_file, $this->stats);
|
||||
}
|
||||
} else {
|
||||
$this->stats = new litespeed_stats($this->processes,$this->report_path);
|
||||
$this->stats->parse();
|
||||
$this->save_cache($this->cache_file, $this->stats);
|
||||
}
|
||||
} else {
|
||||
$this->stats = new litespeed_stats($this->processes,$this->report_path);
|
||||
$this->stats->parse();
|
||||
}
|
||||
}
|
||||
|
||||
//generate snmp compatible response
|
||||
public function format_response($oid, $type, $data)
|
||||
{
|
||||
return "{$oid}\n{$type}\n{$data}\n";
|
||||
}
|
||||
|
||||
//aggregate oid info from 1 to 7 sector
|
||||
public function oid_part($tarray = null)
|
||||
{
|
||||
$str = "";
|
||||
for($i=1; $i <= 7; $i++) {
|
||||
$str .= "." . $tarray[$i];
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
//retrieve single oid data
|
||||
public function oid_get($super, $oid)
|
||||
{
|
||||
$parsed = explode(".",$oid);
|
||||
|
||||
//error..invalid oid parse
|
||||
if(count($parsed) < 9) {
|
||||
return;
|
||||
}
|
||||
|
||||
$major = (int) $parsed[8];
|
||||
|
||||
if(count($parsed) < 10) {
|
||||
$minor = 1;
|
||||
} else {
|
||||
$minor = (int) $parsed[9];
|
||||
}
|
||||
|
||||
foreach($super as $key => $value) {
|
||||
$sanitized_major = (int) substr($major,0,1) . "00";
|
||||
|
||||
//index only
|
||||
if( $major == (int) $key ) {
|
||||
return $this->format_response($this->oid_part($parsed) . "." . $major . "." . $minor,"integer",$minor);
|
||||
|
||||
}
|
||||
|
||||
//non-index value
|
||||
if( $sanitized_major == (int) $key) {
|
||||
$size = count($value[0]);
|
||||
|
||||
$map = $value[1];
|
||||
|
||||
if($size <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if(count($parsed) == 10) {
|
||||
if($minor > 0 && $minor <= $size) {
|
||||
$tempkeys = array_keys($value[0]);
|
||||
$temp = $value[0][$tempkeys[$minor-1]];
|
||||
list($format,$itemkey) = explode(",",$value[1][$major]);
|
||||
|
||||
return $this->format_response($oid, $format, $temp->$itemkey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save_cache($file, $data)
|
||||
{
|
||||
file_put_contents($file, serialize($data));
|
||||
}
|
||||
|
||||
public function process($type, $oid)
|
||||
{
|
||||
//setup oid to var maps
|
||||
$vh_map = array(
|
||||
"201" => "string,vhost",
|
||||
"202" => "gauge,req_processing",
|
||||
"203" => "gauge,req_per_sec",
|
||||
"204" => "counter,req_total"
|
||||
);
|
||||
|
||||
$ext_map = array(
|
||||
"301" => "string,vhost",
|
||||
"302" => "string,type",
|
||||
"303" => "string,extapp",
|
||||
"304" => "gauge,config_max_conn",
|
||||
"305" => "gauge,effect_max_conn",
|
||||
"306" => "gauge,pool_size",
|
||||
"307" => "gauge,inuse_conn",
|
||||
"308" => "gauge,idle_conn",
|
||||
"309" => "gauge,waitqueue_depth",
|
||||
"310" => "gauge,req_per_sec",
|
||||
"311" => "counter,req_total"
|
||||
);
|
||||
|
||||
$gen_map = array(
|
||||
"101" => "string,product",
|
||||
"102" => "string,edition",
|
||||
"103" => "string,version",
|
||||
"104" => "string,uptime",
|
||||
"105" => "gauge,bps_in",
|
||||
"106" => "gauge,bps_out",
|
||||
"107" => "gauge,ssl_bps_in",
|
||||
"108" => "gauge,ssl_bps_out",
|
||||
"109" => "gauge,max_conn",
|
||||
"110" => "gauge,max_ssl_conn",
|
||||
"111" => "gauge,plain_conn",
|
||||
"112" => "gauge,avail_conn",
|
||||
"113" => "gauge,idle_conn",
|
||||
"114" => "gauge,ssl_conn",
|
||||
"115" => "gauge,avail_ssl_conn"
|
||||
);
|
||||
|
||||
//setup pointers
|
||||
$super = array();
|
||||
$super["100"] = array(array($this->stats), $gen_map);
|
||||
$super["200"] = array($this->stats->vhosts, $vh_map);
|
||||
|
||||
//put alll extapps to single array
|
||||
$extapps = array();
|
||||
foreach($this->stats->vhosts as $value) {
|
||||
foreach($value->extapps as $vextapp) {
|
||||
$extapps[] = $vextapp;
|
||||
}
|
||||
}
|
||||
|
||||
$super["300"] = array($extapps, $ext_map);
|
||||
|
||||
//get single method
|
||||
if($type == "-g") {
|
||||
echo $this->oid_get($super, $oid);
|
||||
return;
|
||||
} else if($type == "-n") {
|
||||
//snmp walk traversal
|
||||
//build traversal nodes/oids
|
||||
$parsed = explode(".",$oid);
|
||||
$major = $parsed[8];
|
||||
|
||||
foreach($super as $key => $value) {
|
||||
//form index walk
|
||||
if($major == $key) {
|
||||
$size = count($value[0]);
|
||||
|
||||
if($size <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(count($parsed) == 10) {
|
||||
$minor = (int) $parsed[9];
|
||||
|
||||
if($minor > 0 && $minor < $size) {
|
||||
echo $this->format_response($this->oid_part($parsed).".{$key}.".($minor+1),"integer",$minor+1);
|
||||
|
||||
}
|
||||
} else if(count($parsed) == 9) {
|
||||
echo $this->format_response("{$oid}.1","integer",1);
|
||||
}
|
||||
|
||||
} else if(array_key_exists($major,$value[1])) {
|
||||
//data walk
|
||||
$size = count($value[0]);
|
||||
|
||||
if($size <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(count($parsed) == 10) {
|
||||
$minor = (int) $parsed[9];
|
||||
|
||||
if($minor > 0 && $minor < $size) {
|
||||
echo $this->oid_get($super, $this->oid_part($parsed).".{$major}.".($minor+1));
|
||||
}
|
||||
} else if(count($parsed) == 9){
|
||||
echo $this->oid_get($super, $this->oid_part($parsed).".{$major}.".(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,200 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*----------------------------------------
|
||||
LiteSpeed_Stats class and subclasses. Parse Real-Time data for LiteSpeed Products
|
||||
|
||||
Copyright (C) 2006 LiteSpeed Technologies, Inc.
|
||||
This library 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.
|
||||
|
||||
This library 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.
|
||||
|
||||
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
|
||||
|
||||
Version: 1.0 @ 08/23/2006
|
||||
Contact: bug@litespeedtech.com
|
||||
Url: http://www.litespeedtech.com
|
||||
|
||||
Requirement:
|
||||
|
||||
1)LiteSpeed Web Server version >= 2.1.18
|
||||
2)PHP 5+
|
||||
----------------------------------------*/
|
||||
|
||||
class litespeed_stats
|
||||
{
|
||||
public $product = null;
|
||||
public $edition = null;
|
||||
public $version = null;
|
||||
public $uptime = null;
|
||||
|
||||
public $bps_in = 0;
|
||||
public $bps_out = 0;
|
||||
public $ssl_bps_in = 0;
|
||||
public $ssl_bps_out = 0;
|
||||
|
||||
public $max_conn = 0;
|
||||
public $max_ssl_conn = 0;
|
||||
|
||||
public $plain_conn = 0;
|
||||
public $avail_conn = 0;
|
||||
public $idle_conn = 0;
|
||||
|
||||
public $ssl_conn = 0;
|
||||
public $avail_ssl_conn = 0;
|
||||
|
||||
public $vhosts = array();
|
||||
|
||||
//misc settings
|
||||
|
||||
//full path to .rtreports files. different products have different paths
|
||||
public $report_path = "/tmp/lshttpd/";
|
||||
|
||||
//processes..enterprise version can spawn proccess = cpu cores
|
||||
public $processes = 1;
|
||||
|
||||
public function __construct($processes = 1, $report_path = "/tmp/lshttpd/")
|
||||
{
|
||||
$this->processes = (int) $processes;
|
||||
$this->report_path = trim($report_path);
|
||||
}
|
||||
|
||||
public function parse()
|
||||
{
|
||||
for ( $i = 1 ; $i <= $this->processes ; $i++ )
|
||||
{
|
||||
if ( $i > 1 ) {
|
||||
$content = file_get_contents("{$this->report_path}.rtreport.{$i}");
|
||||
} else {
|
||||
$content = file_get_contents("{$this->report_path}.rtreport");
|
||||
}
|
||||
|
||||
$result = array();
|
||||
|
||||
$found = 0;
|
||||
|
||||
$found = preg_match_all("/VERSION: ([a-zA-Z0-9\ ]+)\/([a-zA-Z]*)\/([a-zA-Z0-9\.]+)\nUPTIME: ([0-9A-Za-z\ \:]+)\nBPS_IN:([0-9\ ]+), BPS_OUT:([0-9\ ]+), SSL_BPS_IN:([0-9\ ]+), SSL_BPS_OUT:([0-9\ ]+)\nMAXCONN:([0-9\ ]+), MAXSSL_CONN:([0-9\ ]+), PLAINCONN:([0-9\ ]+), AVAILCONN:([0-9\ ]+), IDLECONN:([0-9\ ]+), SSLCONN:([0-9\ ]+), AVAILSSL:([0-9\ ]+)/i", $content, $result);
|
||||
|
||||
if($found == 1) {
|
||||
$this->product = trim($result[1][0]);
|
||||
$this->edition = trim($result[2][0]);
|
||||
$this->version = trim($result[3][0]);
|
||||
$this->uptime = trim($result[4][0]);
|
||||
$this->bps_in += (int) $result[5][0];
|
||||
$this->bps_out += (int) $result[6][0];
|
||||
$this->ssl_bps_in += (int) $result[7][0];
|
||||
$this->ssl_bps_out += (int) $result[8][0];
|
||||
|
||||
$this->max_conn += (int) $result[9][0];
|
||||
$this->max_ssl_conn += (int) $result[10][0];
|
||||
|
||||
$this->plain_conn += (int) $result[11][0];
|
||||
$this->avail_conn += (int) $result[12][0];
|
||||
$this->idle_conn += (int) $result[13][0];
|
||||
|
||||
$this->ssl_conn += (int) $result[14][0];
|
||||
$this->avail_ssl_conn += (int) $result[15][0];
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$found = 0;
|
||||
|
||||
$found = preg_match_all("/REQ_RATE \[([^\]]*)\]: REQ_PROCESSING: ([0-9]+), REQ_PER_SEC: ([0-9]+), TOT_REQS: ([0-9]+)/i",$content,$result);
|
||||
|
||||
for($f = 0; $f < $found; $f++) {
|
||||
$vhost = trim($result[1][$f]);
|
||||
|
||||
if($vhost == "") {
|
||||
$vhost = "_Server";
|
||||
}
|
||||
|
||||
if(!array_key_exists($vhost,$this->vhosts)) {
|
||||
$this->vhosts[$vhost] = new litespeed_stats_vhost($vhost);
|
||||
}
|
||||
|
||||
$temp = $this->vhosts[$vhost];
|
||||
|
||||
$temp->req_processing += (int) $result[2][$f];
|
||||
$temp->req_per_sec += (int) $result[3][$f];
|
||||
$temp->req_total += (int) $result[4][$f];
|
||||
}
|
||||
|
||||
//reset
|
||||
$result = array();
|
||||
$found = 0;
|
||||
|
||||
$found = preg_match_all("/EXTAPP \[([^\]]*)\] \[([^\]]*)\] \[([^\]]*)\]: CMAXCONN: ([0-9]+), EMAXCONN: ([0-9]+), POOL_SIZE: ([0-9]+), INUSE_CONN: ([0-9]+), IDLE_CONN: ([0-9]+), WAITQUE_DEPTH: ([0-9]+), REQ_PER_SEC: ([0-9]+), TOT_REQS: ([0-9]+)/i",$content,$result);
|
||||
|
||||
for($f = 0; $f < $found; $f++) {
|
||||
$vhost = trim($result[2][$f]);
|
||||
$extapp = trim($result[3][$f]);
|
||||
|
||||
if($vhost == "") {
|
||||
$vhost = "_Server";
|
||||
}
|
||||
|
||||
if(!array_key_exists($vhost,$this->vhosts)) {
|
||||
$this->vhosts[$vhost] = new litespeed_stats_vhost($vhost);
|
||||
}
|
||||
|
||||
if(!array_key_exists($extapp,$this->vhosts[$vhost]->extapps)) {
|
||||
$this->vhosts[$vhost]->extapps[$extapp] = new litespeed_stats_vhost_extapp($extapp, $vhost);
|
||||
}
|
||||
|
||||
$temp = $this->vhosts[$vhost]->extapps[$extapp];
|
||||
|
||||
$temp->type = trim($result[1][$f]);
|
||||
$temp->config_max_conn += (int) $result[4][$f];
|
||||
$temp->effect_max_conn += (int) $result[5][$f];
|
||||
$temp->pool_size += (int) $result[6][$f];
|
||||
$temp->inuse_conn += (int) $result[7][$f];
|
||||
$temp->idle_conn += (int) $result[8][$f];
|
||||
$temp->waitqueue_depth += (int) $result[9][$f];
|
||||
$temp->req_per_sec += (int) $result[10][$f];
|
||||
$temp->req_total += (int) $result[11][$f];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class liteSpeed_stats_vhost
|
||||
{
|
||||
public $vhost = null;
|
||||
public $req_processing = 0;
|
||||
public $req_per_sec = 0;
|
||||
public $req_total = 0;
|
||||
public $extapps = array();
|
||||
|
||||
public function __construct($vhost = null)
|
||||
{
|
||||
$this->vhost = trim($vhost);
|
||||
}
|
||||
}
|
||||
|
||||
class litespeed_stats_vhost_extapp
|
||||
{
|
||||
public function __construct($extapp = null, $vhost = null)
|
||||
{
|
||||
$this->extapp = trim($extapp);
|
||||
$this->vhost = trim($vhost);
|
||||
}
|
||||
|
||||
public $vhost = null;
|
||||
public $type = null;
|
||||
public $extapp = null;
|
||||
public $config_max_conn = 0;
|
||||
public $effect_max_conn = 0;
|
||||
public $pool_size = 0;
|
||||
public $inuse_conn = 0;
|
||||
public $idle_conn = 0;
|
||||
public $waitqueue_depth = 0;
|
||||
public $req_per_sec = 0;
|
||||
public $req_total = 0;
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
<interface>
|
||||
<name>Get LiteSpeed External Applications</name>
|
||||
<oid_index>.1.3.6.1.4.1.22253.300</oid_index>
|
||||
<index_order>ExtApp:Type:Vhost:Index</index_order>
|
||||
<index_order_type>numeric</index_order_type>
|
||||
<index_title_format>|chosen_order_field|</index_title_format>
|
||||
|
||||
<fields>
|
||||
<Index>
|
||||
<name>Index</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>input</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.300</oid>
|
||||
</Index>
|
||||
<Vhost>
|
||||
<name>Vhost Name</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>input</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.301</oid>
|
||||
</Vhost>
|
||||
<Type>
|
||||
<name>Type</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>input</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.302</oid>
|
||||
</Type>
|
||||
<ExtApp>
|
||||
<name>Ext App</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>input</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.303</oid>
|
||||
</ExtApp>
|
||||
<ConfMaxConn>
|
||||
<name>Config Max Conn</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>output</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.304</oid>
|
||||
</ConfMaxConn>
|
||||
<EffMaxConn>
|
||||
<name>Effective Max Conn</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>output</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.305</oid>
|
||||
</EffMaxConn>
|
||||
<PoolSize>
|
||||
<name>Pool Size</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>output</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.306</oid>
|
||||
</PoolSize>
|
||||
<InuseConn>
|
||||
<name>InUse Conn</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>output</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.307</oid>
|
||||
</InuseConn>
|
||||
<IdleConn>
|
||||
<name>Idle Conn</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>output</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.308</oid>
|
||||
</IdleConn>
|
||||
<WaitQueueDepth>
|
||||
<name>Wait-Queue Depth</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>output</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.309</oid>
|
||||
</WaitQueueDepth>
|
||||
<Req_Second>
|
||||
<name>Requests Per Second</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>output</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.310</oid>
|
||||
</Req_Second>
|
||||
<Req_Total>
|
||||
<name>Requests Total</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>output</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.311</oid>
|
||||
</Req_Total>
|
||||
|
||||
</fields>
|
||||
</interface>
|
||||
@@ -1,123 +0,0 @@
|
||||
<interface>
|
||||
<name>Get LiteSpeed General</name>
|
||||
<description>list litespeed general</description>
|
||||
<oid_index>.1.3.6.1.4.1.22253.100</oid_index>
|
||||
<index_order>Index</index_order>
|
||||
<index_order_type>numeric</index_order_type>
|
||||
<index_title_format>|chosen_order_field|</index_title_format>
|
||||
|
||||
<fields>
|
||||
<Index>
|
||||
<name>Index</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>input</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.100</oid>
|
||||
</Index>
|
||||
<Product>
|
||||
<name>Product</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>input</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.101</oid>
|
||||
</Product>
|
||||
<Edition>
|
||||
<name>Edition</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>input</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.102</oid>
|
||||
</Edition>
|
||||
<Version>
|
||||
<name>Version</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>input</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.103</oid>
|
||||
</Version>
|
||||
<UpTime>
|
||||
<name>UpTime</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>input</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.104</oid>
|
||||
</UpTime>
|
||||
<BpsIn>
|
||||
<name>Bps (In)</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>output</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.105</oid>
|
||||
</BpsIn>
|
||||
<BpsOut>
|
||||
<name>Bps (Out)</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>output</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.106</oid>
|
||||
</BpsOut>
|
||||
<SSLBpsIn>
|
||||
<name>SSL Bps (In)</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>output</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.107</oid>
|
||||
</SSLBpsIn>
|
||||
<SSLBpsOut>
|
||||
<name>SSL Bps (Out)</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>output</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.108</oid>
|
||||
</SSLBpsOut>
|
||||
<MaxConn>
|
||||
<name>Max Connections</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>output</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.109</oid>
|
||||
</MaxConn>
|
||||
<MaxSSLConn>
|
||||
<name>Max SSL Connections</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>output</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.110</oid>
|
||||
</MaxSSLConn>
|
||||
<PlainConn>
|
||||
<name>Plain Connections</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>output</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.111</oid>
|
||||
</PlainConn>
|
||||
<AvailConn>
|
||||
<name>Available Plain Connections</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>output</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.112</oid>
|
||||
</AvailConn>
|
||||
<IdleConn>
|
||||
<name>Idle Connections</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>output</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.113</oid>
|
||||
</IdleConn>
|
||||
<SSLConn>
|
||||
<name>SSL Connections</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>output</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.114</oid>
|
||||
</SSLConn>
|
||||
<AvailSSLConn>
|
||||
<name>Available SSL Connections</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>output</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.115</oid>
|
||||
</AvailSSLConn>
|
||||
</fields>
|
||||
</interface>
|
||||
@@ -1,46 +0,0 @@
|
||||
<interface>
|
||||
<name>Get LiteSpeed Vhosts</name>
|
||||
<description>list litespeed virtual hosts</description>
|
||||
<oid_index>.1.3.6.1.4.1.22253.200</oid_index>
|
||||
<index_order>Vhost:Index</index_order>
|
||||
<index_order_type>numeric</index_order_type>
|
||||
<index_title_format>|chosen_order_field|</index_title_format>
|
||||
|
||||
<fields>
|
||||
<Index>
|
||||
<name>Index</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>input</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.200</oid>
|
||||
</Index>
|
||||
<Vhost>
|
||||
<name>Vhost Name</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>input</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.201</oid>
|
||||
</Vhost>
|
||||
<ReqProcessing>
|
||||
<name>Requests Processing</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>output</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.202</oid>
|
||||
</ReqProcessing>
|
||||
<ReqSecond>
|
||||
<name>Requests Per Second</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>output</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.203</oid>
|
||||
</ReqSecond>
|
||||
<ReqTotal>
|
||||
<name>Requests Total</name>
|
||||
<method>walk</method>
|
||||
<source>value</source>
|
||||
<direction>output</direction>
|
||||
<oid>.1.3.6.1.4.1.22253.204</oid>
|
||||
</ReqTotal>
|
||||
</fields>
|
||||
</interface>
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*--------------------------------
|
||||
assuming following entry in /etc/snmp/snmpd.conf
|
||||
|
||||
pass .1.3.6.1.4.1.22253 /usr/bin/php smaple.php
|
||||
|
||||
if you change the default parent oid node: .1.3.6.1.4.1.22253, you must also modify the OID entries .xml files.
|
||||
--------------------------------*/
|
||||
|
||||
|
||||
require_once("class.litespeed_snmp_bridge.php");
|
||||
|
||||
$processes = 1; //<-- value of > 1 only valid LiteSpeed Enterprise (num of cpus licensed)
|
||||
$report_path = "/tmp/lshttpd/"; //<-- path to .rtreport folder. Default is /tmp/lshttpd/
|
||||
|
||||
$cache_time = 0; //<-- seconds to cache parsed data
|
||||
$cache_file = "/tmp/_lsws_sampe_cache.txt"; //<-- cache file..full path.
|
||||
|
||||
|
||||
//get params from snmpd pass mechanism
|
||||
if(array_key_exists(1,$_SERVER["argv"]) && array_key_exists(2,$_SERVER["argv"])) {
|
||||
$type = trim($_SERVER["argv"][1]);
|
||||
$oid = trim($_SERVER["argv"][2]);
|
||||
|
||||
$bridge = new litespeed_snmp_bridge($processes, $report_path, $cache_time, $cache_file);
|
||||
$bridge->process($type, $oid);
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,25 +0,0 @@
|
||||
enableCoreDump 1
|
||||
sessionTimeout 3600
|
||||
|
||||
errorlog $SERVER_ROOT/admin/logs/error.log {
|
||||
useServer 0
|
||||
logLevel INFO
|
||||
rollingSize 10M
|
||||
}
|
||||
|
||||
accessLog $SERVER_ROOT/admin/logs/access.log {
|
||||
useServer 0
|
||||
rollingSize 10M
|
||||
keepDays 90
|
||||
logReferer 1
|
||||
logUserAgent 1
|
||||
}
|
||||
|
||||
accessControl {
|
||||
allow ALL
|
||||
}
|
||||
|
||||
listener adminListener {
|
||||
address *:%ADMIN_PORT%
|
||||
secure 0
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
enableCoreDump 1
|
||||
sessionTimeout 3600
|
||||
|
||||
errorlog $SERVER_ROOT/admin/logs/error.log {
|
||||
useServer 0
|
||||
logLevel INFO
|
||||
rollingSize 10M
|
||||
}
|
||||
|
||||
accessLog $SERVER_ROOT/admin/logs/access.log {
|
||||
useServer 0
|
||||
rollingSize 10M
|
||||
keepDays 90
|
||||
logReferer 1
|
||||
logUserAgent 1
|
||||
}
|
||||
|
||||
accessControl {
|
||||
allow ALL
|
||||
}
|
||||
|
||||
listener adminListener{
|
||||
address *:%ADMIN_PORT%
|
||||
secure 1
|
||||
keyFile $SERVER_ROOT/admin/conf/%SSL_HOSTNAME%.key
|
||||
certFile $SERVER_ROOT/admin/conf/%SSL_HOSTNAME%.crt
|
||||
clientVerify 0
|
||||
}
|
||||
1082
install/openlitespeed-1.4.28/dist/admin/conf/php.ini
vendored
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once("view/inc/auth.php");
|
||||
|
||||
//require UI configuration (nav, ribbon, etc.)
|
||||
require_once("view/inc/configui.php");
|
||||
|
||||
include("view/inc/header.php");
|
||||
include("view/inc/nav.php");
|
||||
|
||||
?>
|
||||
<!-- ==========================CONTENT STARTS HERE ========================== -->
|
||||
<!-- MAIN PANEL -->
|
||||
<div id="main" role="main">
|
||||
|
||||
<!-- RIBBON -->
|
||||
<div id="ribbon">
|
||||
|
||||
<!-- breadcrumb auto generated-->
|
||||
<ol class="breadcrumb">
|
||||
<!-- This is auto generated -->
|
||||
</ol>
|
||||
<!-- end breadcrumb -->
|
||||
<span class="hide pull-right well well-sm text-warning"><i class="fa fa-bell"></i> <?php DMsg::EchoUIStr('note_configmodified')?></span>
|
||||
</div>
|
||||
<!-- END RIBBON -->
|
||||
|
||||
<!-- MAIN CONTENT -->
|
||||
<div id="content">
|
||||
|
||||
</div>
|
||||
<!-- END MAIN CONTENT -->
|
||||
|
||||
</div>
|
||||
<!-- END MAIN PANEL -->
|
||||
|
||||
|
||||
<!--
|
||||
<?php echo $footer_lic_info; ?>
|
||||
-->
|
||||
|
||||
<!-- PAGE FOOTER -->
|
||||
<div class="page-footer">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-6">
|
||||
<span class="txt-color-white">LiteSpeed WebAdmin Console © 2014-2017 <?php DMsg::EchoUIStr('note_copyrightreserved')?></span>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-6 text-right hidden-xs">
|
||||
<i class="txt-color-blueLight hidden-mobile"> <i class="fa fa-clock-o"></i>
|
||||
<i><?php DMsg::EchoUIStr('note_dataretrievedat')?> <span id="lst_UpdateStamp"></span> </i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- END PAGE FOOTER -->
|
||||
|
||||
<!-- ==========================CONTENT ENDS HERE ========================== -->
|
||||
|
||||
<?php
|
||||
include("view/inc/scripts.php");
|
||||
?>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,285 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once('blowfish.php') ;
|
||||
|
||||
class CAuthorizer
|
||||
{
|
||||
|
||||
private $_id ;
|
||||
private $_id_field ;
|
||||
private $_pass ;
|
||||
private $_pass_field ;
|
||||
private static $_instance = NULL ;
|
||||
|
||||
// prevent an object from being constructed
|
||||
private function __construct()
|
||||
{
|
||||
$label = preg_replace('/\W/', '_', SERVER_ROOT) ;
|
||||
$this->_id_field = "{$label}_uid" ;
|
||||
$this->_pass_field = "{$label}_pass" ;
|
||||
|
||||
session_name("{$label}WEBUI") ; // to prevent conflicts with other app sessions
|
||||
session_start() ;
|
||||
|
||||
if ( ! array_key_exists('changed', $_SESSION) ) {
|
||||
$_SESSION['changed'] = FALSE ;
|
||||
}
|
||||
|
||||
|
||||
if ( ! array_key_exists('valid', $_SESSION) ) {
|
||||
$_SESSION['valid'] = FALSE ;
|
||||
}
|
||||
|
||||
if ( ! array_key_exists('token', $_SESSION) ) {
|
||||
$_SESSION['token'] = microtime() ;
|
||||
}
|
||||
|
||||
if ( $_SESSION['valid'] ) {
|
||||
|
||||
if ( array_key_exists('lastaccess', $_SESSION) ) {
|
||||
|
||||
if ( isset($_SESSION['timeout']) && $_SESSION['timeout'] > 0 && time() - $_SESSION['lastaccess'] > $_SESSION['timeout'] ) {
|
||||
$this->clear() ;
|
||||
if ( strpos($_SERVER['SCRIPT_NAME'], '/view/') !== FALSE ) {
|
||||
echo json_encode(array( 'login_timeout' => 1 )) ;
|
||||
}
|
||||
else {
|
||||
header("location:/login.php?timedout=1") ;
|
||||
}
|
||||
die() ;
|
||||
}
|
||||
|
||||
$this->_id = UIBase::GrabGoodInput('cookie', $this->_id_field) ;
|
||||
$this->_pass = UIBase::GrabInput('cookie', $this->_pass_field) ;
|
||||
}
|
||||
if ( ! defined('NO_UPDATE_ACCESS') )
|
||||
$this->updateAccessTime() ;
|
||||
}
|
||||
}
|
||||
|
||||
public static function singleton()
|
||||
{
|
||||
|
||||
if ( ! isset(self::$_instance) ) {
|
||||
$c = __CLASS__ ;
|
||||
self::$_instance = new $c ;
|
||||
}
|
||||
|
||||
return self::$_instance ;
|
||||
}
|
||||
|
||||
public static function Authorize()
|
||||
{
|
||||
$auth = CAuthorizer::singleton() ;
|
||||
if ( ! $auth->IsValid() ) {
|
||||
$auth->clear() ;
|
||||
if ( strpos($_SERVER['SCRIPT_NAME'], '/view/') !== FALSE ) {
|
||||
echo json_encode(array( 'login_timeout' => 1 )) ;
|
||||
}
|
||||
else {
|
||||
header("location:/login.php") ;
|
||||
}
|
||||
die() ;
|
||||
}
|
||||
}
|
||||
|
||||
public function IsValid()
|
||||
{
|
||||
return ! ( ($_SESSION['valid'] !== TRUE) || (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']) === FALSE)) ;
|
||||
}
|
||||
|
||||
public static function GetToken()
|
||||
{
|
||||
return $_SESSION['token'] ;
|
||||
}
|
||||
|
||||
public static function SetTimeout( $timeout )
|
||||
{
|
||||
$_SESSION['timeout'] = (int) $timeout ;
|
||||
}
|
||||
|
||||
public static function HasSetTimeout()
|
||||
{
|
||||
return (isset($_SESSION['timeout']) && $_SESSION['timeout'] >= 60) ;
|
||||
}
|
||||
|
||||
public function GetCmdHeader()
|
||||
{
|
||||
if ( isset($_SESSION['secret']) && is_array($_SESSION['secret']) ) {
|
||||
$uid = PMA_blowfish_decrypt($this->_id, $_SESSION['secret'][0]) ;
|
||||
$password = PMA_blowfish_decrypt($this->_pass, $_SESSION['secret'][1]) ;
|
||||
return "auth:$uid:$password\n" ;
|
||||
}
|
||||
else
|
||||
return '' ;
|
||||
}
|
||||
|
||||
public function GenKeyPair()
|
||||
{
|
||||
$keyfile = Service::ServiceData(SInfo::DATA_ADMIN_KEYFILE) ;
|
||||
$mykeys = NULL ;
|
||||
$keyLength = 512 ;
|
||||
|
||||
if ( file_exists($keyfile) ) {
|
||||
$str = file_get_contents($keyfile) ;
|
||||
if ( $str != '' )
|
||||
$mykeys = unserialize($str) ;
|
||||
}
|
||||
if ( $mykeys == NULL ) {
|
||||
$jCryption = new jCryption() ;
|
||||
$keys = $jCryption->generateKeypair($keyLength) ;
|
||||
$e_hex = $jCryption->dec2string($keys['e'], 16) ;
|
||||
$n_hex = $jCryption->dec2string($keys['n'], 16) ;
|
||||
$mykeys = array( 'e_hex' => $e_hex, 'n_hex' => $n_hex, 'd_int' => $keys['d'], 'n_int' => $keys['n'] ) ;
|
||||
$serialized_str = serialize($mykeys) ;
|
||||
file_put_contents($keyfile, $serialized_str) ;
|
||||
chmod($keyfile, 0600) ;
|
||||
}
|
||||
$_SESSION['d_int'] = $mykeys['d_int'] ;
|
||||
$_SESSION['n_int'] = $mykeys['n_int'] ;
|
||||
|
||||
return '{"e":"' . $mykeys['e_hex'] . '","n":"' . $mykeys['n_hex'] . '","maxdigits":"' . intval($keyLength * 2 / 16 + 3) . '"}' ;
|
||||
}
|
||||
|
||||
public function ShowLogin( $is_https, &$msg )
|
||||
{
|
||||
$timedout = UIBase::GrabInput('get', 'timedout', 'int') ;
|
||||
$logoff = UIBase::GrabInput('get', 'logoff', 'int') ;
|
||||
$msg = '' ;
|
||||
|
||||
if ( $timedout == 1 || $logoff == 1 ) {
|
||||
$this->clear() ;
|
||||
|
||||
if ( $timedout == 1 ) {
|
||||
$msg = DMsg::Err('err_sessiontimeout') ;
|
||||
}
|
||||
else {
|
||||
$msg = DMsg::Err('err_loggedoff') ;
|
||||
}
|
||||
}
|
||||
else if ( $this->IsValid() ) {
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
$userid = NULL ;
|
||||
$pass = NULL ;
|
||||
|
||||
if ( isset($_POST['jCryption']) ) {
|
||||
$jCryption = new jCryption() ;
|
||||
$var = $jCryption->decrypt($_POST['jCryption'], $_SESSION['d_int'], $_SESSION['n_int']) ;
|
||||
unset($_SESSION['d_int']) ;
|
||||
unset($_SESSION['n_int']) ;
|
||||
parse_str($var, $result) ;
|
||||
$userid = $result['userid'] ;
|
||||
$pass = $result['pass'] ;
|
||||
}
|
||||
else if ( $is_https && isset($_POST['userid']) ) {
|
||||
$userid = UIBase::GrabGoodInput('POST', 'userid') ;
|
||||
$pass = UIBase::GrabInput('POST', 'pass') ;
|
||||
}
|
||||
|
||||
if ( $userid != NULL ) {
|
||||
if ( $this->authenticate($userid, $pass) === TRUE )
|
||||
return FALSE ;
|
||||
else
|
||||
$msg = DMsg::Err('err_login') ;
|
||||
}
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
private function updateAccessTime( $secret = NULL )
|
||||
{
|
||||
$_SESSION['lastaccess'] = time() ;
|
||||
if ( isset($secret) ) {
|
||||
$_SESSION['valid'] = TRUE ;
|
||||
$_SESSION['secret'] = $secret ;
|
||||
}
|
||||
}
|
||||
|
||||
private function clear()
|
||||
{
|
||||
session_destroy() ;
|
||||
session_unset() ;
|
||||
$outdated = time() - 3600 * 24 * 30 ;
|
||||
setcookie($this->_id_field, '', $outdated, "/") ;
|
||||
setcookie($this->_pass_field, '', $outdated, "/") ;
|
||||
setcookie(session_name(), '', $outdated, "/") ;
|
||||
}
|
||||
|
||||
private function authenticate( $authUser, $authPass )
|
||||
{
|
||||
$auth = FALSE ;
|
||||
if ( strlen($authUser) && strlen($authPass) ) {
|
||||
$filename = SERVER_ROOT . 'admin/conf/htpasswd' ;
|
||||
$fd = fopen($filename, 'r') ;
|
||||
if ( ! $fd ) {
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
$all = trim(fread($fd, filesize($filename))) ;
|
||||
fclose($fd) ;
|
||||
|
||||
$lines = explode("\n", $all) ;
|
||||
foreach ( $lines as $line ) {
|
||||
list($user, $pass) = explode(':', $line) ;
|
||||
if ( $user == $authUser ) {
|
||||
if ( $pass[0] != '$' )
|
||||
$salt = substr($pass, 0, 2) ;
|
||||
else
|
||||
$salt = substr($pass, 0, 12) ;
|
||||
$encypt = crypt($authPass, $salt) ;
|
||||
if ( $pass == $encypt ) {
|
||||
$auth = TRUE ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $auth ) {
|
||||
$temp = gettimeofday() ;
|
||||
$start = (int) $temp['usec'] ;
|
||||
$secretKey0 = mt_rand() . $start . mt_rand() ;
|
||||
$secretKey1 = mt_rand() . mt_rand() . $start ;
|
||||
|
||||
$domain = $_SERVER['HTTP_HOST'];
|
||||
if ($pos = strpos($domain, ':')) {
|
||||
$domain = substr($domain, 0, $pos);
|
||||
}
|
||||
$secure = !empty($_SERVER['HTTPS']);
|
||||
$httponly = true;
|
||||
|
||||
setcookie($this->_id_field, PMA_blowfish_encrypt($authUser, $secretKey0), 0, "/", $domain, $secure, $httponly) ;
|
||||
setcookie($this->_pass_field, PMA_blowfish_encrypt($authPass, $secretKey1), 0, "/", $domain, $secure, $httponly) ;
|
||||
|
||||
$this->updateAccessTime(array( $secretKey0, $secretKey1 )) ;
|
||||
}
|
||||
else {
|
||||
$this->emailFailedLogin($authUser) ;
|
||||
}
|
||||
|
||||
return $auth ;
|
||||
}
|
||||
|
||||
private function emailFailedLogin( $authUser )
|
||||
{
|
||||
$ip = $_SERVER['REMOTE_ADDR'] ;
|
||||
$url = UIBase::GrabGoodInput('server', 'SCRIPT_URI') ;
|
||||
|
||||
error_log("[WebAdmin Console] Failed Login Attempt - username:$authUser ip:$ip url:$url\n") ;
|
||||
|
||||
$emails = Service::ServiceData(SInfo::DATA_ADMIN_EMAIL) ;
|
||||
if ( $emails != NULL ) {
|
||||
$hostname = gethostbyaddr($ip) ;
|
||||
$date = date("F j, Y, g:i a") ;
|
||||
|
||||
$repl = array( '%%date%%' => $date, '%%authUser%%' => $authUser, '%%ip%%' => $ip,
|
||||
'%%hostname%%' => $hostname, '%%url%%' => $url ) ;
|
||||
|
||||
$subject = DMsg::UIStr('mail_failedlogin') ;
|
||||
$contents = DMsg::UIStr('mail_failedlogin_c', $repl) ;
|
||||
mail($emails, $subject, $contents) ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,961 +0,0 @@
|
||||
<?php
|
||||
|
||||
class CData
|
||||
{
|
||||
private $_type; //{'serv','admin','vh','tp','special'}
|
||||
private $_id;
|
||||
|
||||
private $_root;
|
||||
|
||||
private $_path;
|
||||
private $_xmlpath;
|
||||
|
||||
private $_conferr;
|
||||
|
||||
public function __construct($type, $path, $id=NULL)
|
||||
{
|
||||
$this->_type = $type;
|
||||
$this->_id = $id;
|
||||
$isnew = ($id != NULL && $id[0] == '`');
|
||||
|
||||
if ($type == DInfo::CT_EX) {
|
||||
$this->_path = $path;
|
||||
$this->init_special();
|
||||
}
|
||||
else {
|
||||
$pos = strpos($path, '.xml');
|
||||
if ($pos > 0) {
|
||||
$this->_xmlpath = $path;
|
||||
$this->_path = substr($path, 0, $pos) . '.conf';
|
||||
}
|
||||
else {
|
||||
$pos = strpos($path, '.conf');
|
||||
if ($pos > 0) {
|
||||
$this->_path = $path;
|
||||
$this->_xmlpath = substr($path, 0, $pos) . '.xml';
|
||||
}
|
||||
else {
|
||||
// assume xml format
|
||||
$this->_xmlpath = $path . '.xml'; // forced
|
||||
$this->_path = $path . '.conf';
|
||||
}
|
||||
}
|
||||
$this->init($isnew);
|
||||
}
|
||||
}
|
||||
|
||||
public static function Util_Migrate_AllConf2Xml($SERVER_ROOT)
|
||||
{
|
||||
// will migrate all included vh and tp xml files
|
||||
if ($SERVER_ROOT == '' || trim($SERVER_ROOT) == '')
|
||||
die("Require SERVER_ROOT as input param!");
|
||||
|
||||
error_log("Migrate plain conf to xml from $SERVER_ROOT\n");
|
||||
|
||||
if ( $SERVER_ROOT{-1} != '/' )
|
||||
$SERVER_ROOT .= '/';
|
||||
|
||||
define('SERVER_ROOT', $SERVER_ROOT);
|
||||
|
||||
$servconf = SERVER_ROOT . 'conf/httpd_config.conf';
|
||||
|
||||
$cdata = new CData(DInfo::CT_SERV, $servconf);
|
||||
$cdata->migrate_allconf2xml();
|
||||
|
||||
$adminconf = SERVER_ROOT . 'admin/conf/admin_config.conf';
|
||||
$admindata = new CData(DInfo::CT_ADMIN, $adminconf);
|
||||
$filemap = DPageDef::GetInstance()->GetFileMap(DInfo::CT_ADMIN);
|
||||
$admindata->save_xml_file($admindata->_root, $filemap, $admindata->_xmlpath);
|
||||
$admindata->copy_permission($admindata->_path, $admindata->_xmlpath);
|
||||
error_log("Migration done.\n");
|
||||
}
|
||||
|
||||
public static function Util_Migrate_AllXml2Conf($SERVER_ROOT, $recover_script, $removexml)
|
||||
{
|
||||
// will migrate all included vh and tp xml files
|
||||
if ($SERVER_ROOT == '' || trim($SERVER_ROOT) == '')
|
||||
die("Require SERVER_ROOT as input param!");
|
||||
|
||||
if ($recover_script == '' || trim($recover_script) == '')
|
||||
die("Require recover script as input param!");
|
||||
|
||||
if ($removexml != 1 && $removexml != 0)
|
||||
die("Require removexml as input param with value 1 or 0.");
|
||||
|
||||
error_log("Migrate xml to plain conf under server root $SERVER_ROOT\n");
|
||||
if ( $SERVER_ROOT{-1} != '/' )
|
||||
$SERVER_ROOT .= '/';
|
||||
|
||||
define('SERVER_ROOT', $SERVER_ROOT);
|
||||
|
||||
$servconf = SERVER_ROOT . 'conf/httpd_config.xml';
|
||||
if (!file_exists($servconf)) {
|
||||
die("cannot find xml config file $servconf under server root $SERVER_ROOT\n");
|
||||
}
|
||||
|
||||
$timestamp = date(DATE_RFC2822);
|
||||
$script = "#!/bin/sh
|
||||
|
||||
########################################################################################
|
||||
# xml configuration files (.xml) were migrated to plain configuration (.conf) on $timestamp
|
||||
# If you need to revert back to older versions that based on xml configuration, please manually
|
||||
# run this script to restore the original files.
|
||||
######################################################################################## \n\n";
|
||||
|
||||
if (file_put_contents($recover_script, $script) === FALSE) {
|
||||
die("Failed to write to recover script $recover_script, abort!");
|
||||
}
|
||||
|
||||
define('RECOVER_SCRIPT', $recover_script);
|
||||
|
||||
if ($removexml == 0)
|
||||
define ('SAVE_XML', 1);
|
||||
|
||||
$cdata = new CData(DInfo::CT_SERV, $servconf);
|
||||
|
||||
// migrate admin conf
|
||||
$adminconf = SERVER_ROOT . 'admin/conf/admin_config.xml';
|
||||
$admindata = new CData(DInfo::CT_ADMIN, $adminconf);
|
||||
|
||||
if (defined('RECOVER_SCRIPT')) {
|
||||
chmod(RECOVER_SCRIPT, 0700);
|
||||
error_log("You can recover the migrated xml configuration files from this script " . RECOVER_SCRIPT . "\n");
|
||||
}
|
||||
|
||||
error_log("Migration done.\n");
|
||||
}
|
||||
|
||||
public function GetRootNode()
|
||||
{
|
||||
return $this->_root;
|
||||
}
|
||||
|
||||
public function GetId()
|
||||
{
|
||||
return $this->_id;
|
||||
}
|
||||
|
||||
public function GetType()
|
||||
{
|
||||
return $this->_type;
|
||||
}
|
||||
|
||||
public function GetConfErr()
|
||||
{
|
||||
return $this->_conferr;
|
||||
}
|
||||
|
||||
public function GetChildrenValues($location, $ref='')
|
||||
{
|
||||
$vals = array();
|
||||
$layer = $this->_root->GetChildrenByLoc($location, $ref);
|
||||
if ($layer != NULL) {
|
||||
if (is_array($layer))
|
||||
$vals = array_map('strval', array_keys($layer));
|
||||
else
|
||||
$vals[] = $layer->Get(CNode::FLD_VAL);
|
||||
}
|
||||
return $vals;
|
||||
}
|
||||
|
||||
public function GetChildVal($location, $ref='')
|
||||
{
|
||||
$layer = $this->_root->GetChildrenByLoc($location, $ref);
|
||||
if ($layer != NULL && is_a($layer, 'CNode'))
|
||||
return $layer->Get(CNode::FLD_VAL);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
public function GetChildNodeById($key, $id)
|
||||
{
|
||||
return $this->_root->GetChildNodeById($key, $id);
|
||||
}
|
||||
|
||||
public function SetRootNode($nd)
|
||||
{
|
||||
$this->_root = $nd;
|
||||
$this->_root->SetVal($this->_path);
|
||||
$this->_root->Set(CNode::FLD_TYPE, CNode::T_ROOT);
|
||||
}
|
||||
|
||||
public function SavePost($extractData, $disp)
|
||||
{
|
||||
$tid = $disp->GetLast(DInfo::FLD_TID);
|
||||
if ($this->_type == DInfo::CT_EX)
|
||||
$ref = $disp->GetLast(DInfo::FLD_REF);
|
||||
else
|
||||
$ref = $disp->Get(DInfo::FLD_REF);
|
||||
$tblmap = DPageDef::GetPage($disp)->GetTblMap();
|
||||
$location = $tblmap->FindTblLoc($tid);
|
||||
$this->_root->UpdateChildren($location, $ref, $extractData);
|
||||
|
||||
if (($newref = $extractData->Get(CNode::FLD_VAL)) != NULL)
|
||||
$this->check_integrity($tid, $newref, $disp);
|
||||
|
||||
$this->SaveFile();
|
||||
}
|
||||
|
||||
public function ChangeContextSeq($seq)
|
||||
{
|
||||
$loc = ($this->_type == DInfo::CT_VH) ? 'context' : 'virtualHostConfig:context';
|
||||
if ( ($ctxs = $this->_root->GetChildren($loc)) == NULL)
|
||||
return FALSE;
|
||||
|
||||
if ( !is_array($ctxs) || $seq == -1 || $seq == count($ctxs) )
|
||||
return FALSE;
|
||||
|
||||
if ( $seq > 0 ) {
|
||||
$index = $seq - 1;
|
||||
$switched = $seq;
|
||||
}
|
||||
else {
|
||||
$index = - $seq - 1;
|
||||
$switched = $index - 1;
|
||||
}
|
||||
|
||||
$parent = NULL;
|
||||
$uris = array_keys($ctxs);
|
||||
$temp = $uris[$switched];
|
||||
$uris[$switched] = $uris[$index];
|
||||
$uris[$index] = $temp;
|
||||
|
||||
foreach( $uris as $uri ) {
|
||||
$ctx = $ctxs[$uri];
|
||||
if ($parent == NULL) {
|
||||
$parent = $ctx->Get(CNode::FLD_PARENT);
|
||||
$parent->RemoveChild('context');
|
||||
}
|
||||
$parent->AddChild($ctx);
|
||||
}
|
||||
$this->SaveFile();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
public function DeleteEntry($disp)
|
||||
{
|
||||
$tid = $disp->GetLast(DInfo::FLD_TID);
|
||||
if ($this->_type == DInfo::CT_EX)
|
||||
$ref = $disp->GetLast(DInfo::FLD_REF);
|
||||
else
|
||||
$ref = $disp->Get(DInfo::FLD_REF);
|
||||
$tblmap = DPageDef::GetPage($disp)->GetTblMap();
|
||||
$location = $tblmap->FindTblLoc($tid);
|
||||
|
||||
$layer = $this->_root->GetChildrenByLoc($location, $ref);
|
||||
if ($layer != NULL) {
|
||||
$layer->RemoveFromParent();
|
||||
$this->check_integrity($tid, NULL, $disp);
|
||||
$this->SaveFile();
|
||||
}
|
||||
else {
|
||||
error_log("cannot find delete entry\n");
|
||||
}
|
||||
}
|
||||
|
||||
public function SaveFile()
|
||||
{
|
||||
if ($this->_type == DInfo::CT_EX)
|
||||
return $this->save_special();
|
||||
|
||||
$filemap = DPageDef::GetInstance()->GetFileMap($this->_type); // serv, vh, tp, admin
|
||||
$root = $this->save_conf_file($this->_root, $filemap, $this->_path);
|
||||
|
||||
if (defined('SAVE_XML'))
|
||||
$this->save_xml_file($root, $filemap, $this->_xmlpath);
|
||||
|
||||
}
|
||||
|
||||
private function check_integrity($tid, $newref, $disp)
|
||||
{
|
||||
if ( ($ref = $disp->GetLast(DInfo::FLD_REF)) == NULL || $newref == $ref) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( in_array($tid, array('ADM_L_GENERAL', 'T_TOPD', 'V_TOPD', 'V_BASE', 'L_GENERAL')) ) {
|
||||
$disp->Set(DInfo::FLD_ViewName, $newref);
|
||||
}
|
||||
|
||||
$root = $disp->Get(DInfo::FLD_ConfData)->GetRootNode();
|
||||
|
||||
if (($tid == 'V_BASE' || $tid == 'V_TOPD')
|
||||
&& ($dlayer = $root->GetChildren('listener')) != NULL ) {
|
||||
if (!is_array($dlayer))
|
||||
$dlayer = array($dlayer);
|
||||
|
||||
foreach ($dlayer as $listener) {
|
||||
if ( ($maplayer = $listener->GetChildren('vhmap')) != NULL) {
|
||||
if (!is_array($maplayer))
|
||||
$maplayer = array($maplayer);
|
||||
foreach ($maplayer as $map) {
|
||||
if ($map->Get(CNode::FLD_VAL) == $ref) {
|
||||
if ($newref == NULL) {
|
||||
$map->RemoveFromParent(); // handle delete
|
||||
}
|
||||
else {
|
||||
$map->SetVal($newref);
|
||||
if ($map->GetChildren('vhost') != NULL)
|
||||
$map->SetChildVal('vhost', $newref);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($newref == NULL) // for delete condition, do not auto delete, let user handle
|
||||
return;
|
||||
|
||||
if ($tid == 'L_GENERAL'
|
||||
&& ($dlayer = $root->GetChildren('vhTemplate')) != NULL ) {
|
||||
if (!is_array($dlayer))
|
||||
$dlayer = array($dlayer);
|
||||
|
||||
foreach($dlayer as $templ) {
|
||||
if (($listeners = $templ->GetChildVal('listeners')) != NULL) {
|
||||
$changed = FALSE;
|
||||
$lns = preg_split("/, /", $listeners, -1, PREG_SPLIT_NO_EMPTY);
|
||||
foreach ($lns as $i => $ln) {
|
||||
if ($ln == $ref) {
|
||||
$lns[$i] = $newref;
|
||||
$changed = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($changed) {
|
||||
$listeners = implode(', ', $lns);
|
||||
$templ->SetChildVal('listeners', $listeners);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (strncmp($tid, 'A_EXT_', 6) == 0 ) {
|
||||
$disp_view = $disp->Get(DInfo::FLD_View);
|
||||
$loc = ($disp_view == DInfo::CT_TP) ? 'virtualHostConfig:scripthandler:addsuffix' : 'scripthandler:addsuffix';
|
||||
if (($dlayer = $root->GetChildren($loc)) != NULL) {
|
||||
if (!is_array($dlayer))
|
||||
$dlayer = array($dlayer);
|
||||
|
||||
foreach ($dlayer as $sh) {
|
||||
if ($sh->GetChildVal('handler') == $ref)
|
||||
$sh->SetChildVal('handler', $newref);
|
||||
}
|
||||
}
|
||||
|
||||
if ( $disp_view != DInfo::CT_SERV ) {
|
||||
$loc = ($disp_view == DInfo::CT_TP) ? 'virtualHostConfig:context' : 'context';
|
||||
if (($dlayer = $root->GetChildren($loc)) != NULL) {
|
||||
if (!is_array($dlayer))
|
||||
$dlayer = array($dlayer);
|
||||
|
||||
foreach ($dlayer as $ctx) {
|
||||
if ($ctx->GetChildVal('authorizer') == $ref)
|
||||
$ctx->SetChildVal('authorizer', $newref);
|
||||
if ($ctx->GetChildVal('handler') == $ref)
|
||||
$ctx->SetChildVal('handler', $newref);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
elseif (strpos($tid, '_REALM_')) { //'T_REALM_FILE','V_REALM_FILE','VT_REALM_LDAP'
|
||||
$loc = ($disp->Get(DInfo::FLD_View) == DInfo::CT_TP) ? 'virtualHostConfig:context' : 'context';
|
||||
if (($dlayer = $root->GetChildren($loc)) != NULL) {
|
||||
if (!is_array($dlayer))
|
||||
$dlayer = array($dlayer);
|
||||
|
||||
foreach ($dlayer as $ctx) {
|
||||
if ($ctx->GetChildVal('realm') == $ref)
|
||||
$ctx->SetChildVal('realm', $newref);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function save_conf_file($root, $filemap, $filepath)
|
||||
{
|
||||
$convertedroot = $root->DupHolder();
|
||||
$filemap->Convert(1, $root, 1, $convertedroot);
|
||||
|
||||
$confbuf = '';
|
||||
$this->before_write_conf($convertedroot);
|
||||
$convertedroot->PrintBuf($confbuf);
|
||||
$this->write_file($filepath, $confbuf);
|
||||
return $convertedroot;
|
||||
}
|
||||
|
||||
private function save_xml_file($root, $filemap, $filepath)
|
||||
{
|
||||
$this->before_write_xml($root);
|
||||
$xmlroot = $root->DupHolder();
|
||||
$filemap->Convert(1, $root, 0, $xmlroot);
|
||||
|
||||
$xmlbuf = '';
|
||||
$xmlroot->PrintXmlBuf($xmlbuf);
|
||||
$this->write_file($filepath, $xmlbuf);
|
||||
return $xmlroot;
|
||||
}
|
||||
|
||||
private function before_write_conf($root)
|
||||
{
|
||||
if ($this->_type == DInfo::CT_SERV && ($listeners = $root->GetChildren('listener')) != NULL) {
|
||||
if (!is_array($listeners))
|
||||
$listeners = array($listeners);
|
||||
foreach ($listeners as $l) {
|
||||
if (($maps = $l->GetChildren('vhmap')) != NULL) {
|
||||
if (!is_array($maps))
|
||||
$maps = array($maps);
|
||||
foreach ($maps as $map) {
|
||||
$vn = $map->Get(CNode::FLD_VAL);
|
||||
$domain = $map->GetChildVal('domain');
|
||||
$l->AddChild(new CNode('map', "$vn $domain"));
|
||||
}
|
||||
$l->RemoveChild('vhmap');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$loc = ($this->_type == DInfo::CT_TP) ? 'virtualHostConfig:scripthandler' : 'scripthandler';
|
||||
if ( ($sh = $root->GetChildren($loc)) != NULL) {
|
||||
if (($shc = $sh->GetChildren('addsuffix')) != NULL) {
|
||||
if (!is_array($shc))
|
||||
$shc = array($shc);
|
||||
foreach ($shc as $shcv) {
|
||||
$suffix = $shcv->Get(CNode::FLD_VAL);
|
||||
$type = $shcv->GetChildVal('type');
|
||||
$handler = $shcv->GetChildVal('handler');
|
||||
$sh->AddChild(new CNode('add', "$type:$handler $suffix"));
|
||||
}
|
||||
$sh->RemoveChild('addsuffix');
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->_type == DInfo::CT_TP) {
|
||||
$vhconf = $root->GetChildVal('configFile');
|
||||
if (($pos = strpos($vhconf, '.xml')) > 0) {
|
||||
$vhconf = substr($vhconf, 0, $pos) . '.conf';
|
||||
$root->SetChildVal('configFile', $vhconf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function before_write_xml($root)
|
||||
{
|
||||
if ( $this->_type == DInfo::CT_SERV ) {
|
||||
if (($listeners = $root->GetChildren('listener')) != NULL) {
|
||||
if (!is_array($listeners))
|
||||
$listeners = array($listeners);
|
||||
foreach ($listeners as $l) {
|
||||
if (($maps = $l->GetChildren('map')) != NULL) {
|
||||
if (!is_array($maps))
|
||||
$maps = array($maps);
|
||||
foreach ($maps as $map) {
|
||||
$mapval = $map->Get(CNode::FLD_VAL);
|
||||
if (($pos = strpos($mapval, ' ')) > 0) {
|
||||
$vn = substr($mapval, 0, $pos);
|
||||
$domain = trim(substr($mapval, $pos + 1));
|
||||
$anode = new CNode('vhmap', $vn);
|
||||
$anode->AddChild(new CNode('vhost', $vn));
|
||||
$anode->AddChild(new CNode('domain', $domain));
|
||||
$l->AddChild($anode);
|
||||
}
|
||||
}
|
||||
$l->RemoveChild('map');
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($root->GetChildren('adminRoot') == NULL) {
|
||||
// backward compatible
|
||||
$root->AddChild(new CNode('adminRoot', '$SERVER_ROOT/admin/'));
|
||||
}
|
||||
elseif ($root->GetChildVal('adminRoot') == NULL) {
|
||||
$root->SetChildVal('adminRoot', '$SERVER_ROOT/admin/');
|
||||
}
|
||||
|
||||
if (($vhosts = $root->GetChildren('virtualhost')) != NULL) {
|
||||
if (!is_array($vhosts))
|
||||
$vhosts = array($vhosts);
|
||||
foreach ($vhosts as $vh) {
|
||||
$vhconf = $vh->GetChildVal('configFile');
|
||||
if (($pos = strpos($vhconf, '.conf')) > 0) {
|
||||
$vhconf = substr($vhconf, 0, $pos) . '.xml';
|
||||
$vh->SetChildVal('configFile', $vhconf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// migrate all tp.xml
|
||||
if (($tps = $root->GetChildren('vhTemplate')) != NULL) {
|
||||
if (!is_array($tps))
|
||||
$tps = array($tps);
|
||||
foreach ($tps as $tp) {
|
||||
$tpconf = $tp->GetChildVal('templateFile');
|
||||
if (($pos = strpos($tpconf, '.conf')) > 0) {
|
||||
$tpconf = substr($tpconf, 0, $pos) . '.xml';
|
||||
$tp->SetChildVal('templateFile', $tpconf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$loc = ($this->_type == DInfo::CT_TP) ? 'virtualHostConfig:scripthandler' : 'scripthandler';
|
||||
if ( ($sh = $root->GetChildren($loc)) != NULL) {
|
||||
if (($shc = $sh->GetChildren('add')) != NULL) {
|
||||
if (!is_array($shc))
|
||||
$shc = array($shc);
|
||||
foreach ($shc as $shcv) {
|
||||
$typeval = $shcv->Get(CNode::FLD_VAL);
|
||||
if (preg_match("/^(\w+):(\S+)\s+(.+)$/", $typeval, $m)) {
|
||||
$anode = new CNode('addsuffix', $m[3]);
|
||||
$anode->AddChild(new CNode('suffix', $m[3]));
|
||||
$anode->AddChild(new CNode('type', $m[1]));
|
||||
$anode->AddChild(new CNode('handler', $m[2]));
|
||||
$sh->AddChild($anode);
|
||||
}
|
||||
}
|
||||
$sh->RemoveChild('add');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($this->_type == DInfo::CT_TP) {
|
||||
$vhconf = $root->GetChildVal('configFile');
|
||||
if (($pos = strpos($vhconf, '.conf')) > 0) {
|
||||
$vhconf = substr($vhconf, 0, $pos) . '.xml';
|
||||
$root->SetChildVal('configFile', $vhconf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function after_read()
|
||||
{
|
||||
if ($this->_type == DInfo::CT_SERV) {
|
||||
$serverName = $this->_root->GetChildVal('serverName');
|
||||
if ($serverName == '$HOSTNAME' || $serverName == '') {
|
||||
$serverName = php_uname('n');
|
||||
}
|
||||
$this->_id = $serverName;
|
||||
|
||||
$runningAs = 'user('. $this->_root->GetChildVal('user') .
|
||||
') : group(' . $this->_root->GetChildVal('group') .')' ;
|
||||
$this->_root->AddChild(new CNode('runningAs', $runningAs));
|
||||
}
|
||||
|
||||
if ($this->_type == DInfo::CT_SERV || $this->_type == DInfo::CT_ADMIN) {
|
||||
if ( ($listeners = $this->_root->GetChildren('listener')) != NULL) {
|
||||
if (!is_array($listeners))
|
||||
$listeners = array($listeners);
|
||||
foreach ($listeners as $l) {
|
||||
$addr = $l->GetChildVal('address');
|
||||
if ( $pos = strrpos($addr,':') ) {
|
||||
$ip = substr($addr, 0, $pos);
|
||||
if ( $ip == '*' )
|
||||
$ip = 'ANY';
|
||||
$l->AddChild(new CNode('ip', $ip));
|
||||
$l->AddChild(new CNode('port', substr($addr, $pos+1)));
|
||||
}
|
||||
if (($maps = $l->GetChildren('map')) != NULL) {
|
||||
if (!is_array($maps))
|
||||
$maps = array($maps);
|
||||
foreach ($maps as $map) {
|
||||
$mapval = $map->Get(CNode::FLD_VAL);
|
||||
if (($pos = strpos($mapval, ' ')) > 0) {
|
||||
$vn = substr($mapval, 0, $pos);
|
||||
$domain = trim(substr($mapval, $pos + 1));
|
||||
$anode = new CNode('vhmap', $vn);
|
||||
$anode->AddChild(new CNode('vhost', $vn));
|
||||
$anode->AddChild(new CNode('domain', $domain));
|
||||
$l->AddChild($anode);
|
||||
}
|
||||
}
|
||||
$l->RemoveChild('map');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($this->_type == DInfo::CT_VH || $this->_type == DInfo::CT_TP) {
|
||||
$loc = ($this->_type == DInfo::CT_VH) ? 'context' : 'virtualHostConfig:context';
|
||||
if ( ($ctxs = $this->_root->GetChildren($loc)) != NULL) {
|
||||
if (!is_array($ctxs))
|
||||
$ctxs = array($ctxs);
|
||||
$order = 1;
|
||||
foreach ($ctxs as $ctx) {
|
||||
$ctx->AddChild(new CNode('order', $order++));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$loc = ($this->_type == DInfo::CT_TP) ? 'virtualHostConfig:scripthandler' : 'scripthandler';
|
||||
if ( ($sh = $this->_root->GetChildren($loc)) != NULL) {
|
||||
if (($shc = $sh->GetChildren('add')) != NULL) {
|
||||
if (!is_array($shc))
|
||||
$shc = array($shc);
|
||||
foreach ($shc as $shcv) {
|
||||
$typeval = $shcv->Get(CNode::FLD_VAL);
|
||||
if (preg_match("/^(\w+):(\S+)\s+(.+)$/", $typeval, $m)) {
|
||||
$anode = new CNode('addsuffix', $m[3]);
|
||||
$anode->AddChild(new CNode('suffix', $m[3]));
|
||||
$anode->AddChild(new CNode('type', $m[1]));
|
||||
$anode->AddChild(new CNode('handler', $m[2]));
|
||||
$sh->AddChild($anode);
|
||||
}
|
||||
|
||||
}
|
||||
$sh->RemoveChild('add');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private function init($isnew)
|
||||
{
|
||||
if ($isnew) {
|
||||
if ( !file_exists($this->_path) && ! PathTool::createFile($this->_path, $err) ) {
|
||||
$this->_conferr = 'Failed to create config file at ' . $this->_path;
|
||||
return FALSE;
|
||||
}
|
||||
else {
|
||||
$this->_root = new CNode(CNode::K_ROOT, $this->_path, CNode::T_ROOT);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!file_exists($this->_path) || filesize($this->_path) < 10) {
|
||||
|
||||
if ($this->_type == DInfo::CT_SERV) {
|
||||
if (file_exists($this->_xmlpath) && !$this->migrate_allxml2conf())
|
||||
return FALSE;
|
||||
else {
|
||||
$this->_conferr = 'Failed to find config file at ' . $this->_path;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (file_exists($this->_xmlpath)) {
|
||||
if (!$this->migrate_xml2conf())
|
||||
return FALSE;
|
||||
}
|
||||
else {// treat as new vh or tp
|
||||
$this->_root = new CNode(CNode::K_ROOT, $this->_path, CNode::T_ROOT);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$parser = new PlainConfParser();
|
||||
$this->_root = $parser->Parse($this->_path);
|
||||
if ($this->_root->HasFatalErr()) {
|
||||
$this->_conferr = $this->_root->GetErr();
|
||||
error_log("fatel err " . $this->_root->GetErr());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->after_read();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
private function init_special()
|
||||
{
|
||||
$lines = file($this->_path);
|
||||
if ( $lines === FALSE ) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->_root = new CNode(CNode::K_ROOT, $this->_id, CNode::T_ROOT);
|
||||
$items = array();
|
||||
|
||||
if ($this->_id == 'MIME') {
|
||||
foreach( $lines as $line ) {
|
||||
if ( ($c = strpos($line, '=')) > 0 ) {
|
||||
$suffix = trim(substr($line, 0, $c));
|
||||
$type = trim(substr($line, $c+1 ));
|
||||
$m = new CNode('index', $suffix);
|
||||
$m->AddChild(new CNode('suffix', $suffix));
|
||||
$m->AddChild(new CNode('type', $type));
|
||||
$items[$suffix] = $m;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
elseif ( $this->_id == 'ADMUSR' || $this->_id == 'V_UDB') {
|
||||
foreach( $lines as $line ) {
|
||||
$parsed = explode(':',trim($line));
|
||||
$size = count($parsed);
|
||||
if($size == 2 || $size ==3) {
|
||||
$name = trim($parsed[0]);
|
||||
$pass = trim($parsed[1]);
|
||||
if ($name != '' && $pass != '') {
|
||||
$u = new CNode('index', $name);
|
||||
$u->AddChild(new CNode('name', $name));
|
||||
$u->AddChild(new CNode('passwd', $pass));
|
||||
if ($size == 3 && (($group = trim($parsed[2])) != '')) {
|
||||
$u->AddChild(new CNode('group', $group));
|
||||
}
|
||||
$items[$name] = $u;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($this->_id == 'V_GDB') {
|
||||
foreach( $lines as $line ) {
|
||||
$parsed = explode(':',trim($line));
|
||||
if (count($parsed) == 2) {
|
||||
$group = trim($parsed[0]);
|
||||
$users = trim($parsed[1]);
|
||||
if ($group != '') {
|
||||
$g = new CNode('index', $group);
|
||||
$g->AddChild(new CNode('name', $group));
|
||||
$g->AddChild(new CNode('users', $users));
|
||||
$items[$group] = $g;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ksort($items, SORT_STRING);
|
||||
reset($items);
|
||||
foreach( $items as $item ) {
|
||||
$this->_root->AddChild($item);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
private function save_special()
|
||||
{
|
||||
$fd = fopen($this->_path, 'w');
|
||||
if ( !$fd ) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$items = $this->_root->GetChildren('index');
|
||||
|
||||
if ($items != NULL) {
|
||||
if (is_array($items)) {
|
||||
ksort($items, SORT_STRING);
|
||||
reset($items);
|
||||
}
|
||||
else
|
||||
$items = array($items);
|
||||
|
||||
foreach ($items as $key => $item) {
|
||||
$line = '';
|
||||
if ($this->_id == 'MIME') {
|
||||
$line = str_pad($key, 8) . ' = ' . $item->GetChildVal('type') . "\n";
|
||||
}
|
||||
elseif ($this->_id == 'ADMUSR' || $this->_id == 'V_UDB') {
|
||||
$line = $item->GetChildVal('name') . ':' . $item->GetChildVal('passwd');
|
||||
$group = $item->GetChildVal('group');
|
||||
if ($group != NULL)
|
||||
$line .= ':' . $group;
|
||||
$line .= "\n";
|
||||
}
|
||||
else if ($this->_id == 'V_GDB') {
|
||||
$line = $key . ':' . $item->GetChildVal('users') . "\n";
|
||||
}
|
||||
fputs( $fd, $line );
|
||||
}
|
||||
}
|
||||
fclose($fd);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
private function migrate_xml2conf()
|
||||
{
|
||||
error_log("Migrating $this->_xmlpath \n");
|
||||
$xmlparser = new XmlParser();
|
||||
$xmlroot = $xmlparser->Parse($this->_xmlpath);
|
||||
if ($xmlroot->HasFatalErr()) {
|
||||
$this->_conferr = $xmlroot->Get(CNode::FLD_ERR);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$root = $xmlroot->DupHolder();
|
||||
$filemap = DPageDef::GetInstance()->GetFileMap($this->_type); // serv, vh, tp, admin
|
||||
$filemap->Convert(0, $xmlroot, 1, $root);
|
||||
|
||||
$buf = '';
|
||||
$this->before_write_conf($root);
|
||||
$root->PrintBuf($buf);
|
||||
touch($this->_path);
|
||||
|
||||
$this->write_file($this->_path, $buf);
|
||||
$this->copy_permission($this->_xmlpath, $this->_path);
|
||||
|
||||
$migrated = $this->_xmlpath . '.migrated.' . time();
|
||||
if (defined('SAVE_XML')) {
|
||||
copy($this->_xmlpath, $migrated);
|
||||
}
|
||||
else {
|
||||
rename($this->_xmlpath, $migrated);
|
||||
}
|
||||
|
||||
if (defined('RECOVER_SCRIPT')) {
|
||||
file_put_contents(RECOVER_SCRIPT, "mv $migrated $this->_xmlpath\n", FILE_APPEND);
|
||||
}
|
||||
error_log(" converted $this->_xmlpath to $this->_path\n\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
private function copy_permission($fromfile, $tofile)
|
||||
{
|
||||
$owner = fileowner($fromfile);
|
||||
if (fileowner($tofile) != $owner)
|
||||
chown($tofile, $owner);
|
||||
$perm = fileperms($fromfile);
|
||||
if (fileperms($tofile) != $perm)
|
||||
chmod($tofile, $perm);
|
||||
}
|
||||
|
||||
private function migrate_allxml2conf()
|
||||
{
|
||||
error_log("Migrating all config from server xml config $this->_xmlpath \n");
|
||||
$xmlparser = new XmlParser();
|
||||
$xmlroot = $xmlparser->Parse($this->_xmlpath);
|
||||
if ($xmlroot->HasFatalErr()) {
|
||||
$this->_conferr = $xmlroot->Get(CNode::FLD_ERR);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$root = $xmlroot->DupHolder();
|
||||
$filemap = DPageDef::GetInstance()->GetFileMap(DInfo::CT_SERV); // serv, vh, tp, admin
|
||||
$filemap->Convert(0, $xmlroot, 1, $root);
|
||||
|
||||
// migrate all vh.xml
|
||||
if (($vhosts = $root->GetChildren('virtualhost')) != NULL) {
|
||||
if (!is_array($vhosts))
|
||||
$vhosts = array($vhosts);
|
||||
foreach ($vhosts as $vh) {
|
||||
$vhname = $vh->Get(CNode::FLD_VAL);
|
||||
$vhroot = $vh->GetChildVal('vhRoot');
|
||||
$vhconf = $vh->GetChildVal('configFile');
|
||||
$conffile = PathTool::GetAbsFile($vhconf, 'VR', $vhname, $vhroot);
|
||||
$vhdata = new CData(DInfo::CT_VH, $conffile);
|
||||
if (($pos = strpos($vhconf, '.xml')) > 0) {
|
||||
$vhconf = substr($vhconf, 0, $pos) . '.conf';
|
||||
$vh->SetChildVal('configFile', $vhconf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// migrate all tp.xml
|
||||
if (($tps = $root->GetChildren('vhTemplate')) != NULL) {
|
||||
if (!is_array($tps))
|
||||
$tps = array($tps);
|
||||
foreach ($tps as $tp) {
|
||||
$tpconf = $tp->GetChildVal('templateFile');
|
||||
$conffile = PathTool::GetAbsFile($tpconf, 'SR');
|
||||
$tpdata = new CData(DInfo::CT_TP, $conffile);
|
||||
if (($pos = strpos($tpconf, '.xml')) > 0) {
|
||||
$tpconf = substr($tpconf, 0, $pos) . '.conf';
|
||||
$tp->SetChildVal('templateFile', $tpconf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$buf = '';
|
||||
$this->before_write_conf($root);
|
||||
$root->PrintBuf($buf);
|
||||
touch($this->_path);
|
||||
|
||||
$this->write_file($this->_path, $buf);
|
||||
$this->copy_permission($this->_xmlpath, $this->_path);
|
||||
|
||||
$migrated = $this->_xmlpath . '.migrated.' . time();
|
||||
|
||||
if (defined('SAVE_XML')) {
|
||||
copy($this->_xmlpath, $migrated);
|
||||
}
|
||||
else {
|
||||
rename($this->_xmlpath, $migrated);
|
||||
}
|
||||
if (defined('RECOVER_SCRIPT')) {
|
||||
file_put_contents(RECOVER_SCRIPT, "mv $migrated $this->_xmlpath\n", FILE_APPEND);
|
||||
}
|
||||
|
||||
error_log(" converted $this->_xmlpath to $this->_path\n\n");
|
||||
}
|
||||
|
||||
private function migrate_allconf2xml()
|
||||
{
|
||||
if (($vhosts = $this->_root->GetChildren('virtualhost')) != NULL) {
|
||||
if (!is_array($vhosts))
|
||||
$vhosts = array($vhosts);
|
||||
$filemap = DPageDef::GetInstance()->GetFileMap(DInfo::CT_VH);
|
||||
foreach ($vhosts as $vh) {
|
||||
$vhname = $vh->Get(CNode::FLD_VAL);
|
||||
$vhroot = $vh->GetChildVal('vhRoot');
|
||||
$vhconf = $vh->GetChildVal('configFile');
|
||||
$conffile = PathTool::GetAbsFile($vhconf, 'VR', $vhname, $vhroot);
|
||||
$vhdata = new CData(DInfo::CT_VH, $conffile);
|
||||
$this->save_xml_file($vhdata->_root, $filemap, $vhdata->_xmlpath);
|
||||
$this->copy_permission($vhdata->_path, $vhdata->_xmlpath);
|
||||
error_log(" converted $vhdata->_path to $vhdata->_xmlpath\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (($tps = $this->_root->GetChildren('vhTemplate')) != NULL) {
|
||||
if (!is_array($tps))
|
||||
$tps = array($tps);
|
||||
$filemap = DPageDef::GetInstance()->GetFileMap(DInfo::CT_TP);
|
||||
foreach ($tps as $tp) {
|
||||
$tpconf = $tp->GetChildVal('templateFile');
|
||||
$conffile = PathTool::GetAbsFile($tpconf, 'SR');
|
||||
$tpdata = new CData(DInfo::CT_TP, $conffile);
|
||||
$this->save_xml_file($tpdata->_root, $filemap, $tpdata->_xmlpath);
|
||||
$this->copy_permission($tpdata->_path, $tpdata->_xmlpath);
|
||||
error_log(" converted $tpdata->_path to $tpdata->_xmlpath\n");
|
||||
}
|
||||
}
|
||||
|
||||
$filemap = DPageDef::GetInstance()->GetFileMap(DInfo::CT_SERV);
|
||||
$this->save_xml_file($this->_root, $filemap, $this->_xmlpath);
|
||||
$this->copy_permission($this->_path, $this->_xmlpath);
|
||||
error_log(" converted $this->_path to $this->_xmlpath\n");
|
||||
}
|
||||
|
||||
|
||||
private function write_file($filepath, $buf)
|
||||
{
|
||||
if (!file_exists($filepath)) {
|
||||
// new file, check path exists
|
||||
if (!PathTool::createFile("{$filepath}.new", $err)) {
|
||||
error_log("failed to create file $filepath : $err \n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
$fd = fopen("{$filepath}.new", 'w');
|
||||
if ( !$fd ) {
|
||||
error_log("failed to open in write mode for {$filepath}.new");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(fwrite($fd, $buf) === FALSE) {
|
||||
error_log("failed to write temp config for {$filepath}.new");
|
||||
return FALSE;
|
||||
}
|
||||
fclose($fd);
|
||||
|
||||
@unlink("{$filepath}.bak");
|
||||
if(file_exists($filepath) && !rename($filepath, "{$filepath}.bak")) {
|
||||
error_log("failed to rename {$filepath} to {$filepath}.bak");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!rename("{$filepath}.new", $filepath)) {
|
||||
error_log("failed to rename {$filepath}.new to {$filepath}");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||