Skip to content
Permalink
Browse files

Add capability of doing HTTP POST request to QgsHttpTransaction. Uses…

… a default argument to maintain interface compatibility

git-svn-id: http://svn.osgeo.org/qgis/trunk@8175 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Feb 23, 2008
1 parent 370a487 commit d169bd9529d1c470ef4dd404a99dff88c0e87e76
Showing with 21 additions and 6 deletions.
  1. +11 −2 src/core/qgshttptransaction.cpp
  2. +10 −4 src/core/qgshttptransaction.h
@@ -67,7 +67,7 @@ void QgsHttpTransaction::getAsynchronously()

}

bool QgsHttpTransaction::getSynchronously(QByteArray &respondedContent, int redirections)
bool QgsHttpTransaction::getSynchronously(QByteArray &respondedContent, int redirections, const QByteArray* postData)
{

httpredirections = redirections;
@@ -106,7 +106,16 @@ bool QgsHttpTransaction::getSynchronously(QByteArray &respondedContent, int redi
// 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 ) ) );

@@ -64,11 +64,17 @@ class CORE_EXPORT QgsHttpTransaction : public QObject

/*!
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();

0 comments on commit d169bd9

Please sign in to comment.
You can’t perform that action at this time.