diff --git a/Makefile.in b/Makefile.in index 022b9aa1d..a297bbdde 100644 --- a/Makefile.in +++ b/Makefile.in @@ -558,7 +558,7 @@ distcheck: dist *.zip*) \ unzip $(distdir).zip ;;\ esac - chmod -R a-w $(distdir); chmod u+w $(distdir) + chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) diff --git a/configure b/configure index 2734e2d1e..87cbac654 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for openlitespeed 1.2.4. +# Generated by GNU Autoconf 2.69 for openlitespeed 1.2.5. # # Report bugs to . # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='openlitespeed' PACKAGE_TARNAME='openlitespeed' -PACKAGE_VERSION='1.2.4' -PACKAGE_STRING='openlitespeed 1.2.4' +PACKAGE_VERSION='1.2.5' +PACKAGE_STRING='openlitespeed 1.2.5' PACKAGE_BUGREPORT='info@litespeedtech.com' PACKAGE_URL='http://www.litespeedtech.com/' @@ -745,6 +745,7 @@ with_email enable_adminssl enable_spdy enable_debug +enable_profiling enable_rpath with_libdir with_zlib @@ -1306,7 +1307,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures openlitespeed 1.2.4 to adapt to many kinds of systems. +\`configure' configures openlitespeed 1.2.5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1372,7 +1373,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of openlitespeed 1.2.4:";; + short | recursive ) echo "Configuration of openlitespeed 1.2.5:";; esac cat <<\_ACEOF @@ -1391,6 +1392,8 @@ Optional Features: --enable-spdy Enable SPDY over HTTPS (Spdy is disabled by default) --enable-debug Enable debugging symbols (Debug is disabled by default) + --enable-profiling Enable cpu profiling (profiling is disabled by + default) --disable-rpath Disable rpath (It is 'no' by default) Optional Packages: @@ -1492,7 +1495,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -openlitespeed configure 1.2.4 +openlitespeed configure 1.2.5 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2129,7 +2132,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by openlitespeed $as_me 1.2.4, which was +It was created by openlitespeed $as_me 1.2.5, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2956,7 +2959,7 @@ fi # Define the identity of the package. PACKAGE='openlitespeed' - VERSION='1.2.4' + VERSION='1.2.5' # Some tools Automake needs. @@ -5149,12 +5152,26 @@ if test "${enable_debug+set}" = set; then : CFLAGS="-g -O3" CXXFLAGS="-g -O3" fi - echo "OPENLSWS_DEBUG='$OPENLSWS_DEBUG' CFLAGS='$CFLAGS'" + echo "OPENLSWS_DEBUG='$OPENLSWS_DEBUG'" fi + +# Check whether --enable-profiling was given. +if test "${enable_profiling+set}" = set; then : + enableval=$enable_profiling; OPENLSWS_PROF="$enableval" + if test "$OPENLSWS_PROF" = "yes" ; then + CFLAGS="$CFLAGS -pg" + CXXFLAGS="$CXXFLAGS -pg" + fi + echo "OPENLSWS_PROF='$OPENLSWS_PROF'" + +fi + + CFLAGS="$CFLAGS -fstack-protector" CXXFLAGS="$CXXFLAGS -fstack-protector" +echo "Final CFLAGS='$CFLAGS' CXXFLAGS='$CXXFLAGS'" # Check whether --enable-rpath was given. if test "${enable_rpath+set}" = set; then : @@ -7616,7 +7633,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by openlitespeed $as_me 1.2.4, which was +This file was extended by openlitespeed $as_me 1.2.5, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -7683,7 +7700,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -openlitespeed config.status 1.2.4 +openlitespeed config.status 1.2.5 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.in b/configure.in index 6c32439da..f1e389a94 100644 --- a/configure.in +++ b/configure.in @@ -5,8 +5,8 @@ m4_include(ax_lib_expat.m4) dnl Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) -AC_INIT([openlitespeed],[1.2.4],[info@litespeedtech.com],[openlitespeed],[http://www.litespeedtech.com/]) -AM_INIT_AUTOMAKE([1.2.4 foreign no-define ]) +AC_INIT([openlitespeed],[1.2.5],[info@litespeedtech.com],[openlitespeed],[http://www.litespeedtech.com/]) +AM_INIT_AUTOMAKE([1.2.5 foreign no-define ]) AM_CONFIG_HEADER(src/config.h:src/config.h.in) @@ -96,11 +96,24 @@ AC_ARG_ENABLE([debug], CFLAGS="-g -O3" CXXFLAGS="-g -O3" fi - echo "OPENLSWS_DEBUG='$OPENLSWS_DEBUG' CFLAGS='$CFLAGS'" + 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'" + ], []) + CFLAGS="$CFLAGS -fstack-protector" CXXFLAGS="$CXXFLAGS -fstack-protector" - +echo "Final CFLAGS='$CFLAGS' CXXFLAGS='$CXXFLAGS'" + AC_ARG_ENABLE([rpath], [AC_HELP_STRING([--disable-rpath], [Disable rpath (It is 'no' by default)])], diff --git a/dist/VERSION b/dist/VERSION index e8ea05db8..c813fe116 100644 --- a/dist/VERSION +++ b/dist/VERSION @@ -1 +1 @@ -1.2.4 +1.2.5 diff --git a/dist/admin/html.open/classes/ows/DATTR_HELP_inc.php b/dist/admin/html.open/classes/ows/DATTR_HELP_inc.php index 115bb7286..66e16f41b 100644 --- a/dist/admin/html.open/classes/ows/DATTR_HELP_inc.php +++ b/dist/admin/html.open/classes/ows/DATTR_HELP_inc.php @@ -242,6 +242,7 @@ $this->db['sname'] = new DATTR_HELP_ITEM('Name - Server', 'The unique name that identifies this server. This is the "Server Name" specified in the general configuration.', '', '', ''); $this->db['sndBufSize'] = new DATTR_HELP_ITEM('Send Buffer Size', 'The sending buffer size of each TCP socket. Set to 0 to use the default buffer size of the operating system. 65535 is the maximum allowed buffer size.', '[Performance] If your web site serves large static files, increase the send buffer size to improve performance.', 'Integer number', ''); $this->db['softLimit'] = new DATTR_HELP_ITEM('Connection Soft Limit', 'Specifies the soft limit of concurrent connections allowed from one IP. This soft limit can be exceeded temporarily during "Grace Period (sec)" as long as the number is below the "Connection Hard Limit", but Keep-Alive connections will be closed as soon as possible until the number of connections is lower than the limit. If number of connections is still over the limit after the "Grace Period (sec)", that IP will be blocked for the "Banned Period (sec)".

For example, if a page contains many small graphs, the browser may try to set up many connections at same time, especially for HTTP/1.0 clients. You would want to allow those connections for a short period.

