DaNode - A home made web
server in D
Talk #dconf 2016 Berlin
Herr Dr. Danny Arends
Fachgebiet Züchtungsbiologie und molekulare Tierzüchtung
Lebenswissenschaftliche Fakultät
Humboldt-Universität zu Berlin
∗ Simple & Small codebase
∗ No plugins, single executable
∗ Portable ? Windows / Linux / ARM
∗ Dump a script in a folder,
Generate HTML
∗ Any language as CGI
∗ Domain names?
∗ No java anymore 
∗ Run my own homepage (php)
What I was looking for
∗ Install the brainfuck compiler
∗ Create a script
echo "++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.-
-------.>+.>." > www/dannyarends.nl/hello.brainfuck
∗ Update the supported mime-types
case ".brainfuck" : return CGI_FILE ~ "bfuck -n -C";
∗ Stop server, recompile and restart
As simple as
∗ Internet Information Services (Microsoft)
∗ Familiar web server, easy install
∗ No access to server source code
∗ Windows only
∗ Apache
∗ Full blown web server
∗ Complex setup, huge source code
∗ Different plugins change behavior
∗ I did not want to add plugins for every feature
∗ Too massive for what I wanted
Alternatives
∗ Vibe.d
∗ 0.7.4 - March 2012
∗ Looked very promising (async I/O, Templates)
∗ Features offered by vibe.d were limited
∗ Too high level for what I wanted
∗ Templated language for HTML
∗ No PHP support
∗ Changes were still quite common
∗ Hindsight: vibe.d would have been the better choice
Alternatives
∗ Any programming language as CGI
∗ As simple as in the brainfuck example
∗ Service many (secure) domains with a single server
∗ SSL using Deimos and Server Name Indication (SNI)
∗ Per website configurations
∗ Request redirection (Canonical URLs)
∗ Directory browsing
∗ Streamed and/or buffered file downloads
∗ Minimal memory foot-print
∗ < 2000 lines of code
DaNode Features
∗ Useful for quick and dirty tasks
∗ Running several domains for 4 years
∗ DaNode does not follow HTML specifications
∗ SSL is probably not very secure
∗ CGI is probably not very secure
∗ Perhaps replace core parts by vibe.d
∗ No unit-tests yet, but travis-ci
∗ Aiming for full code coverage
∗ Find people interested
Why this talk
Humboldt-Universität zu Berlin
dannyarends.nl
@DannyArends
github.com/DannyArends
Any and all feedback, help,
and/or pull requests are
appreciated
Any questions ?
Install the current DMD compiler:
https://dlang.org/download.html
git clone https://github.com/DannyArends/DaNode.git
cd DaNode
rdmd --build-only -O -gc -release -w danode/server.d
./danode/server –p 8080
Open firefox: http://localhost:8080/
Install DaNode

DaNode - A home made web server in D

  • 1.
    DaNode - Ahome made web server in D Talk #dconf 2016 Berlin Herr Dr. Danny Arends Fachgebiet Züchtungsbiologie und molekulare Tierzüchtung Lebenswissenschaftliche Fakultät Humboldt-Universität zu Berlin
  • 2.
    ∗ Simple &Small codebase ∗ No plugins, single executable ∗ Portable ? Windows / Linux / ARM ∗ Dump a script in a folder, Generate HTML ∗ Any language as CGI ∗ Domain names? ∗ No java anymore  ∗ Run my own homepage (php) What I was looking for
  • 3.
    ∗ Install thebrainfuck compiler ∗ Create a script echo "++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.- -------.>+.>." > www/dannyarends.nl/hello.brainfuck ∗ Update the supported mime-types case ".brainfuck" : return CGI_FILE ~ "bfuck -n -C"; ∗ Stop server, recompile and restart As simple as
  • 4.
    ∗ Internet InformationServices (Microsoft) ∗ Familiar web server, easy install ∗ No access to server source code ∗ Windows only ∗ Apache ∗ Full blown web server ∗ Complex setup, huge source code ∗ Different plugins change behavior ∗ I did not want to add plugins for every feature ∗ Too massive for what I wanted Alternatives
  • 5.
    ∗ Vibe.d ∗ 0.7.4- March 2012 ∗ Looked very promising (async I/O, Templates) ∗ Features offered by vibe.d were limited ∗ Too high level for what I wanted ∗ Templated language for HTML ∗ No PHP support ∗ Changes were still quite common ∗ Hindsight: vibe.d would have been the better choice Alternatives
  • 6.
    ∗ Any programminglanguage as CGI ∗ As simple as in the brainfuck example ∗ Service many (secure) domains with a single server ∗ SSL using Deimos and Server Name Indication (SNI) ∗ Per website configurations ∗ Request redirection (Canonical URLs) ∗ Directory browsing ∗ Streamed and/or buffered file downloads ∗ Minimal memory foot-print ∗ < 2000 lines of code DaNode Features
  • 7.
    ∗ Useful forquick and dirty tasks ∗ Running several domains for 4 years ∗ DaNode does not follow HTML specifications ∗ SSL is probably not very secure ∗ CGI is probably not very secure ∗ Perhaps replace core parts by vibe.d ∗ No unit-tests yet, but travis-ci ∗ Aiming for full code coverage ∗ Find people interested Why this talk
  • 8.
    Humboldt-Universität zu Berlin dannyarends.nl @DannyArends github.com/DannyArends Anyand all feedback, help, and/or pull requests are appreciated Any questions ?
  • 9.
    Install the currentDMD compiler: https://dlang.org/download.html git clone https://github.com/DannyArends/DaNode.git cd DaNode rdmd --build-only -O -gc -release -w danode/server.d ./danode/server –p 8080 Open firefox: http://localhost:8080/ Install DaNode