Commit graph

63 commits

Author SHA1 Message Date
foamyguy
fa365b0149 change to ruff 2025-05-16 16:11:43 +00:00
michalpokusa
b00f70f1c4 Added validation for root_path in FileResponse 2024-02-21 04:44:46 +00:00
michalpokusa
1c38bc8ca6 Added explicit typing for socketpool and socket with shared interface 2024-02-18 13:52:16 +00:00
michalpokusa
9911f35724 Added alternative adafruit_hashlib import and warning message in neither is present 2023-12-14 20:22:30 +00:00
michalpokusa
4ec5f9a3e6 Added cookies handling and example for it 2023-08-28 19:01:16 +00:00
michalpokusa
6031bece2c Added Headers.get_directive() and Headers.get_parameter()
@to get_parameter
2023-08-28 12:29:31 +00:00
michalpokusa
d743d1c6f3 Minor docstring, typing and encoding fixes
temp

to docs
2023-08-27 18:06:35 +00:00
michalpokusa
4ef72f1fd8 Refactor of Redirect response class to allow 301 and 302 codes 2023-08-27 02:26:29 +00:00
michalpokusa
4063b5a39b Updated Copyright headers 2023-07-30 20:09:30 +00:00
michalpokusa
9dfaf80288 Merge remote-tracking branch 'origin/main' into external-routes-websockets-sse 2023-07-18 18:41:40 +00:00
michalpokusa
d372f8e216 CI fixes, reformating etc. 2023-07-13 10:25:38 +00:00
michalpokusa
1e1ad58d17 Added Websocket class and SWITCHING_PROTOCOLS_101 2023-07-13 09:29:27 +00:00
michalpokusa
28ae6e5c27 Added SSEResponse class 2023-07-13 08:51:48 +00:00
michalpokusa
90085c301b Minor tweaks in _send_headers 2023-07-13 07:47:12 +00:00
michalpokusa
8fa70b69d0 Preparing for returning persistent connection responses 2023-07-13 07:38:25 +00:00
michalpokusa
537874f717 Skipping empty chunks of data in ChunkedResponse 2023-05-25 19:32:28 +00:00
michalpokusa
f95781a050 Rewrite of Response logic from context managers to returns, added some new types of response 2023-05-08 09:01:12 +00:00
michalpokusa
c299f9fdc9 Corrected typing in Response.send 2023-05-06 15:26:44 +00:00
michalpokusa
191e91c928 Changed format of debug logs, added Response.size, fix in send_chunk 2023-05-03 09:25:06 +00:00
michalpokusa
61135f152c Added checking if compatible send method is used 2023-04-29 15:14:36 +00:00
michalpokusa
5d533dadb7 Default .send_file to server's root_path 2023-04-28 11:06:27 +00:00
michalpokusa
85254e5b92 Changes to docstrings 2023-04-27 20:40:23 +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
ee7a8b06fb Major refactor of MIMETypes 2023-04-26 23:44:43 +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
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
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
d89e66e78e Added checking for .. and backslash in path, introduced custom exceptions 2023-04-16 09:31:28 +00:00
Neradoc
9ea26651f8 allow HEAD requests to files paths 2023-04-13 18:32:31 +02: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
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
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
f1878b3ace Replacing dict with HTTPHeaders in other modules 2022-12-19 20:24:31 +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