CSteipp has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/70747


Change subject: Add methods to get raw request in WebRequest
......................................................................

Add methods to get raw request in WebRequest

Make it possible to get the raw parameters given to the request, with
no escaping. This is needed for features like OAuth, where a signature
is calculated over the parameters to verify their integrity and source.

Change-Id: I8710844f21d21cbbf28517b0cc25b0713b506bee
---
M includes/WebRequest.php
1 file changed, 23 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/47/70747/1

diff --git a/includes/WebRequest.php b/includes/WebRequest.php
index dbd0740..86f78dd 100644
--- a/includes/WebRequest.php
+++ b/includes/WebRequest.php
@@ -569,6 +569,29 @@
        }
 
        /**
+        * Return the contents of the Query with no decoding. Use when you need 
to
+        * know exactly what was sent, e.g. for an OAuth signature over the 
elements.
+        *
+        * @return String
+        */
+       public function getRawQueryString() {
+               return $_SERVER['QUERY_STRING'];
+       }
+
+       /**
+        * Return the contents of the POST with no decoding. Use when you need 
to
+        * know exactly what was sent, e.g. for an OAuth signature over the 
elements.
+        *
+        * @return String
+        */
+       public function getRawPostString() {
+               if ( !$this->wasPosted() ) {
+                       return '';
+               }
+               return file_get_contents( 'php://input' );
+       }
+
+       /**
         * Get the HTTP method used for this request.
         *
         * @return String

-- 
To view, visit https://gerrit.wikimedia.org/r/70747
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8710844f21d21cbbf28517b0cc25b0713b506bee
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: CSteipp <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to