質問するログイン新規登録

質問編集履歴

4

pythonのソースを修正

2021/11/18 14:37

投稿

syoshinsya-
syoshinsya-

スコア48

title CHANGED
File without changes
body CHANGED
@@ -21,8 +21,7 @@
21
21
  from io import TextIOWrapper
22
22
 
23
23
  sys.stdout = TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
24
- print("Content-Type: text/html;")
24
+ print("Content-Type: text/html;charset=UTF-8\n")
25
- print("charset=UTF-8\n")
26
25
  print()
27
26
 
28
27
  print("<!DOCTYPE html>"

3

pythonのソースを修正

2021/11/18 14:37

投稿

syoshinsya-
syoshinsya-

スコア48

title CHANGED
File without changes
body CHANGED
@@ -17,6 +17,9 @@
17
17
  ```python
18
18
  # hello.py
19
19
  # 表示させるページ
20
+ import sys
21
+ from io import TextIOWrapper
22
+
20
23
  sys.stdout = TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
21
24
  print("Content-Type: text/html;")
22
25
  print("charset=UTF-8\n")
@@ -32,6 +35,7 @@
32
35
  "haro-!"
33
36
  "</body>"
34
37
  "</html>")
38
+
35
39
  ```
36
40
 
37
41
  ```

2

補足に記述したブラウザの挙動の表現とサーバーログの追加

2021/11/18 11:41

投稿

syoshinsya-
syoshinsya-

スコア48

title CHANGED
File without changes
body CHANGED
@@ -49,7 +49,35 @@
49
49
  ChromeでアクセスしたログだけがあってEdgeでアクセスできていない...
50
50
 
51
51
  # 補足
52
- - リストChromeでアクセスした後にEdgeでURLをたたいても読み込みが続いて真っ白になってしまうが、
52
+ - リストChromeでアクセスした後にEdgeでURLをたたいても読み込みが続いてページの更新がされない状態になってしまうが、
53
53
  読み込み中にChromeの方を再読み込みするとEdgeも表示される
54
54
  - リスト読み込みが続いているときはサーバーのログに何もないことからそもそもローカルサーバーにアクセスできていない気がする
55
- - アクセスする順番がChrome→Edgeの場合はEdgeはが、Edge→Chromeの場合はChromeが表示できなくなる
55
+ - アクセスする順番がChrome→Edgeの場合はEdgeはが、Edge→Chromeの場合はChromeが表示できなくなる
56
+ - 読み込みの途中で正常な方のブラウザで再読み込みすると以下のエラーがサーバーログに流れた後に両方のブラウザでページが表示される
57
+ ```log
58
+ ----------------------------------------
59
+ Exception happened during processing of request from ('127.0.0.1', 58386)
60
+ Traceback (most recent call last):
61
+ File "C:\Users***\AppData\Local\Programs\Python\Python38\lib\socketserver.py", line 316, in _handle_request_noblock
62
+ self.process_request(request, client_address)
63
+ File "C:\Users***\AppData\Local\Programs\Python\Python38\lib\socketserver.py", line 347, in process_request
64
+ self.finish_request(request, client_address)
65
+ File "C:\Users***\AppData\Local\Programs\Python\Python38\lib\socketserver.py", line 360, in finish_request
66
+ self.RequestHandlerClass(request, client_address, self)
67
+ File "C:\Users***\AppData\Local\Programs\Python\Python38\lib\http\server.py", line 647, in __init__
68
+ super().__init__(*args, **kwargs)
69
+ File "C:\Users***\AppData\Local\Programs\Python\Python38\lib\socketserver.py", line 720, in __init__
70
+ self.handle()
71
+ File "C:\Users***\AppData\Local\Programs\Python\Python38\lib\http\server.py", line 427, in handle
72
+ self.handle_one_request()
73
+ File "C:\Users***\AppData\Local\Programs\Python\Python38\lib\http\server.py", line 415, in handle_one_request
74
+ method()
75
+ File "C:\Users***\AppData\Local\Programs\Python\Python38\lib\http\server.py", line 651, in do_GET
76
+ f = self.send_head()
77
+ File "C:\Users***\AppData\Local\Programs\Python\Python38\lib\http\server.py", line 997, in send_head
78
+ return self.run_cgi()
79
+ File "C:\Users***\AppData\Local\Programs\Python\Python38\lib\http\server.py", line 1213, in run_cgi
80
+ if not self.rfile._sock.recv(1):
81
+ ConnectionAbortedError: [WinError 10053] 確立された接続がホスト コンピューターのソウトウェアによって中止されました。
82
+ ----------------------------------------
83
+ ```

1

補足の追加

2021/11/18 06:52

投稿

syoshinsya-
syoshinsya-

スコア48

title CHANGED
File without changes
body CHANGED
@@ -46,4 +46,10 @@
46
46
  127.0.0.1 - - [18/Nov/2021 13:43:12] command: D:\program\hello_web\venv\Scripts\python.exe -u D:\program\hello_web\cgi-bin\hello.py ""
47
47
  127.0.0.1 - - [18/Nov/2021 13:43:12] CGI script exited OK
48
48
  ```
49
- ChromeでアクセスしたログだけがあってEdgeでアクセスできていない...
49
+ ChromeでアクセスしたログだけがあってEdgeでアクセスできていない...
50
+
51
+ # 補足
52
+ - リストChromeでアクセスした後にEdgeでURLをたたいても読み込みが続いて真っ白になってしまうが、
53
+ 読み込み中にChromeの方を再読み込みするとEdgeも表示される
54
+ - リスト読み込みが続いているときはサーバーのログに何もないことからそもそもローカルサーバーにアクセスできていない気がする
55
+ - アクセスする順番がChrome→Edgeの場合はEdgeはが、Edge→Chromeの場合はChromeが表示できなくなる