Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FCGI improvements. #9733

Merged
merged 3 commits into from
May 15, 2023
Merged

FCGI improvements. #9733

merged 3 commits into from
May 15, 2023

Conversation

sbordet
Copy link
Contributor

@sbordet sbordet commented May 4, 2023

  • Better handling for HTTPS parameter on server side.
  • Better handling of unknown frame types.

* Better handling for HTTPS parameter on server side.
* Better handling of unknown frame types.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet sbordet requested review from gregw and joakime May 4, 2023 15:13
Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

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

Almost approved... but an explanation of the value of the _secure field is needed (probably as a comment). Other things are minor niggles.

Comment on lines 140 to 141
notifyFailure(headerParser.getRequest(), x);
buffer.position(buffer.limit());
Copy link
Contributor

Choose a reason for hiding this comment

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

Swap these two lines. i.e consume the buffer before notifying the user

Comment on lines 148 to 152
private void notifyFailure(int request, Throwable failure)
{
listener.onFailure(request, failure);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this needed? inline it.

else
processField(field);
}

public void onHeaders()
{
String pathQuery = URIUtil.addPathQuery(_path, _query);
// TODO https?
MetaData.Request request = new MetaData.Request(_method, HttpScheme.HTTP.asString(), hostPort, pathQuery, HttpVersion.fromString(_version), _headers, -1);
HttpScheme scheme = _secure != null ? HttpScheme.HTTPS : HttpScheme.HTTP;
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the value of _secure for? Could it be "false" i.e. saying that it is not secure?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

RFC 3875 (https://datatracker.ietf.org/doc/html/rfc3875) does not define HTTPS, but apparently for PHP it must be set to a non-empty value to indicate that the request was secure (https://www.php.net/manual/en/reserved.variables.server.php).

We use HTTPS=on for compatibility with PHP applications such as WordPress, but other applications require true or 1, see for example: https://build.trac.wordpress.org/browser/branches/6.2/wp-includes/load.php#L1473

So HTTPS=false as per PHP spec would still mean that the request is secure because it's non-empty, but it really depends on the application.

🤷🏼

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should have a list of affirmative values: "true", "1", "on", "secure", "https". Anything else is not secure.

At the very least can we exclude the empty string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

-1 for the list, +1 for non-empty.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet sbordet requested a review from gregw May 8, 2023 17:14
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet sbordet merged commit b884469 into jetty-12.0.x May 15, 2023
@sbordet sbordet deleted the fix/jetty-12-fcgi-improvements branch May 15, 2023 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants