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

Comments

@elgg-gitbot
Copy link

commented Feb 16, 2013

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

This comment has been minimized.

Copy link
Author

commented Feb 16, 2013

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

This comment has been minimized.

Copy link
Author

commented Feb 16, 2013

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

This comment has been minimized.

Copy link
Author

commented Feb 16, 2013

trac user marcus wrote on 39000099-08-08

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

@elgg-gitbot

This comment has been minimized.

Copy link
Author

commented Feb 16, 2013

trac user dansari wrote on 39001526-12-17

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

@elgg-gitbot

This comment has been minimized.

Copy link
Author

commented Feb 16, 2013

trac user marcus wrote on 39021363-09-24

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

@elgg-gitbot

This comment has been minimized.

Copy link
Author

commented Feb 16, 2013

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
Projects
None yet
1 participant
You can’t perform that action at this time.