welcome to r6v4.app

r6v4 is my github name. this web site shows my app.

email-0:linshunzhi@vip.163.com
email-1:r6v4@pm.me

r6v4/h1d1

h1d1 is a fast and free linux web server, but it is not open source.

download

;;version:20251231    
;;md5:5bdae06382ca05fe639e06432c6d757e   
;;runtime:linux>=5.4,glibc>=2.27.

download links:

news

;;1:Fixed kvdb part does not work on centos and fedora, 
;;	because without bzip2 library link (h1d1-2025-12-28).
;;2:Fixed an issue where duplicate kvdb messages were entered 
;;	due to the state not being updated (h1d1-2025-12-25).
;;3:The code for the user-level session-close function has been fixed, 
;;	and it now closes the session correctly 
;;	without getting stuck in a loop (2025-12-21).

usage

## sudo apt install p7zip-full                         ;
7z x h1d1-2025-12-28_x86-64_linux-504_gencgc.7z        ;
cd h1d1-2025-12-28_x86-64_linux-504_gencgc/            ;
cp     404.html                          /tmp/404.html ;
cp     liblmdb.so.0.0.0              /lib64/liblmdb.so ;
cp     librocksdb.so.7.10.2       /lib64/librocksdb.so ;
./h1d1-2025-12-28           \
    --addr  127.0.0.1       \
    --port  8080            \
    --host  127.0.0.1       \
    --menu  /tmp/           \
    --list  cache.txt       \
    --file  kvdb.txt        \
    --node  node.txt        \
    --room  256MB           \
    --will  1               \
    --back  1               \
    --deny  deny.txt        \
    --core  8               \
    --user  user.txt        # &

help

* is alway have, 
+ is when need, 
% is will renew after 8 seconds,
# is obsolete

server ip address           --addr  127.0.0.1   *   
server port                 --port  8080        *   
server host name            --host  localhost   *   
html directory              --menu  /tmp/       *   
run worker group number     --core  8           *   8
renew cache time            --time  5minute     +       #
cache max count             --size  10000000    +       #
rocksdb configure file      --file  kvdb.txt    +   
consed room before gc       --room  256MB       +   
user kvdb right manage      --user  user.txt    + % 
other cache list            --list  cache.txt   + % 
web node proxy configure    --node  node.txt    + % 
deny ipv4 address list      --deny  deny.txt    + % 
0 no handshake timeout      --good  0           +   0   #
0 not always return 404     --back  0           +   0
1 is only local connect     --zone  0           +   0   #
1 multi process server      --will  1           +   1
crt file path               --crt   server.crt  *       #
key file path               --key   server.key  *       #

test

on a single-processor i5-10400f 
with 6 cores and 12 threads, 
h1d1 can reach C610K, 
h2o can reach C570K, 
nginx can reach C280K, 
drogon can reach C100K.

plus

test on 384core768thread computer, change arg of --core option.
2t 4t 8t 16t 32t 64t 128t
473k 663k 1085k 1685k 1074k 297k 883k
--will set 1, open multi-process on same port.
2p(256t) 4p(512t) 8p(1024t) 16p(2048t)
2027k 2553k 2870k 3050k

more

--addr

web server ip address.eg 127.0.0.1 .

--port

web server port eg 80 .

--host

web server host name eg localhost .

--menu

web server html menu eg /tmp/ .

--list

path to configure big file cache eg cache.txt .
in cache.txt:
url1 file1
url2 file2
urls files

--file

file path of configure lmdb eg kvdb.txt .
in kvdb.txt:
url
password

--node

path of configure reverse proxy eg node.txt .
in node.txt:
url1 url2 url3 urls
node1 node2 nodes

--room

consed room space size before gc eg 256MB .

--will

will server start in other process eg 1.

--back

is is always return 404 when url error eg 1.

--deny

path of deny ip-address list file eg deny.txt .
in deny.txt:
ipv4-address-1
ipv4-address-2
ipv4-address-s

--core

start worker group number eg 12 .

--user

path of configure rocksdb online eg user.txt .
in user.txt:
token1 permission-set1
token2 permission-set2
tokens permission-sets

for more help info please see help.txt file in same directory

kvdb

works on ubuntu(18.04 or newer) and debian.

centos and fedora or rhel need bzip devel package and libfile

sudo yum install bzip2-devel
sudo ln -s libbz2.so.1 libbz2.so.1.0
kvdb-part provides on-disk and on-memory interfaces
on-disk by rocksdb  use box set get del
on-memory by lmdb   use let put see rem 
    
    box path ;to init kvdb named path by open file or new
        send-example:box path \r\n
        send-length:11
        back-example:path
        back-length:4
    
    set path key-length val-length ;to set a kv in kvdb
        send-example:set path 3 5 \r\nKeyValue
        send-length:23
        back-example:Key
        back-length:3
    
    get path key-length ;to get the value of the key
        send-example:get path 3 \r\nKey
        send-length:16
        back-example:Value
        back-length:5
    
    del path key-length ;to delete the key
        send-example:del path 3 \r\nKey
        send-length:16
        back-example:Key
        back-length:3
    
    lmdb-env: 
        :IF-DOES-NOT-EXIST      :create
        :SYNCHRONIZED           nil
        :MAX-DBS                64
        :MAX-READERS            1024
        :MAP-SIZE               (* 1024 1024 64)
        :SUBDIR                 t
        :SYNC                   nil
        :META-SYNC              nil
        :READ-ONLY              nil
        :LOCK                   t
        :MEM-INIT               t
    
    let same as box
    put same as set
    see same as get
    rem same as del
//php-code
$socket=socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
socket_connect($socket,'127.0.0.1',8080);

//box
$message0="box mybox \r\n";
$length0=strlen($message0);
$message1="POST /12345 HTTP/1.1\r\nHost: 127.0.0.1\r\nContent-Length: ". (string)$length0 . "\r\nX-Password: 54321\r\n\r\n" . $message0;

echo $message1 . "\r\n------\r\n";
socket_send($socket,$message1,strlen($message1),0);

$data = "";
$result = socket_recv($socket,$data,1024,0);
echo $data . "\r\n------\r\n";

sleep(1);

//set
$key0="mykey";
$keylength0=strlen($key0);
$value0="the-value";
$valuelength0=strlen($value0);
$message0="set mybox " . (string)$keylength0 . " " . (string)$valuelength0 . " \r\n" . $key0 . $value0;
$length0=strlen($message0);
$message1="POST /12345 HTTP/1.1\r\nHost: 127.0.0.1\r\nContent-Length: ". (string)$length0 . "\r\nX-Password: 54321\r\n\r\n" . $message0;

echo $message1 . "\r\n------\r\n";
socket_send($socket,$message1,strlen($message1),0);

$data = "";
$result = socket_recv($socket,$data,1024,0);
echo $data . "\r\n------\r\n";

sleep(1);

$key0="anotherkey";
$keylength0=strlen($key0);
$value0="the-value-of-key";
$valuelength0=strlen($value0);
$message0="set mybox " . (string)$keylength0 . " " . (string)$valuelength0 . " \r\n" . $key0 . $value0;
$length0=strlen($message0);
$message1="POST /12345 HTTP/1.1\r\nHost: 127.0.0.1\r\nContent-Length: ". (string)$length0 . "\r\nX-Password: 54321\r\n\r\n" . $message0;

echo $message1 . "\r\n------\r\n";
socket_send($socket,$message1,strlen($message1),0);

$data = "";
$result = socket_recv($socket,$data,1024,0);
echo $data . "\r\n------\r\n";

sleep(1);

//get
$key0="anotherkey";
$keylength0=strlen($key0);
$message0="get mybox " . (string)$keylength0 ." \r\n". $key0;
$length0=strlen($message0);
$message1="POST /12345 HTTP/1.1\r\nHost: 127.0.0.1\r\nContent-Length: ". (string)$length0 . "\r\nX-Password: 54321\r\n\r\n" . $message0;

echo $message1 . "\r\n------\r\n";
socket_send($socket,$message1,strlen($message1),0);

$data = "";
$result = socket_recv($socket,$data,1024,0);
echo $data . "\r\n------\r\n";

sleep(1);

$key0="notfoundkey";
$keylength0=strlen($key0);
$message0="get mybox " .(string)$keylength0 . " \r\n" . $key0;
$length0=strlen($message0);
$message1="POST /12345 HTTP/1.1\r\nHost: 127.0.0.1\r\nContent-Length: ". (string)$length0 . "\r\nX-Password: 54321\r\n\r\n" . $message0;

echo $message1 . "\r\n------\r\n";
socket_send($socket,$message1,strlen($message1),0);

$data = "";
$result = socket_recv($socket,$data,1024,0);
echo $data . "\r\n------\r\n";

sleep(1);

//del
$key0="anotherkey";
$keylength0=strlen($key0);
$message0="del mybox " . (string)$keylength0 . " \r\n" . $key0;
$length0=strlen($message0);
$message1="POST /12345 HTTP/1.1\r\nHost: 127.0.0.1\r\nContent-Length: ". (string)$length0 . "\r\nX-Password: 54321\r\n\r\n" . $message0;

echo $message1 . "\r\n------\r\n";
socket_send($socket,$message1,strlen($message1),0);

$data = "";
$result = socket_recv($socket,$data,1024,0);
echo $data . "\r\n------\r\n";

sleep(1);

$key0="anotherkey";
$keylength0=strlen($key0);
$message0="get mybox " . (string)$keylength0 ." \r\n".$key0;
$length0=strlen($message0);
$message1="POST /12345 HTTP/1.1\r\nHost: 127.0.0.1\r\nContent-Length: ". (string)$length0 . "\r\nX-Password: 54321\r\n\r\n" . $message0;

echo $message1 . "\r\n------\r\n";
socket_send($socket,$message1,strlen($message1),0);

$data = "";
$result = socket_recv($socket,$data,1024,0);
echo $data . "\r\n------\r\n";

sleep(1);

//get-in-chunk
$key0="mykey";
$keylength0=strlen($key0);
$message0="get mybox " . (string)$keylength0 ." \r\n";
$message1=$key0;
$length0=strlen($message0);
$length1=strlen($message1);
$length2=$length0+$length1;
$message2="POST /12345 HTTP/1.1\r\nHost: 127.0.0.1\r\nContent-Length: ". (string)$length2 . "\r\nX-Password: 54321\r\n\r\n" . $message0;

echo $message2 . "\r\n------\r\n";
socket_send($socket,$message2,strlen($message2),0);

sleep(1);

echo $message1 . "\r\n------\r\n";
socket_send($socket,$message1,strlen($message1),0);

$data = "";
$result = socket_recv($socket,$data,1024,0);
echo $data . "\r\n------\r\n";
POST /12345 HTTP/1.1
Host: 127.0.0.1
Content-Length: 12
X-Password: 54321

box mybox 

------
HTTP/1.1 200 OK
Connection: Keep-Alive
Keep-Alive: timeout=6666, max=12345
Content-Type: application/octet-stream
Accept-Ranges: none
Content-Length: 5
Content-Encoding: identity
Server: h1d1
X-Frame-Options: sameorigin

mybox
------
POST /12345 HTTP/1.1
Host: 127.0.0.1
Content-Length: 30
X-Password: 54321

set mybox 5 9 
mykeythe-value
------
HTTP/1.1 200 OK
Connection: Keep-Alive
Keep-Alive: timeout=6666, max=12345
Content-Type: application/octet-stream
Accept-Ranges: none
Content-Length: 5
Content-Encoding: identity
Server: h1d1
X-Frame-Options: sameorigin

mykey
------
POST /12345 HTTP/1.1
Host: 127.0.0.1
Content-Length: 44
X-Password: 54321

set mybox 10 16 
anotherkeythe-value-of-key
------
HTTP/1.1 200 OK
Connection: Keep-Alive
Keep-Alive: timeout=6666, max=12345
Content-Type: application/octet-stream
Accept-Ranges: none
Content-Length: 10
Content-Encoding: identity
Server: h1d1
X-Frame-Options: sameorigin

anotherkey
------
POST /12345 HTTP/1.1
Host: 127.0.0.1
Content-Length: 25
X-Password: 54321

get mybox 10 
anotherkey
------
HTTP/1.1 200 OK
Connection: Keep-Alive
Keep-Alive: timeout=6666, max=12345
Content-Type: application/octet-stream
Accept-Ranges: none
Content-Length: 16
Content-Encoding: identity
Server: h1d1
X-Frame-Options: sameorigin

the-value-of-key
------
POST /12345 HTTP/1.1
Host: 127.0.0.1
Content-Length: 26
X-Password: 54321

get mybox 11 
notfoundkey
------
HTTP/1.1 200 OK
Connection: Keep-Alive
Keep-Alive: timeout=6666, max=12345
Content-Type: application/octet-stream
Accept-Ranges: none
Content-Length: 0
Content-Encoding: identity
Server: h1d1
X-Frame-Options: sameorigin


------
POST /12345 HTTP/1.1
Host: 127.0.0.1
Content-Length: 25
X-Password: 54321

del mybox 10 
anotherkey
------
HTTP/1.1 200 OK
Connection: Keep-Alive
Keep-Alive: timeout=6666, max=12345
Content-Type: application/octet-stream
Accept-Ranges: none
Content-Length: 10
Content-Encoding: identity
Server: h1d1
X-Frame-Options: sameorigin

anotherkey
------
POST /12345 HTTP/1.1
Host: 127.0.0.1
Content-Length: 25
X-Password: 54321

get mybox 10 
anotherkey
------
HTTP/1.1 200 OK
Connection: Keep-Alive
Keep-Alive: timeout=6666, max=12345
Content-Type: application/octet-stream
Accept-Ranges: none
Content-Length: 0
Content-Encoding: identity
Server: h1d1
X-Frame-Options: sameorigin


------
POST /12345 HTTP/1.1
Host: 127.0.0.1
Content-Length: 19
X-Password: 54321

get mybox 5

------
mykey
------
HTTP/1.1 200 OK
Connection: Keep-Alive
Keep-Alive: timeout=6666, max=12345
Content-Type: application/octet-stream
Accept-Ranges: none
Content-Length: 9
Content-Encoding: identity
Server: h1d1
X-Frame-Options: sameorigin

the-value
------

Thank you for visiting my site.