GoyaPtyLtd / BaseElements-Plugin

FileMaker Pro plugin used for BaseElements to provide file, dialog and XSLT functions.
http://www.goya.com.au/baseelements/plugin
154 stars 51 forks source link

BE_HTTP_ResponseHeaders returns multiple values when doing 301 redirects #225

Open nickorr opened 2 months ago

nickorr commented 2 months ago

Describe the bug

When you're doing a HTTP GET and the url has a 301 redirect AND you've set CURLOPT_FOLLOWLOCATION on, then afterwards when you get individual headers, you can get multiple values in response.

To Reproduce

BE_CurlSetOption ( "CURLOPT_FOLLOWLOCATION" ; True ) BE_HTTP_GET ( "https://static1.squarespace.com/static/5ead103e48edc3660e493426/5ee5bbf876031e0b0e55b842/66ac41049c6bb940a1199941/1716119884025/PhotoRoom-20230530_221048_16.png" ; "PhotoRoom-20230530_221048_16.png" )

Then BE_HTTP_ResponseHeaders ( "Content-Type" ) returns :

image/png
content-type: image/png

and BE_HTTP_ResponseHeaders ( "content-type" ) returns :

Content-Type: image/png
image/png

Expected behavior

It should be only the last value in the headers, so in this example the lower case one from the 200, and should be able to ignore case, so BE_HTTP_ResponseHeaders ( "Content-Type" ) would also work fine.

Desktop (please complete the following information):

BE : 05000002