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

Querystring needs to be preserved by .htaccess for REST API (Trac #622) #622

Closed
elgg-gitbot opened this issue Feb 16, 2013 · 6 comments
Closed

Comments

@elgg-gitbot
Copy link

Original ticket http://trac.elgg.org/ticket/622 on 38948527-12-04 by trac user dansari, assigned to unknown.

Elgg version: 1.1

An API method may be called as follows:

http://localhost/pg/api/rest?method=display&username=dansari&password=apples

The problem with .htaccess is that it would cause the page handler to be invoked as pagehandler.php?handler=api&page=rest, discarding the querystring entirely. services/api/rest.php actually expects the method parameters to be in the querystring, so to get this to work, we need to change the following line in .htaccess:

RewriteRule ^pg/([A-Za-z_-]+)/(.*)$
engine/handlers/pagehandler.php?handler=$1&page=$2

to this:

RewriteRule ^pg/([A-Za-z_-]+)/(.*)$
engine/handlers/pagehandler.php?handler=$1&page=$2 [QSA]

@elgg-gitbot
Copy link
Author

trac user marcus wrote on 38996729-03-11

pagehandler.php should tokenise any parameters and make them accessible via get_input() and get_parameters_for_method().

@elgg-gitbot
Copy link
Author

trac user dansari wrote on 39000092-05-29

But pagehandler.php can't "tokenise the parameters" unless it receives them - hence the change to .htaccess. (rest.php calls get_parameters_for_method() which calls get_input(), which cannot work unless the parameter is available.)

@elgg-gitbot
Copy link
Author

trac user marcus wrote on 39000099-08-08

This appears to function correctly on my system. What platform are you running?

@elgg-gitbot
Copy link
Author

trac user dansari wrote on 39001526-12-17

I'm running XAMPP on Windows XP (as my development platform).

@elgg-gitbot
Copy link
Author

trac user marcus wrote on 39021363-09-24

(In [svn:2537]) Refs #622: Missing command from failsafe view

@elgg-gitbot
Copy link
Author

trac user marcus wrote on 39021366-08-12

Last comment refers to #662 not #622

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant