[issue25534] SimpleHTTPServer throwed an exception due to negtive st_mtime attr in file

2015-11-06 Thread Martin Panter
Martin Panter added the comment: I assume it affects Python 3, though I suspect the exception is OSError, not ValueError. But it would be good if someone with Windows (or other affected OS) could confirm. I think the server should serve the file, with just a best-effort attempt to serve the t

[issue25534] SimpleHTTPServer throwed an exception due to negtive st_mtime attr in file

2015-11-06 Thread Terry J. Reedy
Terry J. Reedy added the comment: Does this affect 3.x also? I would expect that it does. The question for this issue is whether the program should stop on a gmtime error and say "I will not serve this file until you fix the modification time." or whether it should catch and workaround the pr

[issue25534] SimpleHTTPServer throwed an exception due to negtive st_mtime attr in file

2015-11-04 Thread Xiang Zhang
Xiang Zhang added the comment: You're right. Actually I do think of timezone when I do the experiment. But I think different timezone will only affect the hour. It turns out I should learn more about time. -- ___ Python tracker

[issue25534] SimpleHTTPServer throwed an exception due to negtive st_mtime attr in file

2015-11-04 Thread Martin Panter
Martin Panter added the comment: Perhaps you have a timezone set (I don’t). This might work better: touch -d "1 Jan 1900 UTC" test My thinking is if os.stat() returns a negative timestamp from the OS (GNU C library in the case of Linux), it may be worth trying gmtime() on that value since it

[issue25534] SimpleHTTPServer throwed an exception due to negtive st_mtime attr in file

2015-11-04 Thread Xiang Zhang
Xiang Zhang added the comment: I'm afraid we can't say negative epoch is handled successfully on Linux. Use $ touch -d "1 Jan 1900" test as a test, time.gmtime(os.fstat(f.fileno()).st_mtime) gives time.struct_time(tm_year=1899, tm_mon=12, tm_mday=31, tm_hour=15, tm_min=54, tm_sec=17, tm_wday=6

[issue25534] SimpleHTTPServer throwed an exception due to negtive st_mtime attr in file

2015-11-02 Thread Martin Panter
Martin Panter added the comment: I think your test file’s time is lost on the web server. On Linux it is pretty easy to make a file with an arbitrary time; maybe Windows has an equivalent: $ touch -d "1 Jan 1900" test I experimented with Wine, and it seems gmtime() raises ValueError on Python

[issue25534] SimpleHTTPServer throwed an exception due to negtive st_mtime attr in file

2015-11-02 Thread Sean Wang
Sean Wang added the comment: upload a sample test file -- Added file: http://bugs.python.org/file40929/test ___ Python tracker ___ ___

[issue25534] SimpleHTTPServer throwed an exception due to negtive st_mtime attr in file

2015-11-02 Thread Sean Wang
New submission from Sean Wang: I transfered a file from remote Debian host to my local Windows 10 host using SecureFX. I found that the file's last modifed date was ‎1900‎/‎1‎/1‎,‏‎0:00:00 on Windows. I tried to serve this file to be downloaded, and it crashed as follows: Exception happened du