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
michalpokusa
c95290f390
Replaced route_handlers dict with _HTTPRoutes object in HTTPServer
2023-03-19 15:07:44 +00:00
michalpokusa
8e2967b293
Changed how routes are mapped to handler functions, added _HTTPRoutes
...
Added option to provide regex-like URLs using <> brackets
2023-03-19 15:02:36 +00:00
foamyguy
874d3ed886
Merge pull request #37 from matemaciek/main
...
Buffer_size improvements
2023-02-06 15:32:32 -06:00
Maciej Sokołowski
9808f15e2e
Auto-serve index.html for root path
2023-01-20 14:51:10 +01:00
Maciej Sokołowski
4e63771c3b
Expose buffer_size in response.send_file, adjust default to match the one in server
2023-01-20 09:57:19 +01:00
Radomir Dopieralski
20f50ac385
Allow sending raw bytes in the response
...
We now only encode the body if it has an encode method, which usually
means it's a string. This allows passing bytes, bytearray or memoryview.
I also changed the logic for sending a chunk, that avoids copying the
data unnecessarily. I believe this also fixes a bug, where the size of
unencoded chunk was sent, in characters, instead of encoded size, in
bytes.
2023-01-11 21:54:05 +01:00
michalpokusa
c609a821d5
Changed address to client_address to match CPython's http.server module naming
2023-01-02 17:22:53 +00:00
michalpokusa
c758e519c0
Changed root to root_path in docstrings
2022-12-28 17:44:05 +00:00
michalpokusa
d14a13a1c4
Fix: Content type not setting properly
2022-12-28 05:51:40 +00:00
michalpokusa
f0b61a721f
Prevented from calling .send() multiple times and added deprecation error if handler returns HTTPResponse
2022-12-26 01:52:39 +00:00
michalpokusa
4b61d74e1f
Fix: Missing chunk length in ending message due to .lstrip()
2022-12-26 01:21:51 +00:00
michalpokusa
c222d09a71
Changed send_chunk_body to send_chunk for unification
2022-12-24 06:26:23 +00:00
michalpokusa
a12d4abbc6
Minor changes to docstrings
2022-12-23 18:57:28 +00:00
michalpokusa
2ca4756bac
Changed HTTPResponse to use context managers
2022-12-23 11:57:27 +00:00
michalpokusa
00d3247825
Refactor for unifying the HTTPResponse API
2022-12-23 11:55:57 +00:00
michalpokusa
c1d2f55c46
Merge remote-tracking branch 'origin/main' into test
2022-12-23 11:54:37 +00:00
michalpokusa
aeb95a2932
Encoding body only once when constructing response bytes
2022-12-20 01:02:51 +00:00
michalpokusa
be20bb12e7
Black format changes
2022-12-19 21:15:05 +00:00
michalpokusa
d3adfd824c
Fixed wrong content length for multibyte characters
2022-12-19 20:26:24 +00:00
michalpokusa
d547c7fa39
Fixed and extended docstrings
2022-12-19 20:24:31 +00:00
michalpokusa
f1878b3ace
Replacing dict with HTTPHeaders in other modules
2022-12-19 20:24:31 +00:00
michalpokusa
aad7010218
Added HTTPHeaders
2022-12-19 19:35:20 +00:00
paul-1
4768bbd20a
Add Chunked Encoding to minimize memory usage for
...
large dynamic html pages.
2022-12-14 20:00:41 -05:00
paul-1
e66cfbfcb5
Add Cache-Control to headers.
2022-12-14 19:58:14 -05:00
Scott Povlot
7249a5ec76
Ensure the headers are not modified
2022-12-02 12:52:21 -05:00
michalpokusa
469f0eb9a0
Implemented processing 'Content-Length' header and limiting received bytes
2022-11-22 04:40:52 +00:00
michalpokusa
0d69a4c101
Fix: First header was skipped and headers were case-sensitive
2022-11-22 04:25:52 +00:00
michalpokusa
4a4cdfdbcd
Removed body attribute and added as property
2022-11-22 02:22:05 +00:00
michalpokusa
04805467cb
Changed default socket_timeout and made it possible to be a positive number only
2022-11-20 14:17:13 +00:00
michalpokusa
4a1a3a129d
Added option to pass status to HTTPResponse as tuple, overwrited eq method on HTTPStatus
2022-11-19 13:45:53 +00:00
michalpokusa
85d1c3cc89
Changed how incoming data is received
...
Solved problem when data is sent in chunks and is not received in full.
Bypassed ESP32 TCP buffer limit of 2880 bytes.
2022-11-19 02:08:04 +00:00
michalpokusa
eaea81d923
Added HTTPServer.socket_timeout
2022-11-19 02:07:31 +00:00
michalpokusa
0fe7bd7453
Fix: Wrong typing and return type in HTTPResponse._construct_response_bytes
2022-11-18 00:26:50 +00:00
michalpokusa
6585d3f709
Resolving rest of pylint and black errors
2022-11-14 00:34:05 +00:00
michalpokusa
21e20b6041
Preparing code for docs generation, black formatting, updating examples
2022-11-13 23:26:25 +00:00
michalpokusa
41edff8ceb
Added CommonHTTPStatus
2022-11-13 22:10:05 +00:00
michalpokusa
132d36c8ca
Added passing HTTPResponse headers to file response
2022-11-13 14:56:46 +00:00
michalpokusa
e7f0dea179
Added missing typing
2022-11-13 14:52:34 +00:00
michalpokusa
bc46b67e81
Fixed: Support for query params without value
2022-11-13 14:18:07 +00:00
michalpokusa
6c5e201420
Small refactor of HTTPRequest, added ability to process body bytes that are not utf-8 decodable
2022-11-13 14:03:49 +00:00
michalpokusa
4b3e4f9866
Refactor of MIMEType
2022-11-13 13:19:02 +00:00
michalpokusa
e0a117fedf
Removed blocking behavior of socket
2022-11-13 12:16:18 +00:00
michalpokusa
e06d0cd29c
Small changes across files, comments, typing
2022-11-13 12:15:31 +00:00
michalpokusa
9b49df8733
Unified root to root_path across all files
2022-11-13 09:58:09 +00:00
michalpokusa
9a021bd9ba
Refactor of HTTPResponse, addition of new attributes
2022-11-13 09:52:23 +00:00
michalpokusa
bb6ef752e0
Refactor in HTTPStatus
2022-11-12 23:37:48 +00:00
michalpokusa
c0ca616019
Moved previous functionality of _HTTPRequest to HTTPRoute, renamed routes to route_handlers
2022-11-12 21:40:55 +00:00
michalpokusa
450ee79bd7
Refactor of _HTTPRequest
...
Changed name and added new attributes to HTTPRequest like method, path, query_params, http_version, headers and body
2022-11-12 21:23:20 +00:00
michalpokusa
4101db8aee
Added HTTPMethod enum
2022-11-12 20:59:54 +00:00
michalpokusa
6892a93535
Splitted adafruit_httpserver into separate files
2022-11-12 19:47:50 +00:00