Skip to content

OLS Patches

These patches are what distinguish LiteHTTPD-Full from LiteHTTPD-Thin. LiteHTTPD works with stock OLS (Thin edition), but these 4 patches enable additional features that make up the Full edition.

PatchFeatureRequired For
0001PHPConfig LSIAPIphp_value, php_flag directives
0002RewriteRule LSIAPIRewriteRule execution (not just parsing)
0003readApacheConfAuto-convert Apache config at startup
0004autoIndex 403Options -Indexes returns 403

Adds function pointers to lsi_api_t for PHP configuration:

int (*set_php_config_value)(session, name, value, type);
int (*set_php_config_flag)(session, name, int_value, type);
int (*get_php_config)(session, name, buf, buf_len);
int (*set_req_header)(session, name, name_len, value, value_len, op);

Files modified: include/ls.h, src/lsiapi/lsiapilib.cpp

Without this patch, php_value and php_flag directives are parsed but cannot be passed to lsphp.

Adds rewrite engine access to the module:

void *(*parse_rewrite_rules)(rules_text, text_len);
int (*exec_rewrite_rules)(session, handle, base, base_len);
void (*free_rewrite_rules)(handle);

Also adds getStatusCode() public getter to RewriteEngine class.

Files modified: include/ls.h, src/http/rewriteengine.h, src/lsiapi/lsiapilib.cpp

Without this patch, RewriteRule directives are parsed but not executed. The module falls back to OLS native RewriteFile .htaccess processing.

Adds a readApacheConf directive to OLS plainconf that embeds the Apache configuration parser directly in the OLS process (in-process, not fork/exec):

readApacheConf /etc/httpd/conf/httpd.conf portmap=80:8088,443:8443

The confconv parser sources are bundled as Source5-9 in the RPM and compiled into the OLS binary.

Files modified: src/main/plainconf.cpp

When .htaccess contains Options -Indexes and a directory has no index file, this patch returns 403 Forbidden instead of showing a directory listing or returning 404.

Files modified: src/http/httpreq.cpp

The patch scans .htaccess in HttpReq::processPath() at the contextMap stage, parsing Options tokens with proper +Indexes/-Indexes precedence.

All 4 patches are pre-applied and verified in the openlitespeed-litehttpd RPM binary. For manual builds:

Terminal window
cd /path/to/openlitespeed-1.8.5
patch -p1 < /path/to/litehttpd/patches/0001-lsiapi-phpconfig.patch
patch -p1 < /path/to/litehttpd/patches/0002-lsiapi-rewrite.patch
# Patch 0003 and 0004 require manual application (Python scripts)
bash build.sh

All patches append to the end of existing structures — they never modify existing field offsets. This ensures:

  • Modules compiled against patched headers work with patched OLS
  • Stock OLS modules continue to work (new fields are simply unused)
  • The module detects patch availability at runtime via NULL pointer checks