Re: Rest-API hanging on DELETE and OPTIONS not supported.

"John P. Rouillard" <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.devel
Message-ID <[email protected]>
Hi Ralf:

I have been getting bounces from your address, hopefully this makes it
through.

In message <[email protected]>,
Ralf Schlatterbeck writes:
>On Sat, Feb 02, 2019 at 03:36:33PM -0500, John P. Rouillard wrote:
>> However with this patch it brings up a new issue.  Trying to use the
>> new OPTIONS verb support or the DELETE or PATCH verbs hang. E.G.
>> 
>>     curl -vv -X DELETE -u admin -p --header 'Accept: application/json' \
>>         'https://rouilj.dynamic-dns.net/demo/rest/data/issue/22'
>> 
>> hangs and never comes back. The logs from the roundup-server instance
>>report:
>> 
>>    127.0.0.1 - - [02/Feb/2019 15:05:39] timeout
>> 
>> I should see:
>> 
>>   {"data": {"status": "ok"}}
>> 
>> returned from curl.
>...
>> I tracked the hang to the standard cgi.py python module in the
>> FieldStorage.__init__ method. The read_single() method gets called and
>> hangs forever since there is no data to read. I think it is trying to
>> read data as though the verb was POST. It looks like any verb other
>> than GET is treated like POST and tries to read data even if there is
>> no data.
>
>I *think* this might be due to your testing framework keeping open the
>http connection (for the next request).

My test framework is curl. Curl is not going to send a second
request. Also tcpdumping the link (I have http access on my local
network) doesn't show any response to the request.

>I had a similar issue when testing the REST patches using the python
>requests library: I originally used GET parameters when testing DELETE
>and PATCH which didn't work (but returned no parameters and did not
>hang, presumably because I didn't keep the connection open).

The GET method is special cased in cgi.py and it doesn't try to read a
payload from stdin. All other HTTP methods that call
cgi.py:FieldStorage get handled like POST and as a result it looks for
a payload.

>I think the patch is fine although I'm not sure we should be accepting
>GET-like parameters for PATCH and DELETE.

I am not sure what you mean by that. Do you have an example?

Have a great week.

--
				-- rouilj
John Rouillard
===========================================================================
My employers don't acknowledge my existence much less my opinions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.