Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#1772 closed defect (fixed)

REST broken: KeyError: 'CONTENT-LENGTH'

Reported by: tic20@… Owned by: Conrad Huang
Priority: normal Milestone: 0.9
Component: General Controls Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

The following bug report has been submitted:
Platform:        Linux-4.20.8-200.fc29.x86_64-x86_64-with-fedora-29-Twenty_Nine
ChimeraX Version: 0.9 (2019-03-09)
Description
The REST remote control interface appears to be broken in the current daily builds (tested today in both Windows and Linux). The traceback comes after I start the remote interface, then go to localhost:12345/cmdline.html in the browser and attempt to send the command 'open 1pmx'.

Log:
UCSF ChimeraX version: 0.9 (2019-03-09)  
© 2016-2019 Regents of the University of California. All rights reserved.  
How to cite UCSF ChimeraX  

> remotecontrol rest start port 12345

REST server started on host 127.0.0.1 port 12345  
\----------------------------------------  
Exception happened during processing of request from ('127.0.0.1', 59932)  
Traceback (most recent call last):  
File "/opt/UCSF/ChimeraX-daily/lib/python3.7/socketserver.py", line 316, in
_handle_request_noblock  
self.process_request(request, client_address)  
File "/opt/UCSF/ChimeraX-daily/lib/python3.7/socketserver.py", line 347, in
process_request  
self.finish_request(request, client_address)  
File "/opt/UCSF/ChimeraX-daily/lib/python3.7/socketserver.py", line 360, in
finish_request  
self.RequestHandlerClass(request, client_address, self)  
File "/opt/UCSF/ChimeraX-daily/lib/python3.7/socketserver.py", line 720, in
__init__  
self.handle()  
File "/opt/UCSF/ChimeraX-daily/lib/python3.7/http/server.py", line 426, in
handle  
self.handle_one_request()  
File "/opt/UCSF/ChimeraX-daily/lib/python3.7/http/server.py", line 414, in
handle_one_request  
method()  
File "/opt/UCSF/ChimeraX-daily/lib/python3.7/site-
packages/chimerax/rest_server/server.py", line 90, in do_GET  
for k, vl in self._parse_post().items():  
File "/opt/UCSF/ChimeraX-daily/lib/python3.7/site-
packages/chimerax/rest_server/server.py", line 129, in _parse_post  
parts = cgi.parse_multipart(self.rfile, pdict)  
File "/opt/UCSF/ChimeraX-daily/lib/python3.7/cgi.py", line 220, in
parse_multipart  
headers['Content-Length'] = pdict['CONTENT-LENGTH']  
KeyError: 'CONTENT-LENGTH'  
\----------------------------------------  




OpenGL version: 3.3.0 NVIDIA 410.93
OpenGL renderer: GeForce GTX 1070/PCIe/SSE2
OpenGL vendor: NVIDIA Corporation

Change History (6)

comment:1 by pett, 7 years ago

Component: UnassignedGeneral Controls
Milestone: 0.9
Owner: set to Conrad Huang
Platform: all
Project: ChimeraX
Status: newassigned
Summary: ChimeraX bug report submissionREST broken: KeyError: 'CONTENT-LENGTH'

comment:2 by Conrad Huang, 7 years ago

Status: assignedfeedback

Looks like Python failed to decode an incoming request. Can you describe which client and what request it was sending?

in reply to:  3 ; comment:3 by tic20@…, 7 years ago

I started the server in ChimeraX as:

remotecontrol rest start port 12345

Then, in the browser (Edge in Windows, Firefox in Linux), I went to 
localhost:12345/cmdline.html and entered 'open 1pmx' in the dialog box 
on that page.

On 2019-03-13 15:57, ChimeraX wrote:

comment:4 by Conrad Huang, 7 years ago

Status: feedbackaccepted

Urk. It's a Python 3.7 bug: https://bugs.python.org/issue34226
Not sure what to do about it yet. I'll try to compare the Python 3.6 version of cgi.py with the 3.7 version to see if there is any simple workaround.

comment:5 by Conrad Huang, 7 years ago

Resolution: fixed
Status: acceptedclosed

The (next successful, probably dated March 14, 2019) daily build should have a workaround. I just copied the 3.6 version of cgi.py into rest_server and used it instead of the standard 3.7 version. When the issue is fixed, we can revert back.

comment:6 by Conrad Huang, 7 years ago

Last edited 7 years ago by Conrad Huang (previous) (diff)
Note: See TracTickets for help on using tickets.