Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Confusing error for malformed HTML (duplicate head tag)

Aperta
#274 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

Reproduce the failure using the attached broken2.html.txt and trace the livereload HTML script-injection path that produces Tornado's Content-Length error. The issue provides no source file or test entry point; done means malformed HTML yields robust behavior or a clear, user-facing error instead of the confusing server traceback.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Livereload gives confusing error messages when failing to inject its script tag into malformed HTML. See attached for an example of an HTML with a duplicate <head> tag.

[E 230918 10:51:35 web:1789] Uncaught exception GET /broken2.html (127.0.0.1)
    HTTPServerRequest(protocol='http', host='127.0.0.1:35729', method='GET', uri='/broken2.html', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/tornado/web.py", line 1704, in _execute
        result = await result
      File "/usr/lib/python3/dist-packages/tornado/web.py", line 2648, in get
        await self.flush()
      File "/usr/lib/python3/dist-packages/tornado/web.py", line 1094, in flush
        return self.request.connection.write_headers(
      File "/usr/lib/python3/dist-packages/tornado/http1connection.py", line 464, in write_headers
        data += self._format_chunk(chunk)
      File "/usr/lib/python3/dist-packages/tornado/http1connection.py", line 475, in _format_chunk
        raise httputil.HTTPOutputError(
    tornado.httputil.HTTPOutputError: Tried to write more data than Content-Length
[E 230918 10:51:35 web:1197] Cannot send error response after headers written

I understand the real error is mine and livereload works if I fix the HTML. But debugging it was confusing, particularly since I am new to livereload. The error output looks like some abstruse failure of the details of Tornado serving, not a simple user input problem.

I imagine injecting Javascript into all kinds of bad user input is hard! I suggest either doing something robust and simple so it's unlikely to fail or else some defensive error handling to catch this kind of problem and give the user an easy to understand error.

Thank you for livereload!
broken2.html.txt

Lingua principale
Python
Stelle
1.1k
Fork
148
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di lepture/python-livereload

Tutte le issue di lepture/python-livereload

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.