Skip to content

Commit

Permalink
simple web server support for static files (#21)
Browse files Browse the repository at this point in the history
* initial commit for communityWebServer kit
* can serve static files with correct headers
* support gzip Content-Encoding
* append index.html to dir url; fix buf overflow
* remove unused codes
* add comments
* refactoring; add tests for string operation
* improve wireshark sox dissector
* load 'bit32' when 'bit' module is missing
* add 'ack', 'ackMore', 'errorCode' display filter
* clean up
* several improvements/fixes
* fix compData handler bugs
* more sox filter fields support
* define fields for stream, but no implementation yet
* support configurable url prefix

* don't create StaticFileWeblet in static method '_sInit' like what
SpyWeblet does, let user to decide when to enable/disable it.

The current SpyWeblet is not possible to disable it unless uninstall the
web kit. I think we should modify it to be the same as StaticFileWeblet.
I will do it later to avoid this branch bloated.

* add webServer demo app
* use WebService logger, change log level to trace
  • Loading branch information
linsong authored and Vincent Wang committed May 3, 2019
1 parent 4414b35 commit 22f092b
Show file tree
Hide file tree
Showing 7 changed files with 542 additions and 45 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ sedona-*.zip
*.log
*.swo
.DS_Store
statics/*
88 changes: 88 additions & 0 deletions apps/webServer.sax
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?xml version='1.0'?>
<sedonaApp>
<schema>
<kit name="sys" />
<kit name="basicSchedule" />
<kit name="communityWebServer" />
<kit name="datetime" />
<kit name="datetimeStd" />
<kit name="func" />
<kit name="hvac" />
<kit name="inet" />
<kit name="logic" />
<kit name="math" />
<kit name="platUnix" />
<kit name="pstore" />
<kit name="sox" />
<kit name="timing" />
<kit name="types" />
<kit name="web" />
</schema>
<app>
<prop name="appName" val="demo"/>
<!-- /service -->
<comp name="service" id="1" type="sys::Folder">
<prop name="meta" val="33685505"/>
<!-- /service/plat -->
<comp name="plat" id="9" type="platUnix::UnixPlatformService">
<prop name="meta" val="17629185"/>
</comp>
<!-- /service/users -->
<comp name="users" id="3" type="sys::UserService">
<prop name="meta" val="16842753"/>
<!-- /service/users/admin -->
<comp name="admin" id="4" type="sys::User">
<prop name="cred" val="hE49ksThgAeLkWB3NUU1NWeDO54="/>
<prop name="perm" val="2147483647"/>
<prop name="prov" val="255"/>
</comp>
</comp>
<!-- /service/sox -->
<comp name="sox" id="5" type="sox::SoxService">
<prop name="meta" val="17104897"/>
</comp>
<!-- /service/web -->
<comp name="web" id="6" type="web::WebService">
<prop name="meta" val="17367041"/>
<prop name="port" val="8080"/>
<!-- /service/WebServ/StaticF -->
<comp name="StaticF" id="14" type="communityWebServer::StaticFileWeblet">
<prop name="meta" val="33685505"/>
<prop name="urlPrefix" val="doc"/>
</comp>
</comp>
<!-- /service/pstore -->
<comp name="pstore" id="11" type="pstore::PstoreService">
<prop name="meta" val="17956865"/>
</comp>
<!-- /service/time -->
<comp name="time" id="12" type="datetimeStd::DateTimeServiceStd">
<prop name="meta" val="18284545"/>
<prop name="utcOffset" val="32400"/>
<prop name="osUtcOffset" val="true"/>
</comp>
</comp>
<!-- /play -->
<comp name="play" id="10" type="sys::Folder">
<prop name="meta" val="34013185"/>
<!-- /play/rampA -->
<comp name="rampA" id="7" type="func::Ramp">
<prop name="meta" val="67371009"/>
<prop name="min" val="20.0"/>
<prop name="max" val="80.0"/>
</comp>
<!-- /play/rampB -->
<comp name="rampB" id="8" type="func::Ramp">
<prop name="meta" val="68288513"/>
</comp>
<!-- /play/adder -->
<comp name="adder" id="2" type="math::Add2">
<prop name="meta" val="386662401"/>
</comp>
</comp>
</app>
<links>
<link from="/play/rampA.out" to="/play/adder.in1"/>
<link from="/play/rampB.out" to="/play/adder.in2"/>
</links>
</sedonaApp>
39 changes: 39 additions & 0 deletions scode/webServer.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!--
- Sedona SCode manifest for a generic unix platform
-->

<sedonaCode
endian="little"
blockSize="4"
refSize="4"
main="sys::Sys.main"
debug="true"
test="true"
>

<!-- Kits -->
<depend on="sys 1.2" />
<depend on="sox 1.2" />
<depend on="inet 1.2" />
<depend on="web 1.2" />
<depend on="communityWebServer 1.2" />

<!-- Deprecated as of 1.2
<depend on="control 1.0" />
-->
<depend on="pstore 1.2" />
<depend on="datetime 1.2" />
<depend on="datetimeStd 1.2" />
<depend on="basicSchedule 1.2" />
<depend on="platUnix 1.2" />

<!-- These replace control kit as of 1.2 -->
<depend on="func 1.2" />
<depend on="hvac 1.2" />
<depend on="logic 1.2" />
<depend on="math 1.2" />
<depend on="timing 1.2" />
<depend on="types 1.2" />

</sedonaCode>

Loading

0 comments on commit 22f092b

Please sign in to comment.