Giter VIP home page Giter VIP logo

Comments (4)

michalpokusa avatar michalpokusa commented on July 29, 2024

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.

anecdata avatar anecdata commented on July 29, 2024

@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 avatar jun2sak commented on July 29, 2024

@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.

jun2sak avatar jun2sak commented on July 29, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.