293 Commits

Author SHA1 Message Date
Manoël Trapier
6c7e451663 Change text/plain to application/octet-stream (#126) 2019-11-14 12:01:01 -06:00
seregaxvm
f13a10a01f reformat html (#124) 2019-11-14 11:59:54 -06:00
Gregor Hartmann
ca4fb20c00 Serve static pages efficiently. Fix #53 (#118)
* 1st draft to serve static files faster

* Allow serving 5 images in a page

the 6th image cannot be served as the esp does not open more than 5 connections at the same time

* win the prize

* Update comments
2019-11-14 11:58:56 -06:00
Fractal147
9f4d7a9988 Fixed unnecessary globals as in issue #113. (#122)
* Fixed global assignment that should be local

Made result variable be local, see Issue #113

* Made global variable local

Made ASCII variable be local, see Issue #113

* Made more variables local

Related to Issue #113. questionMarkPos, and b,c,d,e,f all are global in scope, and are not cleared from memory, so leak.
Frankly, b, c, d, e, and f are not used either, but will now get GC'd later, if they ever were assigned, so not problematic
line 114 also has _ and i to make local too, so were put on their own line.
i on line 24 also was unnecessarily global, and undetected in issue #113

* Made module more local

Made the basicAuth table local in scope. Since it is returned when dofile is called in httpserver.lua, that already has a correctly scoped table, 'auth'. This is related to issue #113, and should reduce memory loss to globals

* Made bufferedConnection local

bufferedConnection was global and didn't have to be. Part of issue #113.
Now no longer remains in _G (globals table) after a connection has closed.
2018-01-14 22:03:37 -06:00
Gregor Hartmann
7c8fe9c164 Upload for all files fix 119 (#120)
* allow uploading files not only to http + replace symbol images by unicode symbols

allow uploading files to root dir and http.
+ replace symbol images by unicode symbols

* backend for uploading arbitrary files

* fix uploading to http
2018-01-14 22:02:51 -06:00
Gregor Hartmann
5cf303de79 make cars dynamic to load 1 to 6 cars (#114)
For lazy people like me for not having to change the page by hand every
time.
+ adding 2 more cars.
2017-10-02 11:15:12 -05:00
Manoël Trapier
ab9a5d365f Use file.exists instead of open/close when relevant (#112) 2017-10-02 11:14:26 -05:00
Gregor Hartmann
6158d4b5ba support changes json API (#116)
use sjson instead of cjson
Also take care of backward compatibility before 2.1
2017-10-02 11:13:39 -05:00
Gregor Hartmann
c67ed16e10 Support long filenames in upload (#115)
appending '.dnl' to the filename shortens the available filename length by 4 chars. Now a long filename ist cut off first and then the dnl is appended resulting in a unique but short enough temp filename.
2017-10-02 08:50:47 -05:00
Dmitry
a70fa745b0 Small fix to upload form (#117)
Fixed bug when you cannot browse or D&D same file multiple times without reloading the whole page.
2017-10-02 08:49:49 -05:00
Manoël Trapier
b5baf6cd48 Fix mistake in config file (#107) 2017-09-04 20:42:47 -05:00
Manoël Trapier
28fbb6e7a7 now user proper table based parameter for wifi.ap.setip instead of a string (#106) 2017-09-03 17:40:38 -05:00
Gerhard Schwärzler
0f852665ec WiFi configuration using new, table based API (#105) 2017-07-26 16:25:14 -05:00
Marcos Kirsch
dacaf31dc6 Get README.md is up to date. 2017-07-02 22:40:40 -05:00
Marcos
7b25c727fe Make authenticated username available to scripts. (#100)
See node_info.lua for usage example.
2017-07-02 21:44:26 -05:00
Marcos
a2ebdee334 Trivial typos in http/counter.html (#99)
* Handle "nil", add more info

* Split up subnet mask, move unit to the end.

* typos
2017-07-02 21:37:40 -05:00
Gregor Hartmann
a17a0d40ca fix #96 Basic HTTP Authentication (#98) 2017-07-02 10:54:30 -05:00
Marcos Kirsch
251522299a Save as UTF-8 with DOM so browser can render correctly. 2017-07-01 22:28:31 -05:00
Marcos Kirsch
2bd72a8337 fix typos 2017-07-01 22:26:20 -05:00
Marcos
2bdb2d458c Improve node info.lua (#95)
* Handle "nil", add more info

* Split up subnet mask, move unit to the end.
2017-07-01 22:19:38 -05:00
Marcos
7cdbe0ffd0 Move init.lua code into 3 smaller files. Consolidate server configuration. (#94)
* Move server initialization out of init.lua and into new httpserver-init.lua

* Use wildcard for finding server files to upload.

* Break init.lua up into 3 files. Move all configuration to httpserver.conf.

New files are:
* httpserver-compile.lua
* httpserver-wifi.lua
* httpserver-init.lua
2017-07-01 22:01:45 -05:00
Marcos
adde150009 Overhaul garage door example (#93)
* script for controlling garage that is aware of door states

* Overhaul garage door example

Hardware now calls for reed relay in order to be able to tell the state
of the switch. This way, we can have distinct open/close operations
that error if the door is already in that state. Allows for potential
better integration with home automation systems.

* Prepare for push to GitHub

* Restore defaults

* Make HTTP auth realm match zeroconf networking name
2017-07-01 15:18:11 -05:00
Marcos
a96ebc6196 Merge pull request #92 from HHHartmann/LoadTestPageload
Add stresstest reload page
2017-06-01 21:45:44 -05:00
Gregor
1a364c3585 Add stresstest reload page 2017-06-01 22:36:30 +02:00
Marcos
59665a1a87 Merge pull request #86 from HHHartmann/WrongParameter
httpserver-header.lc requires the file extension not the MIME type
2017-05-31 22:02:02 -05:00
Marcos
737477c725 Merge pull request #90 from HHHartmann/BugFixErrorpage
use correct code for erropage instead of failing
2017-05-31 21:47:42 -05:00
Marcos
a09b4b4758 Merge pull request #91 from HHHartmann/BetterLoggingAndMoreCloseConnections
Improve logging and cleanup when ConnectionThread failes
2017-05-31 21:43:23 -05:00
Gregor
c44deb097c using args.code now 2017-06-01 04:36:29 +02:00
Gregor
122bb889c9 comment out print statement 2017-06-01 04:31:10 +02:00
Gregor
f24d6e908b Fix typo 2017-06-01 04:28:52 +02:00
Gregor
addda8dbe7 use correct code for erropage instead of failing
Sorry I didn't see this earlier
2017-05-31 22:27:29 +02:00
Gregor
d68dfc75f9 Merge remote-tracking branch 'refs/remotes/marcoskirsch/master' into BetterLoggingAndMoreCloseConnections 2017-05-31 21:19:38 +02:00
Gregor
3b0e3d0aab Merge remote-tracking branch 'refs/remotes/marcoskirsch/master' into development 2017-05-31 21:16:52 +02:00
Marcos
b6b3fec539 Merge pull request #89 from HHHartmann/FilterInvalidRequest
filter invalid requests
2017-05-29 22:41:01 -05:00
Marcos
593f82fc0a Merge pull request #88 from HHHartmann/WrongParameter2
Call to log had wrong parameters
2017-05-29 22:40:23 -05:00
Marcos
578454b254 Merge pull request #87 from HHHartmann/ErrorWithHeader
use httpserver-header.lua in httpserver-error.lua implementation
2017-05-29 22:39:47 -05:00
Marcos
42f9b17e8a Merge pull request #85 from HHHartmann/apNulError
fix nodeinfo_lua for AP more.
2017-05-29 22:37:51 -05:00
Gregor
e4d829b6c9 Improve Connection Close handling
close connection on coroutine errors and improve logging around closieg
connections.
Release memory warlier
2017-05-29 21:25:35 +02:00
Gregor
f7bb7303e2 filter invalid requests
sometimes I observe requests which are malformed (seem to be binary
data) so everything that does not have a method and request (url)
defined gets kicked.
2017-05-29 21:10:51 +02:00
Gregor
9b10383cb6 Call to log had wrong parameters
The parameter should be the connection itself. Log then calls getpeer on
it
2017-05-29 21:04:39 +02:00
Gregor
9b33c564db use httpserver-header.lua in httpserver-error.lua implementation
Add all HTTP response codes used in the project
allow extra headers to be passed
2017-05-29 20:55:42 +02:00
Gregor
3833ec8a7b httpserver-header.lc requires the file extension not the MIME type 2017-05-29 19:13:30 +02:00
Gregor
54b6525805 fix nodeingo_lua for AP more.
wifi.sta.getip() is nul in AP mode
2017-05-29 18:51:48 +02:00
Marcos
90cb4e47aa Merge pull request #79 from stephanMettler/master
Update httpserver.lua
2017-03-03 08:08:28 -05:00
smet
79313b0644 Update httpserver.lua
fixed typo
2017-03-03 05:18:56 +01:00
Marcos Kirsch
2dea3c9daa Restart if can't connect or connection is lost
Use wifi.eventmon to start server once we have IP, rather than checking
in a loop.
Use wifi.eventmon to restart server if connection is lost.
Use a timer to check if we ever even got a connection after 30 seconds.
Cleaned some other things up.
2017-02-05 08:42:16 -06:00
Marcos Kirsch
6ab6fcfff1 Modify for more standard hardware Wemos D1 Pro and its relay shield. 2017-02-04 23:18:16 -06:00
Marcos Kirsch
cc2173e334 Improve wording, ordering of links 2017-02-04 22:23:44 -06:00
Marcos Kirsch
2e25a63807 Improved logging via serial.
Created a single log function that prints a standard message that
includes IP and port of client. Remove or commented out other debug
prints.
2017-02-04 21:50:57 -06:00
Marcos Kirsch
6efa4ce3c0 Add simple text example 2017-01-27 22:22:31 -06:00