Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python3 http and websocket handler fails #2149

Closed
totaam opened this issue Feb 15, 2019 · 3 comments
Closed

python3 http and websocket handler fails #2149

totaam opened this issue Feb 15, 2019 · 3 comments
Labels

Comments

@totaam
Copy link
Collaborator

totaam commented Feb 15, 2019

Issue migrated from trac ticket # 2149

component: android | priority: major | resolution: fixed

2019-02-15 05:27:58: antoine created the issue


With python3, we get:

2019-02-15 12:26:36,402 peer: (0, -1, -1)
2019-02-15 12:26:36,402 new_connection((<flags G_IO_IN of type GLib.IOCondition>, <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('0.0.0.0', 10000)>)) sock=<socket.socket fd=30, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 10000), raddr=('127.0.0.1', 41160)>, socket_info=('0.0.0.0', 10000), timeout=0.1, address=('127.0.0.1', 41160), peername=('127.0.0.1', 41160). timeout=0.1
2019-02-15 12:26:36,402 SocketConnection(<socket.socket fd=30, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 10000), raddr=('127.0.0.1', 41160)>, ('127.0.0.1', 10000), ('127.0.0.1', 41160), ('127.0.0.1', 41160), 'tcp', {})
2019-02-15 12:26:36,402 Connection(('127.0.0.1', 41160), 'tcp', {})
2019-02-15 12:26:36,402 handle_new_connection(tcp socket: 127.0.0.1:10000 <- 127.0.0.1:41160, <socket.socket fd=30, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 10000), raddr=('127.0.0.1', 41160)>, ('127.0.0.1', 41160), 'tcp', ('127.0.0.1', 41160), ('0.0.0.0', 10000)) sockname=('127.0.0.1', 10000), target=('127.0.0.1', 41160)
2019-02-15 12:26:36,653 socket tcp socket: 127.0.0.1:10000 <- 127.0.0.1:41160 peek: got 367 bytes
2019-02-15 12:26:36,653 socket peek=b'GET /js/Protocol.js HTTP/1.1\r\nHost: localhost:10000\r\nConnection: keep-alive\r\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.20 Safari/537.36\r\nAccept: */*\r\nReferer: http://localhost:10000/\r\nAccept-Encoding: gzip, deflate, br\r\nAccept-Language: en-GB,en;q=0.9,fr-FR;q=0.8,fr;q=0.7,th-TH;q=0.6,th;q=0.5,en-US;q=0.4\r\n\r\n'
2019-02-15 12:26:36,653 socket peek hex=474554202f6a732f50726f746f636f6c2e6a7320485454502f312e310d0a486f73743a206c6f63616c686f73743a31303030300d0a436f6e6e656374696f6e3a206b6565702d616c6976650d0a557365722d4167656e743a204d6f7a696c6c612f352e3020285831313b204c696e7578207838365f363429204170706c655765
2019-02-15 12:26:36,653 socket peek line1=b'GET /js/Protocol.js HTTP/1.1'
2019-02-15 12:26:36,653 may_wrap_socket(..) peek_data=b'474554202f6a732f50726f746f636f6c2e6a7320485454502f312e310d0a486f73743a206c6f63616c686f73743a31303030300d0a436f6e6e656374696f6e3a206b6565702d616c6976650d0a557365722d4167656e743a204d6f7a696c6c612f352e3020285831313b204c696e7578207838365f363429204170706c655765624b69742f3533372e333620284b48544d4c2c206c696b65204765636b6f29204368726f6d652f37332e302e333638332e3230205361666172692f3533372e33360d0a4163636570743a202a2f2a0d0a526566657265723a20687474703a2f2f6c6f63616c686f73743a31303030302f0d0a4163636570742d456e636f64696e673a20677a69702c206465666c6174652c2062720d0a4163636570742d4c616e67756167653a20656e2d47422c656e3b713d302e392c66722d46523b713d302e382c66723b713d302e372c74682d54483b713d302e362c74683b713d302e352c656e2d55533b713d302e340d0a0d0a' from 127.0.0.1:41160
2019-02-15 12:26:36,653 start_http_socket(tcp, tcp socket: 127.0.0.1:10000 <- 127.0.0.1:41160, False, ..) http proto=http, line1=b'GET /js/Protocol.js HTTP/1.1'
2019-02-15 12:26:36,653 New http GET request received from 127.0.0.1:41160 for '/js/Protocol.js'
2019-02-15 12:26:36,653 start_http(tcp, tcp socket: 127.0.0.1:10000 <- 127.0.0.1:41160, False, http GET, ('127.0.0.1', 41160)) www dir=/usr/share/xpra/www, headers dir=/usr/share/xpra/http-headers
2019-02-15 12:26:36,653 may_wrap_socket(..)=(False, tcp socket: 127.0.0.1:10000 <- 127.0.0.1:41160, None)
2019-02-15 12:26:36,654 send_head() script(/js/Protocol.js)=None
2019-02-15 12:26:36,654 translate_path(/js/Protocol.js)=/usr/share/xpra/www/js/Protocol.js
2019-02-15 12:26:36,654 guess_type(/usr/share/xpra/www/js/Protocol.js)=text/javascript
2019-02-15 12:26:36,654 accept-encoding=['gzip', 'deflate', 'br']
2019-02-15 12:26:36,654 sending pre-compressed file '/usr/share/xpra/www/js/Protocol.js.br'
2019-02-15 12:26:36,654 "GET /js/Protocol.js HTTP/1.1" 200 -
2019-02-15 12:26:36,654 may_reload_headers() http headers time={'/usr/share/xpra/http-headers': 1540297043.2877665}, mtime=1540297043.2877665
2019-02-15 12:26:36,654 
Traceback (most recent call last):
  File "/usr/lib64/python3.7/site-packages/xpra/server/server_core.py", line 1172, in start_http
    WebSocketRequestHandler(sock, frominfo, new_websocket_client, self._www_dir, self._http_headers_dir, scripts)
  File "/usr/lib64/python3.7/site-packages/xpra/net/websockets/handler.py", line 28, in __init__
    HTTPRequestHandler.__init__(self, sock, addr, web_root, http_headers_dir, script_paths)
  File "/usr/lib64/python3.7/site-packages/xpra/server/http_handler.py", line 59, in __init__
    BaseHTTPRequestHandler.__init__(self, sock, addr, server)
  File "/usr/lib64/python3.7/socketserver.py", line 720, in __init__
    self.handle()
  File "/usr/lib64/python3.7/http/server.py", line 426, in handle
    self.handle_one_request()
  File "/usr/lib64/python3.7/http/server.py", line 415, in handle_one_request
    self.wfile.flush() #actually send the response if not already done.
ValueError: flush of closed file
2019-02-15 12:26:36,654 Error: http GET request failure
2019-02-15 12:26:36,654  for client 127.0.0.1:41160:
2019-02-15 12:26:36,654  flush of closed file

The websocket connection almost works, goes to "established" state then drops out.

@totaam
Copy link
Collaborator Author

totaam commented Feb 20, 2019

2019-02-20 05:27:40: antoine changed status from new to closed

@totaam
Copy link
Collaborator Author

totaam commented Feb 20, 2019

2019-02-20 05:27:40: antoine set resolution to fixed

@totaam
Copy link
Collaborator Author

totaam commented Feb 20, 2019

2019-02-20 05:27:40: antoine commented


Fixed in r21737. See also #853

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant