OSError: [Errno 22] Invalid argument when serving files with last modified time before 1969-12-31 12:00 UTC on windows
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 36k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
Bug report
http.server.SimpleHTTPRequestHandler.send_head() does not check if a file's mtime is valid for gmtime() on windows.
An OSError: [Errno 22] Invalid argument exception will be raised which is normal according to the documentation.
https://github.com/python/cpython/blob/ef633e5000222a3dba74473c49d6a81fca0a44ec/Lib/http/server.py#L752
https://github.com/python/cpython/blob/ef633e5000222a3dba74473c49d6a81fca0a44ec/Lib/http/server.py#L766
I encounter this error when using windows built-in unzip functionality to unzip a windows WireGuard client exported zip file.
The zip file does not contain any timestamp information. And windows will not auto fill timestamp information when unzipping.
And win32 api GetFileInformationByHandle will report back a timestamp of -11635213907.559603
Your environment
- CPython versions tested on:
3.10.9,3.11.1,3.12.0a4+ - Operating system and architecture: windows 11 pro 22h2 OS build 22621.1105 amd64
Linked PRs
- gh-101036
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia da Lib/http/server.py, in http.server.SimpleHTTPRequestHandler.send_head(), soprattutto dalla gestione del timestamp del file attorno alle chiamate a gmtime() indicate. Riproduci il comportamento su Windows con un file il cui mtime preceda 1969-12-31, quindi esamina il PR collegato gh-101036. Il lavoro è completato quando servire un file di questo tipo non genera più OSError: [Errno 22].
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- web-dev
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100