proofgeist / generator

Generator - Store, explore, share and create FileMaker Code
MIT License
35 stars 8 forks source link

Multiple Response Status Headers Are Ignored #27

Open Luidog opened 6 years ago

Luidog commented 6 years ago

Wrong Status Code

There seems to be an issue parsing the multiple status response codes from the $responseHeader variable. Generator is only grabbing the first response code in the header. If a request contains a large amount of data (1024) the 100 continue response is recorded rather than the final status code.

Here are is an example of a large request that fails to show the final response code:

Generator-Bug.fmp12.zip

Here is a proposed patch:

Generator-Patch.fmp12.zip

The patch would apply lines 125- 140 of the "HTTP Native ( { request } )" script.

Credit to Eden Morris for helping me debug this issue and write the patch! (and general dev awesomeness)

Luidog commented 6 years ago

A gist of the proposed patch.

https://gist.github.com/Luidog/19de894330ab0d564bb56f29551b69bc

toddgeist commented 6 years ago

Continue 100 status code is a particular problem, best solved by telling curl to not accept it. Since FileMaker will not be able to respond to Continue correctly.

I tweeted about this a while back. https://twitter.com/toddgeist/status/915635695217025025.

The basic issue is set an Expect header to "". That will tell the server not to send Continue.

Todd

Luidog commented 6 years ago

From what I can tell that header is set by FileMaker and the Insert From URL script step can handle expect continue we just have to adjust for multiple status codes in the header response.

The patch we propose updates Generator's handling of multiple response status codes without having to override (and disable) the expect header.

toddgeist commented 6 years ago

Do you have an example request that shows that Continue 100 is handled correctly?

Luidog commented 6 years ago

@toddgeist See the patch file in the first issue comment. It contains a response of multiple status codes handled by FileMaker successfully. Maybe this was something handled in 16.0.4 ?

The patch file also handles a single status code as well.

toddgeist commented 5 years ago

I am finally convinced that this is the right move :-)

Luidog commented 5 years ago

Glad to hear it. Thank you for including this patch.