[QGIS Commit] r8175 - trunk/qgis/src/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Feb 23 01:48:18 EST 2008


Author: mhugent
Date: 2008-02-23 01:48:18 -0500 (Sat, 23 Feb 2008)
New Revision: 8175

Modified:
   trunk/qgis/src/core/qgshttptransaction.cpp
   trunk/qgis/src/core/qgshttptransaction.h
Log:
Add capability of doing HTTP POST request to QgsHttpTransaction. Uses a default argument to maintain interface compatibility

Modified: trunk/qgis/src/core/qgshttptransaction.cpp
===================================================================
--- trunk/qgis/src/core/qgshttptransaction.cpp	2008-02-23 00:46:19 UTC (rev 8174)
+++ trunk/qgis/src/core/qgshttptransaction.cpp	2008-02-23 06:48:18 UTC (rev 8175)
@@ -67,7 +67,7 @@
   
 }
 
-bool QgsHttpTransaction::getSynchronously(QByteArray &respondedContent, int redirections)
+bool QgsHttpTransaction::getSynchronously(QByteArray &respondedContent, int redirections, const QByteArray* postData)
 {
 
   httpredirections = redirections;
@@ -106,7 +106,16 @@
   // executing an http GET.
   QString pathAndQuery = httpurl.remove(0, 
                          httpurl.indexOf(qurl.path()));
-  httpid = http->get( pathAndQuery );
+
+  if(!postData) //do request with HTTP GET
+    {
+      httpid = http->get( pathAndQuery );
+    }
+  else //do request with HTTP POST
+    {
+      httpid = http->post(pathAndQuery, *postData);
+    }
+
   connect(http, SIGNAL( requestStarted ( int ) ),
           this,      SLOT( dataStarted ( int ) ) );
 

Modified: trunk/qgis/src/core/qgshttptransaction.h
===================================================================
--- trunk/qgis/src/core/qgshttptransaction.h	2008-02-23 00:46:19 UTC (rev 8174)
+++ trunk/qgis/src/core/qgshttptransaction.h	2008-02-23 06:48:18 UTC (rev 8175)
@@ -64,11 +64,17 @@
 
   /*!
       The function returns FALSE if there is an error while getting the response.
-      \param[out] respondedContent is replaced with the new content.
-      \param[in]  redirections     is used to measure how many http redirections we've been through.
-                                   Clients typically don't need to set this.
+      @param[out] respondedContent is replaced with the new content.
+      
+      @param[in]  redirections     is used to measure how many http redirections we've been through.
+      Clients typically don't need to set this.
+      
+      @param postData data to send with the http message. This is only used for HTTP POST. If 
+      0 then the request is done with HTTP GET.
+
+      @return true in case of success
    */
-  bool getSynchronously(QByteArray &respondedContent, int redirections = 0);
+  bool getSynchronously(QByteArray &respondedContent, int redirections = 0, const QByteArray* postData = 0);
 
   QString responseContentType();
 



More information about the QGIS-commit mailing list