HTTP/1.1 clients may also set up multiple connections to speed up downloading and SSL requires separate connections from non-SSL connections. Make sure the limit is set properly, as not to adversely affect normal service. The recommended limit is between 5 and 10.', '[Security] A lower number will enable serving more distinct clients.
[Security] Trusted IPs or sub-networks are not affected.
[Performance] Set to a high value when you are performing benchmark tests with a large number of concurrent client machines.', 'Integer number', ''); + $this->db['spdyAdHeader'] = new DATTR_HELP_ITEM('SPDY Advertisement', 'Specifies whether to advertise to clients that SPDY protocol is available. If set, LSWS will send an Alternate-Protocol response header when a client accesses SPDY-enabled websites through an HTTP connection. This requires the website to have both HTTP and HTTPS connections set up, and SPDY support enabled.', '', 'port:protocol string', 'If SPDY/3 is enabled on port 443, you can set the string to "443:npn-spdy/3"'); $this->db['sslCert'] = new DATTR_HELP_ITEM('SSL Private Key & Certificate', 'Every SSL listener requires a paired SSL private key and SSL certificate. Multiple SSL listeners can share the same key and certificate. You can generate SSL private keys yourself using an SSL software package, such as OpenSSL. SSL certificates can also be purchased from an authorized certificate issuer like VeriSign or Thawte. You can also sign the certificate yourself. That certificate will not be trusted by web browsers and should not be used on public web sites containing critical data. However, a self-signed certificate is good enough for internal use, e.g. for encrypting traffic to LiteSpeed Web Server's WebAdmin console.', '', '', ''); $this->db['sslOCSP'] = new DATTR_HELP_ITEM('OCSP Stapling', 'Online Certificate Status Protocol (OCSP) is a more efficient method of checking whether a digital certificate is valid. It works by communicating with another server — the OCSP responder — to get verification that the certificate is valid instead of checking through certificate revocation lists (CRL). OCSP stapling is a further improvement on this protocol, allowing the server to check with the OCSP responder at regular intervals instead of every time a certificate is requested. See the OCSP Wikipedia page for more details.', '', '', ''); $this->db['sslProtocol'] = new DATTR_HELP_ITEM('SSL Protocol Version', 'Specifies which version of SSL protocol will be used. You can choose from SSL v3.0 and TLS v1.0. Since OpenSSL 1.0.1, TLS v1.1 and TLS v1.2 are also supported.', '', '', ''); diff --git a/dist/admin/html.open/classes/ows/DPageDef.php b/dist/admin/html.open/classes/ows/DPageDef.php index 8ddda75d6..18ffa8805 100644 --- a/dist/admin/html.open/classes/ows/DPageDef.php +++ b/dist/admin/html.open/classes/ows/DPageDef.php @@ -75,7 +75,7 @@ protected function add_FilePage_vh() $pages = array(); $pages[] = new DFileSect( array( - 'VH_GENERAL', 'VH_LOG', 'VH_ACLOG', 'VH_INDXF', 'VH_ERRPG', + 'VH_GENERAL', 'VH_LOG', 'VH_ACLOG', 'VH_INDXF', 'VH_ERRPG', 'A_SCRIPT', 'VH_EXPIRES', 'A_SECAC', 'VH_REALM_SEL', 'A_EXT_SEL', 'VH_CTX_SEL', diff --git a/dist/admin/html.open/classes/ows/DTblDef.php b/dist/admin/html.open/classes/ows/DTblDef.php index 0c0d1319d..894766845 100644 --- a/dist/admin/html.open/classes/ows/DTblDef.php +++ b/dist/admin/html.open/classes/ows/DTblDef.php @@ -266,6 +266,7 @@ protected function loadCommonAttrs() 'vh_maxKeepAliveReq' => new DAttr('maxKeepAliveReq', 'uint', 'Max Keep-Alive Requests', 'text', true, 0, 32767, NULL, 0, 'vhMaxKeepAliveReq'), 'vh_smartKeepAlive' => new DAttr('smartKeepAlive', 'bool', 'Smart Keep-Alive', 'radio', true, NULL, NULL, NULL, 0, 'vhSmartKeepAlive'), 'vh_enableGzip' => new DAttr('enableGzip', 'bool', 'Enable GZIP Compression', 'radio'), + 'vh_spdyAdHeader' => new DAttr('spdyAdHeader', 'parse', 'SPDY Advertisement', 'text', true, "/^\d+:npn-spdy\/[23]$/", 'required format: ssl_port:npn-spdy/version like 443:npn-spdy/3', $this->_options['text_size']), 'vh_allowSymbolLink' => new DAttr('allowSymbolLink', 'sel', 'Follow Symbolic Link', 'select', true, 0, $this->_options['symbolLink']), 'vh_enableScript' => new DAttr('enableScript', 'bool', 'Enable Scripts/ExtApps', 'radio', false), 'vh_restrained' => new DAttr('restrained', 'bool', 'Restrained', 'radio', false), @@ -963,7 +964,8 @@ protected function add_VH_GENERAL($id) new DAttr('docRoot', 'path', 'Document Root', 'text', false, 3, '', $this->_options['text_size']),//no validation, maybe suexec owner $this->_attrs['adminEmails'], $this->_attrs['vh_enableGzip'], - $this->_attrs['enableIpGeo'] + $this->_attrs['enableIpGeo'], + $this->_attrs['vh_spdyAdHeader'] ); $this->_tblDef[$id]->setAttr($attrs, 'general'); } @@ -1675,9 +1677,10 @@ protected function add_TP_GENERAL($id) $this->_attrs['vh_maxKeepAliveReq'], $this->_attrs['vh_smartKeepAlive'], $this->_attrs['tp_vrFile']->dup('docRoot', 'Document Root', NULL), + $this->_attrs['adminEmails'], $this->_attrs['vh_enableGzip'], $this->_attrs['enableIpGeo'], - $this->_attrs['adminEmails'] + $this->_attrs['vh_spdyAdHeader'] ); // to do: need check path contain VH variable. $this->_tblDef[$id]->setAttr($attrs, 'general'); @@ -1704,9 +1707,10 @@ protected function add_TP_GENERAL2($id) $this->_tblDef[$id] = new DTbl($id); $attrs = array( $this->_attrs['tp_vrFile']->dup('docRoot', 'Document Root', NULL), + $this->_attrs['adminEmails'], $this->_attrs['vh_enableGzip'], $this->_attrs['enableIpGeo'], - $this->_attrs['adminEmails'] + $this->_attrs['vh_spdyAdHeader'] ); $this->_tblDef[$id]->setAttr($attrs, 'general'); } diff --git a/dist/admin/html.open/utility/build_php/buildconf.inc.php b/dist/admin/html.open/utility/build_php/buildconf.inc.php index f54f5d6f2..06c35d969 100644 --- a/dist/admin/html.open/utility/build_php/buildconf.inc.php +++ b/dist/admin/html.open/utility/build_php/buildconf.inc.php @@ -11,24 +11,14 @@ $PHP_VER = array('5'=> array( - '5.5.2', - '5.5.1', - '5.5.0', - '5.4.18', - '5.4.17', - '5.4.16', - '5.4.15', - '5.4.14', - '5.4.13', - '5.4.12', + '5.5.3', + '5.4.19', '5.3.27', - '5.2.17', - '5.2.9', - '5.1.6'), + '5.2.17'), '4'=> - array('4.4.9', - '4.4.8')); - + array('4.4.9')); + + define ('LSAPI_VERSION', '6.3'); define ('SUHOSIN_VERSION', '0.9.33'); define ('APC_VERSION', '3.1.9'); diff --git a/dist/docs/VHGeneral_Help.html b/dist/docs/VHGeneral_Help.html index d424da670..db865853b 100644 --- a/dist/docs/VHGeneral_Help.html +++ b/dist/docs/VHGeneral_Help.html @@ -1 +1 @@ - Open LiteSpeed Web Server Users' Manual - Virtual Host General

Virtual Host General

Table of Contents

General

Document Root | Enable GZIP | Enable IP Geolocation | Administrator Email | 

Virtual Host Log

Use Server Log | File Name | Log Level | Rolling Size | 

Access Log

Log Control | File Name | Piped Logger | Log Format | Log Headers | Rolling Size | Keep Days | Bytes Log | Compress Archive | 

Index Files

Use Server Index Files | Index Files | Auto Index | Auto Index URI | 

Customized Error Pages

Error Code | URL | Action | 

Script Handler Settings

Suffix | Type | Handler Name | 

Expire Settings

Enable Expires | Expires Default | Expires By Type | 

Document RootGo to top
Description: Specifies the document root for this virtual host. $VH_ROOT/html is recommended. This directory is referred to as $DOC_ROOT in contexts.
Syntax: A path which can be absolute, or relative to $SERVER_ROOT, or relative to $VH_ROOT.
Enable GZIPGo to top
Description: Specifies whether to enable GZIP compression for this virtual host. This setting is effective only when server-level GZIP compression is enabled. The virtual host can only turn off compression enabled at the server level. Compression settings are configured at the server level (in Tuning-GZIP).
Syntax: Select from radio box
See Also: Enable Compression, Compression Level (Static Content), Enable Dynamic Compression, Compression Level (Dynamic Content)
Enable IP GeolocationGo to top
Description: Specifies whether to enable IP geolocation lookup. It can be set at server-, virtual host-, or context-level.
Syntax: Select from radio box
See Also: Use Client IP in Header, DB File Path, DB Cache Type
Administrator EmailGo to top
Description: Specifies email addresses of the administrators of this virtual host.
Use Server LogGo to top
Description: Specifies whether to put log messages from this virtual host into the server log file instead of creating its own log file.
Syntax: Select from radio box
File NameGo to top
Description: Specifies the path for the log file.
Syntax: File name which can be an absolute path or relative to $SERVER_ROOT.
Tips: [Performance] Place the log file on a separate disk.
Log LevelGo to top
Description: Specifies the level of logging. Available levels (from high to low) are ERROR, WARNING, NOTICE, INFO, and DEBUG. Only messages with a level higher than or equal to the current setting will be logged. If you want to set it to DEBUG, you must set the server log level to DEBUG as well. The level of debugging is controlled solely at the server level by Debug Level.
Syntax: Select from drop down list
Tips: [Performance] Unless Debug Level is set to a level other than NONE, DEBUG log level does not have any performance impact and is recommended.
See Also: Debug Level
Rolling SizeGo to top
Description: Specifies when the current log file needs to be rolled over, also known as log rotation. When the file size is over the rollover limit, the active log file will be renamed to log_name.mm_dd_yyyy(.sequence) in the same directory and a new active log file will be created. The actual size of the rotated log file once it is created will sometimes be a little bigger than this size limit. Set to 0 to disable log rotation.
Syntax: Integer number
Tips: Append "K", "M", "G" to the number for kilo-, mega- and giga- bytes.
Log ControlGo to top
Description: Specifies where to write the access log. There are three options: 1. Write to the server's access log; 2. Create an access log for this virtual host; 3. Disable access logging.
Syntax: Select from drop down list
File NameGo to top
Description: Specifies the file name of the access log file.
Syntax: File name which can be an absolute path or relative to $SERVER_ROOT.
Tips: [Performance] Put access log file on a separate disk.
Piped LoggerGo to top
Description: Specifies the external application that will receive the access log data sent by LiteSpeed through a pipe on its STDIN stream (file handle is 0). When this field is specified, the access log will be sent only to the logger application and not the access log file specified in previous entry.

The logger application must be defined in External Application section first. Server-level access logging can only use an external logger application defined at the server level. Virtual host-level access logging can only use a logger application defined at the virtual host level.

The logger process is spawned in the same way as other external (CGI/FastCGI/LSAPI) processes. This means it will execute as the user ID specified in the virtual host's ExtApp Set UID Mode settings and will never run on behalf of a privileged user.

LiteSpeed web server performs simple load balancing among multiple logger applications if more than one instance of a logger application is configured. LiteSpeed server always attempts to keep the number of logger applications as low as possible. Only when one logger application fails to process access log entries in time will the server attempt to spawn another instance of the logger application.

If a logger crashes, the web server will start another instance but the log data in the stream buffer will be lost. It is possible to lose log data if external loggers cannot keep up with the speed and volume of the log stream.
Syntax: Select from drop down list
Log FormatGo to top
Description: Specifies the log format for the access log. When log format is set, it will override the Log Headers setting.
Syntax: String. The syntax of log format is compatible with Apache 2.0's custom log format.
Example: Common Log Format (CLF)
"%h %l %u %t \"%r\" %>s %b"

Common Log Format with Virtual Host
"%v %h %l %u %t \"%r\" %>s %b"

NCSA extended/combined log format
"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"

Log cookie value of Foobar
"%{Foobar}C"
See Also: Log Headers
Log HeadersGo to top
Description: Specifies whether to log HTTP request headers: Referer, UserAgent, and Host.
Syntax: Select from checkbox
Tips: [Performance] Turn this off if you do not need these headers in the access log.
See Also: Log Format
Keep DaysGo to top
Description: Specifies how many days the access log file will be kept on disk. Only rotated log files older than specified number of days will be deleted. The current log file will not be touched regardless how many days' data it contains. If you do not want to auto-delete stale and very old log files, set this value to 0.
Syntax: Integer number
Bytes LogGo to top
Description: Specifies the path to the bandwidth bytes log file. When specified, a cPanel compatible bandwidth log will be created. This will log the total bytes transferred for a request including both the request and reply body.
Syntax: File name which can be an absolute path or relative to $SERVER_ROOT.
Tips: [Performance] Put the log file on a separate disk.
Compress ArchiveGo to top
Description: Specifies whether to compress rotated log files in order to save disk space.
Syntax: Select from radio box
Tips: Log files are highly compressible and this is recommended to reduce disk usage for old logs.
Use Server Index FilesGo to top
Description: Specifies whether to use the server's index file settings. If set to Yes, only the server's settings will be used. If set to No, the server's settings will not be used. If set to Addition, additional index files can be added to server's index file list for this virtual host. If you want to disable index files for this virtual host, you can set the value to No and leave the index files field empty.
Syntax: Select from drop down list
Index FilesGo to top
Description: Specifies names of index files that will be searched sequentially when a URL is mapped to a directory. You can customize it at the server, virtual host, and context level.
Syntax: Comma delimited list of index file names.
Tips: [Performance] Only set index files that you need.
Auto IndexGo to top
Description: Specifies whether to generate a directory index on the fly when index files listed in Index Files are not available in a directory. This option is customizable at the virtual host and context level, and is inherited along the directory tree until it is explicitly overridden. You can customize the generated index page. Please check online wiki How-tos.
Syntax: Select from radio box
Tips: [Security] It is recommended to turn off Auto Index wherever possible to prevent revealing confidential data.
See Also: Index Files, Auto Index URI
Auto Index URIGo to top
Description: Specifies the URI that will be used to generate the index page when index files listed in Index Files are not available in a directory. LiteSpeed web server uses an external script to generate the index page providing the maximum customization flexibility. The default script produces an index page with same look as Apache's. To customize the generated index page, please read online wiki How-tos. The directory to be indexed is passed to the script via an environment variable "LS_AI_PATH".
Syntax: URI
See Also: Index Files, Auto Index
Customized Error PagesGo to top
Description: Whenever the server has a problem processing a request, the server will return an error code and an html page as the error message to the web client. Error codes are defined in the HTTP protocol (see RFC 2616). LiteSpeed web server has a built-in default error page for each error code, but a customized page can be configured for each error code. error pages can also be further customized to be unique for each virtual host.
Error CodeGo to top
Description: Specifies the HTTP status code for the error page. Only the selected HTTP status code will have this customized error page.
Syntax: Select from drop down list
URLGo to top
Description: Specifies the URL of the customized error page. The server will forward the request to this URL when the corresponding HTTP status code has returned. If this URL refers to a non-existing resource, the built-in error page will be used. The URL can be a static file, a dynamically generated page, or a page on another web site (a URL starting with "http(s)://"). When referring to a page on another web site, the client will receive a redirect status code instead of the original status code.
Syntax: URL
ActionGo to top
Description: To change the error page setting, click "Edit". To remove this customized error page, click "Delete".
SuffixGo to top
Description: Specifies the script file suffixes that will be handled by this script handler. Suffixes must be unique.
Syntax: Comma delimited list with period "." character prohibited.
Tips: The server will automatically add a special MIME type ("application/x-httpd-[suffix]") for the first suffix in the list. For example, MIME type "application/x-httpd-php53" will be added for suffix "php53". Suffixes after the first need to set up in the MIME Settings settings.
Though we list suffixes in this field, the script handlers use MIME types, not suffixes, to decide which scripts to handle.
[Performance & Security] Only specify the suffixes you really need.
TypeGo to top
Description: Specifies the type of external application that processes these script files. Available types are: CGI, FastCGI, Web Server, LSAPI app, Load balancer, or Servlet Engine. For FastCGI, Web Server and Servlet Engine, a Handler Name needs to be specified. This is an external application name as predefined in the External Application section.
Syntax: Select from drop down list
Handler NameGo to top
Description: Specifies the name of the external application that processes the script files when the handler type is FastCGI, Web Server, LSAPI, Load Balancer, or Servlet Engine.
Syntax: Select from drop down list
Enable ExpiresGo to top
Description: Specifies whether to generate an Expires header for static files. If enabled, an Expires header will be generated based on Expires Default and Expires By Type.

This can be set at server, virtual host and context level. Lower level settings will override higher level ones, i.e. context settings will override virtual host settings and virtual host settings will override server settings.
Syntax: Select from radio box
Expires DefaultGo to top
Description: Specifies default settings for Expires header generation. This setting takes effect when Enable Expires is set to "Yes". It can be overridden by Expires By Type. Do not set this default at the server or virtual host level unless you have to, since it will generate Expires headers for all pages. Most of time this should be set at the context level for certain directories that do not change often. If there is no default setting, no Expires header will be generated for types not specified in Expires By Type.
Syntax: A|Mseconds
The file will expire after base time(A|M) plus specified seconds. Base time "A" sets the value to the client's access time and "M" to the file's last modified time.
Expires By TypeGo to top
Description: Specifies Expires header settings for individual MIME types.
Syntax: Comma delimited list of "MIME-type=A|Mseconds". The file will expire after base time (A|M) plus specified seconds.

Base time "A" sets the value to the client's access time and "M" to the file's last modified time. MIME-type accepts wildcard "*", like image/*.
\ No newline at end of file + Open LiteSpeed Web Server Users' Manual - Virtual Host General

Virtual Host General

Table of Contents

General

Document Root | Administrator Email | Enable GZIP | Enable IP Geolocation | SPDY Advertisement | 

Virtual Host Log

Use Server Log | File Name | Log Level | Rolling Size | 

Access Log

Log Control | File Name | Piped Logger | Log Format | Log Headers | Rolling Size | Keep Days | Bytes Log | Compress Archive | 

Index Files

Use Server Index Files | Index Files | Auto Index | Auto Index URI | 

Customized Error Pages

Error Code | URL | Action | 

Script Handler Settings

Suffix | Type | Handler Name | 

Expire Settings

Enable Expires | Expires Default | Expires By Type | 

Document RootGo to top
Description: Specifies the document root for this virtual host. $VH_ROOT/html is recommended. This directory is referred to as $DOC_ROOT in contexts.
Syntax: A path which can be absolute, or relative to $SERVER_ROOT, or relative to $VH_ROOT.
Administrator EmailGo to top
Description: Specifies email addresses of the administrators of this virtual host.
Enable GZIPGo to top
Description: Specifies whether to enable GZIP compression for this virtual host. This setting is effective only when server-level GZIP compression is enabled. The virtual host can only turn off compression enabled at the server level. Compression settings are configured at the server level (in Tuning-GZIP).
Syntax: Select from radio box
See Also: Enable Compression, Compression Level (Static Content), Enable Dynamic Compression, Compression Level (Dynamic Content)
Enable IP GeolocationGo to top
Description: Specifies whether to enable IP geolocation lookup. It can be set at server-, virtual host-, or context-level.
Syntax: Select from radio box
See Also: Use Client IP in Header, DB File Path, DB Cache Type
SPDY AdvertisementGo to top
Description: Specifies whether to advertise to clients that SPDY protocol is available. If set, LSWS will send an Alternate-Protocol response header when a client accesses SPDY-enabled websites through an HTTP connection. This requires the website to have both HTTP and HTTPS connections set up, and SPDY support enabled.
Syntax: port:protocol string
Example: If SPDY/3 is enabled on port 443, you can set the string to "443:npn-spdy/3"
Use Server LogGo to top
Description: Specifies whether to put log messages from this virtual host into the server log file instead of creating its own log file.
Syntax: Select from radio box
File NameGo to top
Description: Specifies the path for the log file.
Syntax: File name which can be an absolute path or relative to $SERVER_ROOT.
Tips: [Performance] Place the log file on a separate disk.
Log LevelGo to top
Description: Specifies the level of logging. Available levels (from high to low) are ERROR, WARNING, NOTICE, INFO, and DEBUG. Only messages with a level higher than or equal to the current setting will be logged. If you want to set it to DEBUG, you must set the server log level to DEBUG as well. The level of debugging is controlled solely at the server level by Debug Level.
Syntax: Select from drop down list
Tips: [Performance] Unless Debug Level is set to a level other than NONE, DEBUG log level does not have any performance impact and is recommended.
See Also: Debug Level
Rolling SizeGo to top
Description: Specifies when the current log file needs to be rolled over, also known as log rotation. When the file size is over the rollover limit, the active log file will be renamed to log_name.mm_dd_yyyy(.sequence) in the same directory and a new active log file will be created. The actual size of the rotated log file once it is created will sometimes be a little bigger than this size limit. Set to 0 to disable log rotation.
Syntax: Integer number
Tips: Append "K", "M", "G" to the number for kilo-, mega- and giga- bytes.
Log ControlGo to top
Description: Specifies where to write the access log. There are three options: 1. Write to the server's access log; 2. Create an access log for this virtual host; 3. Disable access logging.
Syntax: Select from drop down list
File NameGo to top
Description: Specifies the file name of the access log file.
Syntax: File name which can be an absolute path or relative to $SERVER_ROOT.
Tips: [Performance] Put access log file on a separate disk.
Piped LoggerGo to top
Description: Specifies the external application that will receive the access log data sent by LiteSpeed through a pipe on its STDIN stream (file handle is 0). When this field is specified, the access log will be sent only to the logger application and not the access log file specified in previous entry.

The logger application must be defined in External Application section first. Server-level access logging can only use an external logger application defined at the server level. Virtual host-level access logging can only use a logger application defined at the virtual host level.

The logger process is spawned in the same way as other external (CGI/FastCGI/LSAPI) processes. This means it will execute as the user ID specified in the virtual host's ExtApp Set UID Mode settings and will never run on behalf of a privileged user.

LiteSpeed web server performs simple load balancing among multiple logger applications if more than one instance of a logger application is configured. LiteSpeed server always attempts to keep the number of logger applications as low as possible. Only when one logger application fails to process access log entries in time will the server attempt to spawn another instance of the logger application.

If a logger crashes, the web server will start another instance but the log data in the stream buffer will be lost. It is possible to lose log data if external loggers cannot keep up with the speed and volume of the log stream.
Syntax: Select from drop down list
Log FormatGo to top
Description: Specifies the log format for the access log. When log format is set, it will override the Log Headers setting.
Syntax: String. The syntax of log format is compatible with Apache 2.0's custom log format.
Example: Common Log Format (CLF)
"%h %l %u %t \"%r\" %>s %b"

Common Log Format with Virtual Host
"%v %h %l %u %t \"%r\" %>s %b"

NCSA extended/combined log format
"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"

Log cookie value of Foobar
"%{Foobar}C"
See Also: Log Headers
Log HeadersGo to top
Description: Specifies whether to log HTTP request headers: Referer, UserAgent, and Host.
Syntax: Select from checkbox
Tips: [Performance] Turn this off if you do not need these headers in the access log.
See Also: Log Format
Keep DaysGo to top
Description: Specifies how many days the access log file will be kept on disk. Only rotated log files older than specified number of days will be deleted. The current log file will not be touched regardless how many days' data it contains. If you do not want to auto-delete stale and very old log files, set this value to 0.
Syntax: Integer number
Bytes LogGo to top
Description: Specifies the path to the bandwidth bytes log file. When specified, a cPanel compatible bandwidth log will be created. This will log the total bytes transferred for a request including both the request and reply body.
Syntax: File name which can be an absolute path or relative to $SERVER_ROOT.
Tips: [Performance] Put the log file on a separate disk.
Compress ArchiveGo to top
Description: Specifies whether to compress rotated log files in order to save disk space.
Syntax: Select from radio box
Tips: Log files are highly compressible and this is recommended to reduce disk usage for old logs.
Use Server Index FilesGo to top
Description: Specifies whether to use the server's index file settings. If set to Yes, only the server's settings will be used. If set to No, the server's settings will not be used. If set to Addition, additional index files can be added to server's index file list for this virtual host. If you want to disable index files for this virtual host, you can set the value to No and leave the index files field empty.
Syntax: Select from drop down list
Index FilesGo to top
Description: Specifies names of index files that will be searched sequentially when a URL is mapped to a directory. You can customize it at the server, virtual host, and context level.
Syntax: Comma delimited list of index file names.
Tips: [Performance] Only set index files that you need.
Auto IndexGo to top
Description: Specifies whether to generate a directory index on the fly when index files listed in Index Files are not available in a directory. This option is customizable at the virtual host and context level, and is inherited along the directory tree until it is explicitly overridden. You can customize the generated index page. Please check online wiki How-tos.
Syntax: Select from radio box
Tips: [Security] It is recommended to turn off Auto Index wherever possible to prevent revealing confidential data.
See Also: Index Files, Auto Index URI
Auto Index URIGo to top
Description: Specifies the URI that will be used to generate the index page when index files listed in Index Files are not available in a directory. LiteSpeed web server uses an external script to generate the index page providing the maximum customization flexibility. The default script produces an index page with same look as Apache's. To customize the generated index page, please read online wiki How-tos. The directory to be indexed is passed to the script via an environment variable "LS_AI_PATH".
Syntax: URI
See Also: Index Files, Auto Index
Customized Error PagesGo to top
Description: Whenever the server has a problem processing a request, the server will return an error code and an html page as the error message to the web client. Error codes are defined in the HTTP protocol (see RFC 2616). LiteSpeed web server has a built-in default error page for each error code, but a customized page can be configured for each error code. error pages can also be further customized to be unique for each virtual host.
Error CodeGo to top
Description: Specifies the HTTP status code for the error page. Only the selected HTTP status code will have this customized error page.
Syntax: Select from drop down list
URLGo to top
Description: Specifies the URL of the customized error page. The server will forward the request to this URL when the corresponding HTTP status code has returned. If this URL refers to a non-existing resource, the built-in error page will be used. The URL can be a static file, a dynamically generated page, or a page on another web site (a URL starting with "http(s)://"). When referring to a page on another web site, the client will receive a redirect status code instead of the original status code.
Syntax: URL
ActionGo to top
Description: To change the error page setting, click "Edit". To remove this customized error page, click "Delete".
SuffixGo to top
Description: Specifies the script file suffixes that will be handled by this script handler. Suffixes must be unique.
Syntax: Comma delimited list with period "." character prohibited.
Tips: The server will automatically add a special MIME type ("application/x-httpd-[suffix]") for the first suffix in the list. For example, MIME type "application/x-httpd-php53" will be added for suffix "php53". Suffixes after the first need to set up in the MIME Settings settings.
Though we list suffixes in this field, the script handlers use MIME types, not suffixes, to decide which scripts to handle.
[Performance & Security] Only specify the suffixes you really need.
TypeGo to top
Description: Specifies the type of external application that processes these script files. Available types are: CGI, FastCGI, Web Server, LSAPI app, Load balancer, or Servlet Engine. For FastCGI, Web Server and Servlet Engine, a Handler Name needs to be specified. This is an external application name as predefined in the External Application section.
Syntax: Select from drop down list
Handler NameGo to top
Description: Specifies the name of the external application that processes the script files when the handler type is FastCGI, Web Server, LSAPI, Load Balancer, or Servlet Engine.
Syntax: Select from drop down list
Enable ExpiresGo to top
Description: Specifies whether to generate an Expires header for static files. If enabled, an Expires header will be generated based on Expires Default and Expires By Type.

This can be set at server, virtual host and context level. Lower level settings will override higher level ones, i.e. context settings will override virtual host settings and virtual host settings will override server settings.
Syntax: Select from radio box
Expires DefaultGo to top
Description: Specifies default settings for Expires header generation. This setting takes effect when Enable Expires is set to "Yes". It can be overridden by Expires By Type. Do not set this default at the server or virtual host level unless you have to, since it will generate Expires headers for all pages. Most of time this should be set at the context level for certain directories that do not change often. If there is no default setting, no Expires header will be generated for types not specified in Expires By Type.
Syntax: A|Mseconds
The file will expire after base time(A|M) plus specified seconds. Base time "A" sets the value to the client's access time and "M" to the file's last modified time.
Expires By TypeGo to top
Description: Specifies Expires header settings for individual MIME types.
Syntax: Comma delimited list of "MIME-type=A|Mseconds". The file will expire after base time (A|M) plus specified seconds.

Base time "A" sets the value to the client's access time and "M" to the file's last modified time. MIME-type accepts wildcard "*", like image/*.
\ No newline at end of file diff --git a/dist/functions.sh b/dist/functions.sh index 13c6c82ff..0a598e281 100755 --- a/dist/functions.sh +++ b/dist/functions.sh @@ -280,9 +280,10 @@ EOF # generate password file - ENCRYPT_PASS=`"$LSINSTALL_DIR/admin/fcgi-bin/admin_php" -q "$LSINSTALL_DIR/admin/misc/htpasswd.php" $PASS_ONE` - echo "$ADMIN_USER:$ENCRYPT_PASS" > "$LSINSTALL_DIR/admin/conf/htpasswd" - + if [ ! -f "$LSINSTALL_DIR/admin/conf/htpasswd" ] ; then + ENCRYPT_PASS=`"$LSINSTALL_DIR/admin/fcgi-bin/admin_php" -q "$LSINSTALL_DIR/admin/misc/htpasswd.php" $PASS_ONE` + echo "$ADMIN_USER:$ENCRYPT_PASS" > "$LSINSTALL_DIR/admin/conf/htpasswd" + fi fi } @@ -890,9 +891,10 @@ installation() rm -rf "$LSWS_HOME/admin/html.$VERSION" fi - util_mkdir "$SDIR_OWN" $DIR_MOD admin bin docs fcgi-bin php lib logs docs/css docs/img admin/logs add-ons share share/autoindex share/autoindex/icons admin/fcgi-bin admin/html.$VERSION admin/misc tmp tmp/ocspcache + util_mkdir "$SDIR_OWN" $DIR_MOD admin bin docs fcgi-bin php lib logs docs/css docs/img admin/logs add-ons share share/autoindex share/autoindex/icons admin/fcgi-bin admin/html.$VERSION admin/misc tmp util_mkdir "$CONF_OWN" $SDIR_MOD conf conf/cert conf/templates admin/conf admin/tmp phpbuild util_mkdir "$SDIR_OWN" $SDIR_MOD admin/cgid admin/cgid/secret + util_mkdir "$DIR_OWN" $SDIR_MOD tmp/ocspcache chgrp $WS_GROUP $LSWS_HOME/admin/tmp $LSWS_HOME/admin/cgid chmod g+x $LSWS_HOME/admin/tmp $LSWS_HOME/admin/cgid chown $CONF_OWN $LSWS_HOME/admin/tmp/sess_* 1>/dev/null 2>&1 diff --git a/dist/install.sh b/dist/install.sh index aa7e1dbcc..cc183ad64 100755 --- a/dist/install.sh +++ b/dist/install.sh @@ -141,10 +141,9 @@ else chmod "$EXEC_MOD" "$LSWS_HOME/admin/fcgi-bin/admin_php" fi -if [ ! -f "$LSWS_HOME/admin/conf/htpasswd" ] ; then - ENCRYPT_PASS=`"$LSWS_HOME/admin/fcgi-bin/admin_php" -q "$LSWS_HOME/admin/misc/htpasswd.php" $PASS_ONE` - echo "$ADMIN_USER:$ENCRYPT_PASS" > "$LSWS_HOME/admin/conf/htpasswd" -fi +ENCRYPT_PASS=`"$LSWS_HOME/admin/fcgi-bin/admin_php" -q "$LSWS_HOME/admin/misc/htpasswd.php" $PASS_ONE` +echo "$ADMIN_USER:$ENCRYPT_PASS" > "$LSWS_HOME/admin/conf/htpasswd" + if [ -f "$LSWS_HOME/fcgi-bin/lsphp" ]; then diff --git a/src/extensions/proxy/proxyconn.cpp b/src/extensions/proxy/proxyconn.cpp index 46de6737d..336f1f914 100644 --- a/src/extensions/proxy/proxyconn.cpp +++ b/src/extensions/proxy/proxyconn.cpp @@ -400,6 +400,11 @@ int ProxyConn::processResp() { setupChunkIS(); } + else if (!(respState & HEC_RESP_CONT_LEN )) + { + m_iRespBodySize = INT_MAX; + } + m_pBufBegin = pBuf; m_pBufEnd = pBuf + len; if ( D_ENABLED( DL_MEDIUM ) ) diff --git a/src/http/clientcache.cpp b/src/http/clientcache.cpp index 60e05ea5d..f09b51eb9 100644 --- a/src/http/clientcache.cpp +++ b/src/http/clientcache.cpp @@ -231,6 +231,7 @@ static int resetQuotas( GHash::iterator iter ) ClientInfo * pInfo = ((ClientInfo *)iter->second()); if ( !pInfo ) return 0; + pInfo->setSslNewConn( 0 ); pInfo->getThrottleCtrl().resetQuotas(); register time_t tm = pInfo->getOverLimitTime(); if ( tm ) diff --git a/src/http/httpcgitool.cpp b/src/http/httpcgitool.cpp index 83026f3cd..0a87abe51 100644 --- a/src/http/httpcgitool.cpp +++ b/src/http/httpcgitool.cpp @@ -177,7 +177,11 @@ int HttpCgiTool::processHeaderLine( HttpExtConnector * pExtConn, const char * pL { long lContentLen = strtol( pValue, NULL, 10 ); if (( lContentLen >= 0 )&&( lContentLen != LONG_MAX )) + { pResp->setContentLen( lContentLen ); + status |= HEC_RESP_CONT_LEN; + pReq->orContextState( RESP_CONT_LEN_SET ); + } } //fall through case HttpRespHeaders::H_KEEP_ALIVE: diff --git a/src/http/httpconnection.cpp b/src/http/httpconnection.cpp index e798f403a..26cb1d02d 100644 --- a/src/http/httpconnection.cpp +++ b/src/http/httpconnection.cpp @@ -1274,7 +1274,8 @@ int HttpConnection::buildErrorResponse( const char * errMsg ) int len = HttpStatusCode::getBodyLen( errCode ); m_response.setContentLen( len ); m_response.parseAdd( HttpStatusCode::getHeaders( errCode ), HttpStatusCode::getHeadersLen( errCode )); - m_response.finalizeHeader( ver, errCode); + m_response.finalizeHeader( ver, errCode, m_request.getVHost()); + if ( getStream()->isSpdy() ) sendSpdyHeaders(); m_response.getIov().append( pHtml, len ); @@ -1283,7 +1284,7 @@ int HttpConnection::buildErrorResponse( const char * errMsg ) return 0; } } - m_response.finalizeHeader( ver, errCode); + m_response.finalizeHeader( ver, errCode, m_request.getVHost() ); if ( getStream()->isSpdy() ) sendSpdyHeaders(); return 0; @@ -2250,7 +2251,7 @@ int HttpConnection::prepareDynRespHeader( int complete, int nobuffer ) m_response.addGzipEncodingHeader(); } m_response.prepareHeaders( &m_request ); - m_response.finalizeHeader( m_request.getVersion(), m_request.getStatusCode()); + m_response.finalizeHeader( m_request.getVersion(), m_request.getStatusCode(), m_request.getVHost() ); return 0; } diff --git a/src/http/httpreq.cpp b/src/http/httpreq.cpp index f379c050e..b6404fbf4 100644 --- a/src/http/httpreq.cpp +++ b/src/http/httpreq.cpp @@ -2072,6 +2072,16 @@ void HttpReq::dumpHeader() { const char * pBegin = getOrgReqLine(); char * pEnd = (char *)pBegin + getOrgReqLineLen(); + if ( m_iHeaderStatus == HEADER_REQUEST_LINE ) + return; + if ( pEnd >= m_headerBuf.begin() + m_iReqHeaderBufFinished ) + { + pEnd = m_headerBuf.begin() + m_iReqHeaderBufFinished; + if ( pEnd >= m_headerBuf.begin() + m_headerBuf.capacity() ) + pEnd = m_headerBuf.begin() + m_headerBuf.capacity() - 1; + } + if ( pEnd < pBegin ) + pEnd = (char *)pBegin; *pEnd = 0; LOG_INFO(( getLogger(), "[%s] Content len: %d, Request line: \n%s", getLogId(), m_lEntityLength, pBegin )); diff --git a/src/http/httpresp.cpp b/src/http/httpresp.cpp index 8f6613df0..e8c507a61 100644 --- a/src/http/httpresp.cpp +++ b/src/http/httpresp.cpp @@ -111,7 +111,7 @@ void HttpResp::buildCommonHeaders() HttpResp::m_gzipHeaders[1].index = HttpRespHeaders::H_VARY; HttpResp::m_gzipHeaders[1].name = HttpResp::s_sGzipEncodingHeader + 24; HttpResp::m_gzipHeaders[1].nameLen = 4; - HttpResp::m_gzipHeaders[1].val = HttpResp::s_sCommonHeaders + 30; + HttpResp::m_gzipHeaders[1].val = HttpResp::s_sGzipEncodingHeader + 30; HttpResp::m_gzipHeaders[1].valLen = 15; HttpResp::m_keepaliveHeader.index = HttpRespHeaders::H_CONNECTION; @@ -180,16 +180,20 @@ void HttpResp::appendContentLenHeader() 14, sLength, n); } -void HttpResp::finalizeHeader( int ver, int code) +void HttpResp::finalizeHeader( int ver, int code, const HttpVHost *vhost ) { //addStatusLine will add HTTP/1.1 to front of m_iovec when regular format // will add version: HTTP/1.1 status: 2XX (etc) to m_outputBuf when SPDY format // *** Be careful about this difference *** m_respHeaders.addStatusLine(ver, code); + if ( vhost ) + { + const AutoStr2& str = vhost->getSpdyAdHeader(); + if( !m_iSSL && str.len() > 0 ) + appendHeader("Alternate-Protocol", 18, str.c_str(), str.len()); + } m_respHeaders.getHeaders(&m_iovec); - - int bufSize = m_iovec.bytes(); m_iHeaderLeft += bufSize; m_iHeaderTotalLen = m_iHeaderLeft; diff --git a/src/http/httpresp.h b/src/http/httpresp.h index a6162d813..b56bd07e3 100644 --- a/src/http/httpresp.h +++ b/src/http/httpresp.h @@ -23,7 +23,7 @@ #include #include #include - +#include #define RANGE_HEADER_LEN 22 class HttpReq; @@ -109,7 +109,7 @@ class HttpResp void setSSL( int ssl ) { m_iSSL = (ssl != 0 ); } - void finalizeHeader( int ver, int code); + void finalizeHeader( int ver, int code, const HttpVHost *vhost ); IOVec& getIov() { return m_iovec; } void parseAdd( const char * pBuf, int len ); diff --git a/src/http/httputil.cpp b/src/http/httputil.cpp index 3a95a140f..5bba3d683 100644 --- a/src/http/httputil.cpp +++ b/src/http/httputil.cpp @@ -102,10 +102,19 @@ int HttpUtil::unescape( char * pDest, int& uriLen, register char x1, x2; x1 = *pSrc++; if (!isxdigit(x1)) - return -1; + { + *p++ = '%'; + c = x1; + break; + } x2 = *pSrc++; if (!isxdigit(x2)) - return -1; + { + *p++ = '%'; + *p++ = x1; + c = x2; + break; + } c = (hexdigit(x1) << 4) + hexdigit(x2); break; } diff --git a/src/http/httpvhost.cpp b/src/http/httpvhost.cpp index c3c3cbaa6..3944a1013 100644 --- a/src/http/httpvhost.cpp +++ b/src/http/httpvhost.cpp @@ -225,6 +225,7 @@ HttpVHost::HttpVHost( const char * pHostName ) , m_pRewriteMaps( NULL ) , m_pSSLCtx( NULL ) , m_pSSITagConfig( NULL ) + , m_sSpdyAdHeader( "" ) { char achBuf[10] = "/"; m_rootContext.set( achBuf, "/nON eXIST", diff --git a/src/http/httpvhost.h b/src/http/httpvhost.h index ede817cb2..7e42ce4e8 100644 --- a/src/http/httpvhost.h +++ b/src/http/httpvhost.h @@ -126,6 +126,8 @@ class HttpVHost : public RefCounter, public HttpLogSource RewriteMapList * m_pRewriteMaps; SSLContext * m_pSSLCtx; SSITagConfig * m_pSSITagConfig; + AutoStr2 m_sSpdyAdHeader; + HttpVHost( const HttpVHost& rhs ); void operator=( const HttpVHost& rhs ); public: @@ -330,6 +332,9 @@ class HttpVHost : public RefCounter, public HttpLogSource SSLContext * getSSLContext() const { return m_pSSLCtx; } + + void setSpdyAdHeader(const char *sHeader) { m_sSpdyAdHeader = sHeader; } + const AutoStr2& getSpdyAdHeader() const { return m_sSpdyAdHeader; } }; diff --git a/src/http/moov.cpp b/src/http/moov.cpp index 80ac1e7b5..a6b1bdb67 100644 --- a/src/http/moov.cpp +++ b/src/http/moov.cpp @@ -148,6 +148,8 @@ int get_mini_moov(int fd, //in - video file descriptor mdat_box = worker_box; break; } + if ( worker_box.header.ExtendedSize <= 0 ) + return -1; pos += worker_box.header.ExtendedSize; } diff --git a/src/http/staticfilehandler.cpp b/src/http/staticfilehandler.cpp index c643d5b33..a6714c7c2 100644 --- a/src/http/staticfilehandler.cpp +++ b/src/http/staticfilehandler.cpp @@ -212,7 +212,7 @@ static int processFlvStream( HttpConnection * pConn, off_t start ) pResp->setContentLen( pData->getECache()->getFileSize() - start + FLV_HEADER_LEN ); pResp->appendContentLenHeader(); - pResp->finalizeHeader( pReq->getVersion(), pReq->getStatusCode()); + pResp->finalizeHeader( pReq->getVersion(), pReq->getStatusCode(), pReq->getVHost() ); pResp->appendExtra( FLV_HEADER, FLV_HEADER_LEN ); pResp->written( FLV_HEADER_LEN ); ret = pConn->beginWrite(); @@ -406,6 +406,7 @@ int processH264Stream( HttpConnection * pConn, double start ) int ret = pData->getCache()->readyCacheData( pECache, 0 ); if ( ret ) return ret; + pECache->incRef(); unsigned char * mini_moov = NULL; uint32_t mini_moov_size; mini_moov = pData->getCache()->getMiniMoov(); @@ -435,7 +436,6 @@ int processH264Stream( HttpConnection * pConn, double start ) moov_data->remaining_bytes = 1; //first call moov_data->start_time = start; - pECache->incRef(); pConn->resetResp(); off_t contentLen = 0; @@ -623,7 +623,7 @@ int StaticFileHandler::process( HttpConnection * pConn, const HttpHandler * pHan pResp->addGzipEncodingHeader(); } } - pResp->finalizeHeader( pReq->getVersion(), pReq->getStatusCode()); + pResp->finalizeHeader( pReq->getVersion(), pReq->getStatusCode(), pReq->getVHost()); } //Xuedong Add for SSI Start else { @@ -862,7 +862,7 @@ static int processRange( HttpConnection * pConn, HttpReq * pReq, const char *pRa pConn->resetResp(); pResp->prepareHeaders( pReq, RANGE_HEADER_LEN ); ret = buildRangeHeaders( pConn, *range); - pResp->finalizeHeader( pReq->getVersion(), pReq->getStatusCode()); + pResp->finalizeHeader( pReq->getVersion(), pReq->getStatusCode(), pReq->getVHost()); if ( !ret ) { ret = pConn->beginWrite(); diff --git a/src/main/httpserverbuilder.cpp b/src/main/httpserverbuilder.cpp index 2cd46b4da..f9fdefe32 100644 --- a/src/main/httpserverbuilder.cpp +++ b/src/main/httpserverbuilder.cpp @@ -1506,6 +1506,12 @@ int HttpServerBuilder::configVHBasics( HttpVHost *pVHost, const XmlNode *pVhConf } pVHost->setAdminEmails( pAdminEmails ); + + const char *pSpdyAdHeader = pVhConfNode->getChildValue( "spdyAdHeader" ); + if ( !pSpdyAdHeader ) + pSpdyAdHeader = ""; + pVHost->setSpdyAdHeader( pSpdyAdHeader ); + return 0; @@ -3621,8 +3627,8 @@ int HttpServerBuilder::initTuning( const XmlNode *pRoot ) } //connections - m_pServer->setMaxConns( m_pCurConfigCtx->getLongValue( pNode, "maxConnections", 1, 65535, 400 ) ); - m_pServer->setMaxSSLConns( m_pCurConfigCtx->getLongValue( pNode, "maxSSLConnections", 0, 65535, 100 ) ); + m_pServer->setMaxConns( m_pCurConfigCtx->getLongValue( pNode, "maxConnections", 1, 1000000, 2000 ) ); + m_pServer->setMaxSSLConns( m_pCurConfigCtx->getLongValue( pNode, "maxSSLConnections", 0, 1000000, 1000 ) ); HttpListener::setSockSendBufSize( m_pCurConfigCtx->getLongValue( pNode, "sndBufSize", 0, 256 * 1024, 0 ) ); HttpListener::setSockRecvBufSize(