Skip to content

Commit

Permalink
Add redirect url getter
Browse files Browse the repository at this point in the history
  • Loading branch information
Kiritow committed Mar 3, 2018
1 parent f60acb9 commit cc89db4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/NetworkWrapper.h
Expand Up @@ -100,6 +100,7 @@ class HTTPConnection
const int getHeaderOutputBufferLength();
const void* getDataOutputBuffer();
const int getDataOutputBufferLength();
std::string getRedirectURL();

/// Error handling
int getLastErrCode();
Expand Down
16 changes: 15 additions & 1 deletion src/NetworkWrapper.cpp
Expand Up @@ -582,6 +582,20 @@ const int HTTPConnection::getDataOutputBufferLength()
return _p->spcData->used;
}

string HTTPConnection::getRedirectURL()
{
char* url=NULL;
invokeLib(curl_easy_getinfo,_p->c,CURLINFO_REDIRECT_URL,&url);
if(url)
{
return url;
}
else
{
return "";
}
}

int HTTPConnection::getLastErrCode()
{
return _p->lasterr;
Expand Down Expand Up @@ -640,4 +654,4 @@ int HTTPConnection::traversalDebugQueue(const std::function<int(const debug_info
#ifndef _CRT_SECURE_NO_WARNINGS
#undef fopen
#endif
#endif
#endif

0 comments on commit cc89db4

Please sign in to comment.