OSError: [Errno 22] Invalid argument when serving files with last modified time before 1969-12-31 12:00 UTC on windows
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 36k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu tại Lib/http/server.py, trong http.server.SimpleHTTPRequestHandler.send_head(), đặc biệt là phần xử lý timestamp của tệp xung quanh các lệnh gọi gmtime() được tham chiếu. Tái hiện hành vi trên Windows với một tệp có mtime trước 1969-12-31, sau đó xem xét PR được liên kết gh-101036. Hoàn thành khi việc cung cấp một tệp như vậy không còn gây ra OSError: [Errno 22].
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- web-dev
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 25/100