Skip to content
This repository has been archived by the owner on Sep 8, 2021. It is now read-only.

Bootstrap edits #25

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

ibejohn818
Copy link

  • use php built-in query string builder
  • lower case on header keys to prevent duplicate keys of differing case

- lower case on header key to prevent duplicate keys of differing case
}
}
}
$uri .= "?" . http_build_query($event['multiValueQueryStringParameters']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this really does the right thing. For example, multiValueQueryStringParameters might have the following value:

    "multiValueQueryStringParameters":{
      "name":[
        "me"
      ],
      "multivalueName":[
        "you",
        "me"
      ]
    }

This corresponds to a url querystring like ?name=me&multivalueName=you&multivalueName=me

If you fed the same data into http_build_query, it would generate the following querystring: ?name[0]=me&multivalueName[0]=you&multivalueName[1]=me. (The square brackets [] would actually be url-encoded, but I left them unencoded to make it easier to understand here.)

Can you double check my thinking?

Copy link

@jaimz22 jaimz22 Jan 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@txase php requires the square brackets to exist for multiple value query string parameters.

if php parses the query string ?name=me&multivalueName=you&multivalueName=me you'll end up with:

array(2) { ["multivalueName"]=> string(2) "me" ["name"]=> string(2) "me" } 

when you have the square brackets you receive the full array in php:

array(2) { ["multivalueName"]=> array(2) { [0]=> string(3) "you" [1]=> string(2) "me" } ["name"]=> string(2) "me" } 

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be that PHP requires square brackets to exist for multiple value query string parameters, but this layer proxies parameters as they were received by API Gateway from the client. If they aren't in the correct format for PHP to understand them, then the client needs to be fixed to send them correctly.

I don't want to modify requests as they are received and then proxied to and from the PHP webserver.

@@ -191,6 +175,8 @@ while (true) {
return strlen($header);
}

$name = strtolower($name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather not lose the fidelity of the header name as it passes through the layer. If the API Gateway or ALB can pass it with a specific case, let's leave it as-is.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants