pypxe/PyPXE

HTTP: error: [Errno 22] Invalid argument

marrotte opened this issue · 6 comments

(venv) :PyPXE $ sudo python -m pypxe.server --debug http --dhcp --config cfg.json --http
2018-05-16 08:05:39,682 [INFO] PyPXE Starting TFTP server...
2018-05-16 08:05:39,683 [INFO] PyPXE Starting DHCP server...
2018-05-16 08:05:39,683 [WARNING] PyPXE.DHCP HTTP selected but iPXE disabled. PXE ROM must support HTTP requests.
2018-05-16 08:05:39,684 [INFO] PyPXE Starting HTTP server...
2018-05-16 08:05:39,685 [DEBUG] PyPXE.HTTP NOTICE: HTTP server started in debug mode. HTTP server is using the following:
2018-05-16 08:05:39,685 [INFO] PyPXE.HTTP Server IP: 0.0.0.0
2018-05-16 08:05:39,685 [INFO] PyPXE.HTTP Server Port: 80
2018-05-16 08:05:39,685 [INFO] PyPXE.HTTP Network Boot Directory: netboot
2018-05-16 08:05:39,686 [INFO] PyPXE PyPXE successfully initialized and running!
2018-05-16 08:05:45,083 [DEBUG] PyPXE.HTTP Recieved message from ('127.0.0.1', 55056)
2018-05-16 08:05:45,083 [DEBUG] PyPXE.HTTP <--BEGIN MESSAGE-->
2018-05-16 08:05:45,083 [DEBUG] PyPXE.HTTP 'GET /nsx/VMware-NSX-Manager-6.4.0-7564187.ova HTTP/1.1\r\nUser-Agent: Wget/1.18 (darwin16.0.0)\r\nAccept: /\r\nAccept-Encoding: identity\r\nHost: 127.0.0.1\r\nConnection: Keep-Alive\r\n\r\n'
2018-05-16 08:05:45,083 [DEBUG] PyPXE.HTTP <--END MESSAGE-->
2018-05-16 08:05:45,083 [DEBUG] PyPXE.HTTP Netboot: netboot, Target: nsx/VMware-NSX-Manager-6.4.0-7564187.ova
2018-05-16 08:05:45,084 [DEBUG] PyPXE.HTTP HTTP/1.1 200 OK
Content-Length: 2682234880

Exception in thread Thread-4:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "pypxe/http.py", line 98, in handle_request
connection.sendall(response)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
error: [Errno 22] Invalid argument

^C
Shutting down PyPXE...

Can you share more information regarding what triggered this stack trace? There is not enough information here to understand the issue.

icb- commented

Can you try updating to the latest master? The stack trace doesn't appear to match either the current master, or the most recent release.

(venv) :PyPXE$ sudo python -m pypxe.server --debug http --dhcp --config cfg.json --http
2018-05-16 11:48:51,009 [INFO] PyPXE Starting TFTP server...
2018-05-16 11:48:51,011 [INFO] PyPXE Starting DHCP server...
2018-05-16 11:48:51,011 [WARNING] PyPXE.DHCP HTTP selected but iPXE disabled. PXE ROM must support HTTP requests.
2018-05-16 11:48:51,012 [INFO] PyPXE Starting HTTP server...
2018-05-16 11:48:51,012 [DEBUG] PyPXE.HTTP NOTICE: HTTP server started in debug mode. HTTP server is using the following:
2018-05-16 11:48:51,012 [INFO] PyPXE.HTTP Server IP: 0.0.0.0
2018-05-16 11:48:51,012 [INFO] PyPXE.HTTP Server Port: 80
2018-05-16 11:48:51,012 [INFO] PyPXE.HTTP Network Boot Directory: netboot
2018-05-16 11:48:51,012 [INFO] PyPXE PyPXE successfully initialized and running!
2018-05-16 11:48:58,530 [DEBUG] PyPXE.HTTP Recieved message from ('127.0.0.1', 61256)
2018-05-16 11:48:58,530 [DEBUG] PyPXE.HTTP <--BEGIN MESSAGE-->
2018-05-16 11:48:58,530 [DEBUG] PyPXE.HTTP 'GET /nsx/nsx-manager.ova HTTP/1.1\r\nUser-Agent: Wget/1.18 (darwin16.0.0)\r\nAccept: /\r\nAccept-Encoding: identity\r\nHost: 127.0.0.1\r\nConnection: Keep-Alive\r\n\r\n'
2018-05-16 11:48:58,530 [DEBUG] PyPXE.HTTP <--END MESSAGE-->
2018-05-16 11:48:58,530 [DEBUG] PyPXE.HTTP Netboot: netboot, Target: nsx/nsx-manager.ova
Exception in thread Thread-4:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "pypxe/http.py", line 96, in handle_request
connection.send(response)
error: [Errno 22] Invalid argument

Are you able to give the httplargefile branch a go? I've modified the HTTP code to chunk from the input file rather than reading it all at once.

Bravo! Works like a champ. Thanks Rory.

Fix has been merged into master