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
smet
79313b0644
Update httpserver.lua
...
fixed typo
2017-03-03 05:18:56 +01: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
f060295ef7
Remove print about server running from server code itself. Client can choose to do the prints from init.lua if client wants to, This seems more appropritate.
2016-12-26 13:44:41 -06:00
Marcos Kirsch
b84739dc1b
Minor documentation, variable renaming, refactoring to increase readability. Basically, I want the socket callbacks to receive a pointer to a function names onWhatever and I don't want other functions to have such names.
2016-02-21 22:14:01 -06:00
Marcos Kirsch
11ae46c96b
Improved print to show what the method is for a specific URI
2016-02-21 12:22:16 -06:00
Marcos Kirsch
e7db3dce7d
Moved BufferedConnection into its own file.
2016-02-16 22:45:14 -06:00
Marcos Kirsch
59e0218a72
Fix https://github.com/marcoskirsch/nodemcu-httpserver/issues/36
2016-02-15 23:19:29 -06:00
Marcos Kirsch
2f2fb26782
Several fixes and code cleanup. Gzipped files now work. Indentation cleaned up, Other small fixes:
2016-02-15 22:52:30 -06:00
Anton Andersen
1ddd47eaf9
Fix a memory leak when the connection is dropped by the client side
2016-02-15 12:46:54 +03:00
Philip Gladstone
f852959fa5
Handle the null write case
2015-11-28 21:00:34 -05:00
Philip Gladstone
8a195cb798
Reduce memory requirements a bit and fix weird issue in node_info.lua
...
example
2015-11-28 12:22:20 -05:00
Philip Gladstone
b4a2d02431
Fix the problem with the more modern SDK only allowing one outstanding
...
connection:send at a time. Long and short of it, don't use coroutine.yield
any more when serving content.
2015-11-22 13:39:03 -05:00
Hazar Karabay
b7f78481a2
File extension parsing fix
...
If a filename contains dots, extension was parsed as everything after
the first dot.
File extension must be what it is after the last dot.
Also includes a rewrited workaround for mimetypes if the requested file
gzip compressed.
2015-09-16 22:10:21 +03:00
Ryan Voots
ef340bc82a
Implement support for more arbitrary HTTP methods. Allows GET PUT and POST. With minor changes needed to support others
2015-08-31 18:28:03 -07:00
Hazar Karabay
13e2bfbe9c
Use gzipped file if exists
...
If foo.html is requested and not found, foo.html.gz is checked and if
exists, will served.
2015-08-29 15:30:37 +03:00
Marcos
e61f3c7556
Merge pull request #27 from samdieck/master
...
Added basic auth. Added static settings file
2015-07-19 09:20:25 -05:00
Marcos Kirsch
ba44745194
remove trailing whitespace
2015-07-19 09:04:25 -05:00
Samuel A. Dieck
be63ee0093
Added basic auth. Added static settings file
2015-07-18 23:17:14 -05:00
TJ Borromeo
925af34b1a
De-duplicate wifi.sta.getip() call
...
Technically, if the wifi.sta.getip() or wifi.ap.getip() call return invalid ip addresses, you shouldn't assume that it's running. However, the lack of that type of check means that this change will function similarly without incurring another function call in a constrained stack/heap environment.
2015-04-24 14:54:13 -07:00
Marcos Kirsch
ead632d131
Refactoring - function for sending headers is now in its own file. All errors are sent using coroutine. Some other memory usage improvements
2015-04-19 23:42:58 -05:00
Marcos Kirsch
7bd9b266be
Improved error handling, although some bugs still persist
2015-04-18 23:19:08 -05:00
Artem Pastukhov
92a44592d5
Fix end of line
2015-04-01 08:57:18 +03:00
Artem Pastukhov
0120924403
Fix some typos
2015-03-31 10:02:33 +03:00
Marcos Kirsch
75ed944678
Refactored server to move request parsing into a separate file. This allows the server to be used in firmware builds with floating point enabled.
2015-03-22 22:02:38 -05:00
Marcos Kirsch
84f7a06aa1
No longer crashes when request is HTTP 1.0
2015-03-22 11:45:39 -05:00
Marcos Kirsch
a43fc20230
Remove debug traces, handle long filenames
2015-03-15 22:12:51 -05:00
Marcos Kirsch
d5fcc71c23
Move function definition to inside the socket listen argument list. This is harder to follow, but allows the coroutine to be unique since it is now part of the closure. Multiple files can be served simultaneously this way.
2015-03-10 22:15:52 -05:00
Marcos Kirsch
77920f4a94
Big refactoring: server now uses a separate thread that yields and then resumes on 'sent'. This allows us to serve large files. Moved serving of error pages and serving of static files into separate scripts httpserver-error.lua and httpserver-static.lua
2015-02-28 16:39:06 -06:00
Marcos Kirsch
d73bd73211
Added back improved version of validateMethod
...
Reduced MIME types list to save memory
Fixed argument parsing! this is biggie
General cleanup and bugfixes
2015-02-22 16:25:31 -06:00
Marcos Kirsch
c0d6218397
Support for Lua scripts
2015-02-15 16:51:21 -06:00
Marcos Kirsch
51bfb3a8cc
Minor cleanup
2015-02-14 21:31:08 -06:00
Marcos Kirsch
5d4887927d
MIME types now correct
...
Support for different mime types based on the file extension.
Added some code for parsing the arguments after the file
(index.html?a=b&c=d) but it’s not in use yet.
2015-02-14 19:38:38 -06:00
Marcos Kirsch
b75d610e6a
Shortened code.
...
Reimplemented parseRequest (simpler). Shortened onReceive()
2015-02-14 01:48:49 -06:00
Marcos Kirsch
c33ba75395
Send files in little chunks, large files work now.
2015-02-14 01:19:38 -06:00
Marcos Kirsch
8272d8f59c
Functional GET can serve text files up to 1 KB
2015-02-14 00:22:23 -06:00
Marcos Kirsch
3d4e4ee501
First pass of server. Not fully operational. Basic GET works, serves requested file. But server runs out of memory or/and only works with one connection.
2015-02-08 22:09:20 -06:00
Marcos Kirsch
1c709b838b
Minimalistic server can be started and returns hardcoded message, prior to cleanup
2015-02-06 21:54:25 -06:00
Marcos Kirsch
f52e8f47e6
Add all files to source control even though they are messy and don't do much yet
2015-02-02 19:01:24 -06:00