Commit graph

100 commits

Author SHA1 Message Date
michalpokusa
191e91c928 Changed format of debug logs, added Response.size, fix in send_chunk 2023-05-03 09:25:06 +00:00
michalpokusa
33d6b25c5e Refactor of _Route and _Routes, added append_slash 2023-05-03 09:25:06 +00:00
michalpokusa
a5be235a96 Added stopping server on Ctrl-C and debug message on stop 2023-05-01 00:47:00 +00:00
michalpokusa
dbdbacd7f4 Added Server.debug for verbose messages during development 2023-04-30 23:26:49 +00:00
michalpokusa
0607776e7a Added host and port attributes to Server 2023-04-30 21:05:59 +00:00
michalpokusa
e1d3e3b820 Added method for verifying that server can be started on given host:port 2023-04-30 21:03:24 +00:00
michalpokusa
e5f506b9ba Added Request.json() 2023-04-30 20:13:42 +00:00
michalpokusa
752dcaf343 Returning from serve_forever on KeyboardInterrupt 2023-04-30 11:18:42 +00:00
michalpokusa
61135f152c Added checking if compatible send method is used 2023-04-29 15:14:36 +00:00
michalpokusa
07782b68e7 Removed accidentally commited leftover 2023-04-29 13:34:37 +00:00
michalpokusa
eba7a91146 Added Server.stop 2023-04-29 00:02:04 +00:00
michalpokusa
19148a5d1e Extensive updates and expansion of docs and examples 2023-04-28 12:23:54 +00:00
michalpokusa
223086d275 Added imports directly from adafruit_httpserver 2023-04-28 11:09:42 +00:00
michalpokusa
5d533dadb7 Default .send_file to server's root_path 2023-04-28 11:06:27 +00:00
michalpokusa
15b00cb1ba Added server parameter to Request 2023-04-28 11:06:27 +00:00
michalpokusa
85254e5b92 Changes to docstrings 2023-04-27 20:40:23 +00:00
michalpokusa
e5ddaaf0d7 Refactor of .poll and .server_forever, added option to disable filesystem access 2023-04-26 23:57:34 +00:00
michalpokusa
18d4a537b1 Changed positional url parameters to keyword 2023-04-26 23:51:43 +00:00
michalpokusa
ee67bdbbb2 _Route now respects "/" suffix of path 2023-04-26 23:51:43 +00:00
michalpokusa
ffa62d90be Replaced decorator that prevents sending Response multiple times with method
IDE was getting confused by decorated method and was not displaying the type hint properly
2023-04-26 23:51:43 +00:00
michalpokusa
142c89ba6a Added option to restrict access to whole Server with Authentication 2023-04-26 23:46:43 +00:00
michalpokusa
ee7a8b06fb Major refactor of MIMETypes 2023-04-26 23:44:43 +00:00
michalpokusa
33fecc9827 Allowed passing multiple methods at the same time to .route 2023-04-25 21:27:12 +00:00
michalpokusa
4224ac87c4 Replaced CommonHTTPStatus with direct values 2023-04-25 21:27:12 +00:00
michalpokusa
d4a8a8dc3f Removed HTTP... prefix from class names 2023-04-25 21:27:10 +00:00
michalpokusa
75ac0f2b49 Added authentication logic, AuthenticationError, UNAUTHORIZED_401 status 2023-04-25 21:26:15 +00:00
michalpokusa
0fff602370 Replaced public header_body_bytes by private methods 2023-04-24 15:11:48 +00:00
foamyguy
0850abad7b
Merge pull request #45 from foxy82/main
Fix infinite loop when requesting too quickly
2023-04-24 09:35:39 -05:00
michalpokusa
394c6f3952 Merge commit 'a8b68f153b72b8c022eceec254abe129cf5f5802' into prevent-parent-directory-access 2023-04-19 17:10:38 +00:00
anecdata
a8b68f153b
Merge pull request #48 from Neradoc/respond-to-file-head
Allow HEAD requests to files paths
2023-04-19 11:57:46 -05:00
michalpokusa
bef9f76720 Removing unnecessary slash in front of filename 2023-04-16 12:16:51 +00:00
michalpokusa
8a4f5c4bbe Extracted multiple send calls logic into decorator 2023-04-16 12:16:51 +00:00
michalpokusa
a545ca73d2 Added missing FORBIDDEN_403 2023-04-16 09:32:21 +00:00
michalpokusa
0467a276e2 Updated HTTPServer constructors to use "/static" as root path 2023-04-16 09:32:21 +00:00
michalpokusa
d89e66e78e Added checking for .. and backslash in path, introduced custom exceptions 2023-04-16 09:31:28 +00:00
michalpokusa
e7a2debc67 Minor changes in comments 2023-04-14 02:53:09 +00:00
michalpokusa
77bc821c38 Moved root_path from start and server_forever methods to constructor 2023-04-13 23:23:13 +00:00
Neradoc
9ea26651f8 allow HEAD requests to files paths 2023-04-13 18:32:31 +02:00
Neradoc
f9cf90f2d2 Allow no route to be defined for only serving static files 2023-04-13 17:34:39 +02:00
foxy82
1649a45700
Update server.py
Ensure unexpected OSError isn't swallowed.
2023-04-03 12:31:00 +01:00
foxy82
fc07ed4bef
Update response.py
Fix linting issue
2023-04-03 12:27:54 +01:00
foxy82
1063a01ee4
Fix infinite loop when requesting too quickly
On the Pico W we can get in an infinite loop if we request pages too quickly. This is because we get an OSError 32 Broken Pipe back from which we can't recover.
I've made it so any of the unexpected errors will be re-raised.

Fixes this issue:
https://github.com/adafruit/Adafruit_CircuitPython_HTTPServer/issues/44
2023-04-03 12:10:28 +01:00
michalpokusa
7ddc32a38e Removed unnecessary indentation in docstring example 2023-04-03 09:25:45 +00:00
michalpokusa
d5817b0abd Refactor for removing the need for saving last match group 2023-04-01 18:36:55 +00:00
michalpokusa
994a7e87c0 Minor changes to repr of _HTTPRoute and _HTTPRoutes 2023-03-20 04:12:02 +00:00
michalpokusa
813c53296b Optimization, reduced number of re.match calls per request 2023-03-20 04:05:14 +00:00
michalpokusa
e2a4761eef Made variable name and docstring more verbose 2023-03-20 03:49:23 +00:00
michalpokusa
cf6903599f Removed old deprecation error 2023-03-20 03:11:05 +00:00
michalpokusa
030390a252 Fix: Prevent creating empty query param 2023-03-19 15:49:21 +00:00
michalpokusa
78cfa0e022 Updated examples and added new ones hat present added functionality 2023-03-19 15:49:21 +00:00