Skip to content

Delegate primary script pathfinding and loading to PHP #7

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

Merged
merged 4 commits into from
May 20, 2025

Conversation

Qard
Copy link
Member

@Qard Qard commented May 19, 2025

This fixes three issues:

  • Headers actually can be case-sensitive in PHP, so it's necessary for the header helper to leave the casing alone
  • The ResponseBuilder.header(...) method needs to append headers, not replace them
  • PHP needs to handle resolving and loading the entrypoint file or it will not correctly be able to locate relative files and redirect correctly (It can do one or the other, but not both, unless it is aware of the full resolution)

@Qard Qard added the bug Something isn't working label May 19, 2025
.strip_prefix("/")
.map_err(EmbedException::RelativizeError)?;

match docroot.join(relative_uri).join("index.php").canonicalize() {

Choose a reason for hiding this comment

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

Does it always look for index.php file?

Copy link
Member Author

Choose a reason for hiding this comment

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

At the moment, yes. It tries path + 'index.php' and, if it does not exist, tries path alone. It currently works in that order as it just checks existence and not that it is a file, so a directory would canonicalize also. I need to improve this a bit, but this part is a bit in-progress right now as I restructure it to resolve paths better.

Copy link

@ShogunPanda ShogunPanda left a comment

Choose a reason for hiding this comment

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

LGTM!

@Qard
Copy link
Member Author

Qard commented May 19, 2025

The tests will also need adjusting. Haven't fixed them yet to use the new design.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm with green CI

@Qard Qard merged commit f4228ca into main May 20, 2025
11 checks passed
@Qard Qard deleted the redo-primary-loading-and-paths branch May 20, 2025 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants