Skip to content

Commit 6eb1638

Browse files
authored
feat: replace Lua config with Parmlib parser (DD:HTTPPRM)
Replace the Lua-based httpconf.c (1286 lines) with a line-based KEY=VALUE Parmlib parser httpprm.c (540 lines) that reads from DD:HTTPPRM. Follows the same pattern as FTPD and UFSD. - New src/httpprm.c: reads DD:HTTPPRM, KEY=VALUE format, comments with # or *, missing DD starts with defaults (warning) - Delete src/httpconf.c: Lua config engine removed - CGI registration via CGI=PROGRAM /path/* lines (no defaults) - No MQTT or embedded FTPD initialization (confirmed removals) - Socket bind with retry logic preserved from httpconf.c - All settings carried over: PORT, MINTASK, MAXTASK, CLIENT_TIMEOUT, LOGIN, TZOFFSET, DEBUG, UFS, DOCROOT, CODEPAGE, BIND_TRIES, BIND_SLEEP, LISTEN_QUEUE, CGI, CGILUA_*, CLIENT_STATS_*, etc. HTTPD struct changes: - lua_State *config → void *unused_60 (preserve offsets) - New fields: ufs_enabled, dbg_enabled, bind_tries, bind_sleep, listen_queue, codepage[16] New samplib/ directory: - samplib/httpd: STC JCL procedure (matching FTPD/UFSD pattern) - samplib/httpprm0: sample Parmlib member with all settings Fixes #40
1 parent 36abd64 commit 6eb1638

7 files changed

Lines changed: 651 additions & 1298 deletions

File tree

include/httpd.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ struct httpd {
126126
UFSSYS *ufssys; /* 54 Unix like file system */
127127
LUAX *luax; /* 58 Lua function vector */
128128
const char *version; /* 5C HTTPD Version */
129-
lua_State *config; /* 60 Lua configuration state */
129+
void *unused_60; /* 60 (was: lua_State *config) */
130130
UCHAR cfg_maxtask; /* 64 config max task */
131131
UCHAR cfg_mintask; /* 65 config min task */
132132
UCHAR cfg_client_timeout; /* 66 client timeout seconds */
@@ -135,7 +135,10 @@ struct httpd {
135135
UCHAR cfg_st_hour_max; /* 69 statistics hour_records */
136136
UCHAR cfg_st_min_max; /* 6A statistics min records */
137137
UCHAR cfg_cgictx; /* 6B # CGI context pointers */
138-
UCHAR cfg_st_unused[4]; /* 6C unused / available */
138+
UCHAR ufs_enabled; /* 6C UFS filesystem enabled */
139+
UCHAR dbg_enabled; /* 6D debug output enabled */
140+
UCHAR bind_tries; /* 6E socket bind retry count */
141+
UCHAR bind_sleep; /* 6F socket bind retry delay */
139142
HTTPSTAT **st_month; /* 70 statistics month array */
140143
HTTPSTAT **st_day; /* 74 statistics day array */
141144
HTTPSTAT **st_hour; /* 78 statistics hour array */
@@ -152,7 +155,10 @@ struct httpd {
152155
#define HTTPD_CGICTX_MIN 0 /* ... minimum number of cgictx */
153156
#define HTTPD_CGICTX_MAX 255 /* ... maximum number of cgictx */
154157
char docroot[128]; /* A0 UFS document root prefix */
155-
}; /* 120 */
158+
UCHAR listen_queue; /* 120 listen backlog */
159+
UCHAR unused_121[3]; /* 121 alignment padding */
160+
char codepage[16]; /* 124 codepage name */
161+
}; /* 134 */
156162

157163
/* Telemetry */
158164
struct httpt {

project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ blksize = 15040
4848
space = ["TRK", 150, 50, 30]
4949

5050
[dependencies]
51-
"mvslovers/crent370" = ">=1.0.7"
51+
"mvslovers/crent370" = ">=1.0.8"
5252
"mvslovers/ufsd" = "=1.0.0-dev"
5353
"mvslovers/lua370" = ">=1.0.2"
5454
"mvslovers/mqtt370" = ">=1.0.3"
@@ -60,7 +60,7 @@ space = ["TRK", 150, 50, 30]
6060
name = "HTTPD"
6161
entry = "@@CRT0"
6262
options = ["SIZE=(4000K,40K)", "LIST", "MAP", "XREF", "RENT"]
63-
include = ["@@CRT1", "HTTPSTRT", "HTTPD"]
63+
include = ["@@CRT1", "HTTPSTRT", "HTTPD", "HTTPPRM"]
6464
setcode = "AC(1)"
6565

6666
[link.module.dep_includes]

samplib/httpd

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//HTTPD PROC M=HTTPPRM0,
2+
// D='SYS2.PARMLIB'
3+
//*
4+
//* HTTPD - HTTP Server STC Procedure
5+
//*
6+
//* Installation:
7+
//* Copy to SYS2.PROCLIB(HTTPD)
8+
//* Copy config member to SYS2.PARMLIB(HTTPPRM0)
9+
//*
10+
//* Starting: /S HTTPD
11+
//* /S HTTPD,M=HTTPPRM1 (alternate config member)
12+
//* /S HTTPD,D='MY.PARMLIB' (alternate parmlib dataset)
13+
//* Commands: /F HTTPD,DISPLAY CONFIG
14+
//* /F HTTPD,DISPLAY STATS
15+
//* /F HTTPD,HELP
16+
//* /F HTTPD,SHUTDOWN
17+
//* Stopping: /P HTTPD
18+
//*
19+
//HTTPD EXEC PGM=HTTPD,REGION=8M,TIME=1440
20+
//STEPLIB DD DISP=SHR,DSN=HTTPD.LINKLIB
21+
//SYSUDUMP DD SYSOUT=*
22+
//HTTPDERR DD SYSOUT=*
23+
//HTTPDOUT DD SYSOUT=*
24+
//HTTPDIN DD DUMMY
25+
//SNAP DD SYSOUT=*
26+
//HTTPDBG DD SYSOUT=*
27+
//HTTPSTAT DD SYSOUT=*
28+
//HTTPPRM DD DSN=&D(&M),DISP=SHR,FREE=CLOSE
29+
//HASPCKPT DD DISP=SHR,DSN=SYS1.HASPCKPT,UNIT=3350,VOL=SER=MVS000
30+
//HASPACE1 DD DISP=SHR,DSN=SYS1.HASPACE,UNIT=3350,VOL=SER=SPOOL1

samplib/httpprm0

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# HTTPD 4.0.0 Configuration
2+
#
3+
# Copy to SYS2.PARMLIB(HTTPPRM0)
4+
# Referenced by HTTPPRM DD in the STC JCL procedure.
5+
#
6+
# Format: KEY=VALUE (case-insensitive keys)
7+
# Lines starting with # or * are comments.
8+
#
9+
# --- Network ---
10+
PORT=8080
11+
BIND_TRIES=10
12+
BIND_SLEEP=10
13+
LISTEN_QUEUE=5
14+
#
15+
# --- Worker threads ---
16+
MINTASK=3
17+
MAXTASK=9
18+
CLIENT_TIMEOUT=10
19+
#
20+
# --- Security ---
21+
LOGIN=NONE
22+
#
23+
# --- Timezone ---
24+
# TZOFFSET=+01:00
25+
#
26+
# --- Codepage ---
27+
# CODEPAGE=CP037
28+
#
29+
# --- UFS Filesystem ---
30+
UFS=1
31+
DOCROOT=/www
32+
#
33+
# --- Debug ---
34+
DEBUG=0
35+
#
36+
# --- CGI Modules ---
37+
# Format: CGI=PROGRAM /url/path
38+
# No CGIs are registered by default.
39+
# Uncomment the lines below to enable them.
40+
#
41+
# CGI=MVSMF /zosmf/*
42+
# CGI=HTTPDSRV /.dsrv
43+
# CGI=HTTPDSL /dsl/*
44+
# CGI=HTTPJES2 /jes/*
45+
# CGI=HTTPLUA /lua/*
46+
# CGI=HTTPREXX /rexx/*
47+
# CGI=HTTPDM /.dm
48+
# CGI=HTTPDMTT /.dmtt
49+
# CGI=HELLO /hello
50+
#
51+
# --- Lua CGI Settings ---
52+
# CGILUA_DATASET=HTTPD.CGILUA
53+
# CGILUA_PATH=
54+
# CGILUA_CPATH=
55+
#
56+
# --- Statistics ---
57+
# CLIENT_STATS=1
58+
# CLIENT_STATS_MONTH_MAX=24
59+
# CLIENT_STATS_DAY_MAX=60
60+
# CLIENT_STATS_HOUR_MAX=48
61+
# CLIENT_STATS_MINUTE_MAX=120
62+
# CLIENT_STATS_DATASET=
63+
#

0 commit comments

Comments
 (0)