This repository has been archived by the owner on Sep 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 70
Bootstrap edits #25
Open
ibejohn818
wants to merge
1
commit into
stackery:development
Choose a base branch
from
ibejohn818:bootstrap-edits
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Bootstrap edits #25
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,23 +112,7 @@ while (true) { | |
$uri = $event['path']; | ||
|
||
if (array_key_exists('multiValueQueryStringParameters', $event) && $event['multiValueQueryStringParameters']) { | ||
$first = TRUE; | ||
foreach ($event['multiValueQueryStringParameters'] as $name => $values) { | ||
foreach ($values as $value) { | ||
if ($first) { | ||
$uri .= "?"; | ||
$first = FALSE; | ||
} else { | ||
$uri .= "&"; | ||
} | ||
|
||
$uri .= $name; | ||
|
||
if ($value != '') { | ||
$uri .= '=' . $value; | ||
} | ||
} | ||
} | ||
$uri .= "?" . http_build_query($event['multiValueQueryStringParameters']); | ||
} | ||
|
||
$ch = curl_init("http://localhost:8000$uri"); | ||
|
@@ -161,7 +145,7 @@ while (true) { | |
if (strlen($body) > 0) { | ||
if($event['httpMethod'] === 'POST'){ | ||
curl_setopt($ch, CURLOPT_POSTFIELDS, $body); | ||
} | ||
} | ||
curl_setopt($ch, CURLOPT_INFILESIZE, strlen($body)); | ||
curl_setopt($ch, CURLOPT_READFUNCTION, function ($ch, $fd, $length) use ($body) { | ||
return $body; | ||
|
@@ -191,6 +175,8 @@ while (true) { | |
return strlen($header); | ||
} | ||
|
||
$name = strtolower($name); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
|
||
if (!array_key_exists($name, $response['multiValueHeaders'])) { | ||
$response['multiValueHeaders'][$name] = array(); | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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: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?
There was a problem hiding this comment.
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:when you have the square brackets you receive the full array in php:
There was a problem hiding this comment.
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.