smolver development log, part 10 - CGI

Intro

This is the tenth in a planned series of posts (well, eleventh if you count the announcement) where I'll share my experience writing smolver, my Gemini server software, written in Swift.

You can find the previous iterations below.

=> smolver Devlog

v1.2.0

What's changed?

Known issues

Scripts have no execution time limit.

CGI requests which contain a URL path after the executable name will not resolve, and a 51 (not found) will be returned. Consequently, the PATH_INFO environment variable passed in to CGI scripts will always be empty. As a workaround, stick to query parameters for now. The CGI subsystem is capable of detecting script requests with paths, but the file routing logic that sits on top of it will bail out before ever even attempting the CGI code in this scenario.

Scripts can only return data of the following mime types:

Code metrics

Overall, this feature required significant code changes, yet still was much simpler and less stressful than the client certificate implementation.

Running cloc on smolver production code v1.1.0 returns:

cloc Sources
      13 text files.
      13 unique files.
      0 files ignored.

github.com/AlDanial/cloc v 1.86  T=0.12 s (111.6 files/s, 17625.0 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Swift                           13            267            365           1422
-------------------------------------------------------------------------------
SUM:                            13            267            365           1422
-------------------------------------------------------------------------------

Running cloc on smolver production code v1.2.0 returns:

cloc Sources
      24 text files.
      24 unique files.
      0 files ignored.

github.com/AlDanial/cloc v 1.86  T=0.14 s (166.3 files/s, 20404.8 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Swift                           24            374            632           1939
-------------------------------------------------------------------------------
SUM:                            24            374            632           1939
-------------------------------------------------------------------------------

These numbers do not include smolver's dependencies nor unit tests.

Running cloc on smolver test code v1.1.0 returns:

cloc Tests
       1 text file.
       1 unique file.
       0 files ignored.

github.com/AlDanial/cloc v 1.86  T=0.09 s (11.3 files/s, 19733.6 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Swift                            1            247            122           1376
-------------------------------------------------------------------------------

Running cloc on smolver test code v1.2.0 returns:

cloc Tests
       16 text files.
       16 unique files.
       0 files ignored.

github.com/AlDanial/cloc v 1.86  T=0.18 s (87.5 files/s, 25757.9 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Swift                           11            706            442           3490
Bourne Shell                     4              9              0             34
Python                           1              7              0             23
-------------------------------------------------------------------------------
SUM:                            16            722            442           3547
-------------------------------------------------------------------------------

Since SocketServer, a dependency, required some changes as well, I'll also include line changes for it.

Running cloc on SocketServer production code v0.0.18 returns:

cloc Sources
       7 text files.
       7 unique files.
       0 files ignored.

github.com/AlDanial/cloc v 1.86  T=0.07 s (102.4 files/s, 10138.4 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Swift                            4             87            116            436
XML                              1              0              0             24
C/C++ Header                     1              6             18              3
YAML                             1              0              0              3
-------------------------------------------------------------------------------
SUM:                             7             93            134            466
-------------------------------------------------------------------------------

Running cloc on SocketServer production code v0.0.19 returns:

cloc Sources
       7 text files.
       7 unique files.
       0 files ignored.

github.com/AlDanial/cloc v 1.86  T=0.07 s (106.4 files/s, 11778.8 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Swift                            4            100            136            485
XML                              1              0              0             24
C/C++ Header                     1              6             18              3
YAML                             1              0              0              3
-------------------------------------------------------------------------------
SUM:                             7            106            154            515
-------------------------------------------------------------------------------

These numbers do not include SocketServer's dependencies, including but not limited to BlueSSLService.

That is a net change of 517 lines to smolver production code, 2171 lines to smolver unit tests, and 49 lines to SocketServer, for a total increase of 2737 lines. Incidentally, this means this feature added almost as many lines of code as already existed in the previous version.

Proxy Information
Original URL
gemini://ainent.xyz/devlog/smolver/2023-05-18-smolver-development-log-part-10.gmi
Status Code
Success (20)
Meta
text/gemini; charset=utf-8; lang=en
Capsule Response Time
1324.382653 milliseconds
Gemini-to-HTML Time
0.665843 milliseconds

This content has been proxied by September (3851b).