Comments (4)
I can confirm that this is a solution to the problem, this is a leftover from the time when I was preparing code to return images as bytes, which I abandoned later. In the end the whole response
is being .encode("utf-8")
so this seems to be the correct fix for the problem. Currently I am working on overhaul of headers handling. I will include a fix for that in my next PR.
from adafruit_circuitpython_httpserver.
@jun2sak would you mind testing out PR 29? You can get the .py
files from the PR "Files Changed" tab, or the .mpy
files from the "Checks" tab.
from adafruit_circuitpython_httpserver.
@jun2sak would you mind testing out PR 29? You can get the
.py
files from the PR "Files Changed" tab, or the.mpy
files from the "Checks" tab.
In my environment, the problem I reported is resolved with the .py
files from the PR 29.
from adafruit_circuitpython_httpserver.
Using PR 29 files, I found another problem.
When I access a page that does not exist in the CircuitPython http server, as in $ curl http://192.168.xx.xx/noexists
, I got an error in the server REPL console:
[srv.py]
@server.route("/test")
def base(request):
return HTTPResponse(content_type='text/html;charset=UTF-8',body=page_html)
server.serve_forever(str(wifi.radio.ipv4_address))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "srv.py", line 31, in <module>
File "/lib/adafruit_httpserver/server.py", line 75, in serve_forever
File "/lib/adafruit_httpserver/server.py", line 177, in poll
File "/lib/adafruit_httpserver/response.py", line 110, in send
File "/lib/adafruit_httpserver/response.py", line 131, in _send_response
File "/lib/adafruit_httpserver/response.py", line 78, in _construct_response_bytes
AttributeError: 'NoneType' object has no attribute 'setdefault'
Using the original version, I got just
$ curl http://192.168.xx.xx/noexists
404 Not Found /noexists
and no error in REPL console.
from adafruit_circuitpython_httpserver.
Related Issues (20)
- Create an httpserver_simpletest example HOT 7
- How do I safely disable all access to filesystem? HOT 1
- Rapid requests causing hangs HOT 2
- PyPi Release not importable
- Setting the hostname - Pico W HOT 2
- mdns setting error - trying to set a custom hostname HOT 5
- Yielding data from an async task to a chunked response HOT 24
- Release notes has bad link to Docs HOT 2
- Submitting empty form, or forms with only checkboxes, causes crash in web server HOT 2
- request.form_data.get(...) returns the string "None" if a field doesn't exist HOT 2
- "ImportError: no module named 'hashlib'" on the WIZnet W5500-EVB-Pico HOT 7
- instructions error HOT 1
- Simple Test (examples/httpserver_simpletest_auto.py) error on M5stack Timer Camera X HOT 2
- CircuitPython 9.0.0 will require SO.REUSEADDR for socket reuse HOT 1
- Airlift Support? HOT 11
- HTTPS Server now works on ESP32-S3 but MemoryError on Pico W and ESP32-S2
- Pico W EOPNOTSUPP On CircuitPython 9.0.0 HOT 2
- HTTPServer stops working on CircuitPython version >= 9.0 HOT 3
- RPI Pico W Circuitpython Webserver on AP HOT 5
- add support for "multipart/x-mixed-replace" (for streaming video) HOT 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adafruit_circuitpython_httpserver.