Hi,

The new patch tries to parse the vars in the URL then checks the content-type 
value before trying to parse the request body (the RFC doesn’t prevent to have 
vars in the URL and in the body).
Also, I have optimized parse_cgivars() by using an index to avoid a copy of the 
string, some deletes and a destroy.

Regards,
Franck


From: devel <devel-boun...@kannel.org> On Behalf Of Lamasuta, Franck, Vodafone 
Automotive
Sent: mercredi 17 juillet 2019 12:16
To: Alexander Malysh <amal...@kannel.org>
Cc: devel@kannel.org
Subject: RE: [PATCH] http PUT requests

I’m working on it…


From: Alexander Malysh <malys...@gmail.com<mailto:malys...@gmail.com>> On 
Behalf Of Alexander Malysh
Sent: vendredi 12 juillet 2019 15:01
To: Lamasuta, Franck, Vodafone Automotive 
<franck.lamas...@vodafone.com<mailto:franck.lamas...@vodafone.com>>
Cc: devel@kannel.org<mailto:devel@kannel.org>
Subject: Re: [PATCH] http PUT requests

Hi,

Am 11.07.2019 um 14:24 schrieb Lamasuta, Franck, Vodafone Automotive 
<franck.lamas...@vodafone.com<mailto:franck.lamas...@vodafone.com>>:

I thought again about it…
I guess you are concerned because the body of all POST or PUT requests would be 
parsed.
Of course this is bad!   ☺

exactly...

I think we have to check the value of the Content-Type header.

This is what we get from Micro Ocean:
Content-Type: application/x-www-form-urlencoded

Would it be ok to test this header before calling parse_cgivars() to parse the 
body?
Do you have another idea?

This should work.

Thanks,
Alex


Regards,
Franck


From: devel <devel-boun...@kannel.org<mailto:devel-boun...@kannel.org>> On 
Behalf Of Lamasuta, Franck, Vodafone Automotive
Sent: jeudi 11 juillet 2019 12:06
To: Alexander Malysh <amal...@kannel.org<mailto:amal...@kannel.org>>
Cc: devel@kannel.org<mailto:devel@kannel.org>
Subject: RE: [PATCH] http PUT requests

Hi Alexander,

This is what http_accept_request() logs (with my patch) when Micro Ocean 
submits a DLR:

2019-07-10 13:21:05 [5746] [7] DEBUG: HTTP: Got PUT request with 
url='/MOcean-Kannel/DLR' and 
body='mocean-from=33123456789&mocean-to=Mocean&mocean-dlr-status=1&mocean-msgid=0710212043806340&mocean-error-code=0'

As you can see, the query variables are in the body of the request. I think 
this is usual for a PUT (and for a POST).
To avoid code duplication, it seemed logical to slightly modify parse_cgivars() 
to parse the body.
How would you manage this?

Regards,
Franck


From: Alexander Malysh <malys...@gmail.com<mailto:malys...@gmail.com>> On 
Behalf Of Alexander Malysh
Sent: mardi 9 juillet 2019 08:42
To: Lamasuta, Franck, Vodafone Automotive 
<franck.lamas...@vodafone.com<mailto:franck.lamas...@vodafone.com>>
Cc: devel@kannel.org<mailto:devel@kannel.org>
Subject: Re: [PATCH] http PUT requests

Hi,

sorry for delay. Patch would be ok if not this part where you parse body for 
post and put request
as cgi vars. this is wrong. Please fix it and resubmit.

Thanks,
Alexander Malysh


Am 28.06.2019 um 10:58 schrieb Lamasuta, Franck, Vodafone Automotive 
<franck.lamas...@vodafone.com<mailto:franck.lamas...@vodafone.com>>:

Hi list,

Here is a patch to allow inbound http PUT requests in generic http connector.
It is required to implement Micro Ocean’s API for Delivery Reports: 
https://www.moceanapi.com/docs/#delivery-report

Regards,
Franck
<http_put.patch>


Attachment: http_put-v2.patch
Description: http_put-v2.patch

Reply via email to