OpenMS
Loading...
Searching...
No Matches
NetworkGetRequest Class Reference

Synchronous HTTP GET request using libcurl. More...

#include <OpenMS/SYSTEM/NetworkGetRequest.h>

Collaboration diagram for NetworkGetRequest:
[legend]

Public Member Functions

 NetworkGetRequest ()
 
 ~NetworkGetRequest ()
 
void setUrl (const std::string &url)
 set the URL to request
 
void setTimeout (int seconds)
 set the timeout in seconds (0 = no timeout)
 
void run ()
 execute the GET request (blocks until complete or timeout)
 
std::string getResponse () const
 returns the response as a string
 
const std::vector< char > & getResponseBinary () const
 returns the raw response bytes
 
bool hasError () const
 returns true if an error occurred during the query
 
std::string getErrorString () const
 returns the error message
 

Private Member Functions

 NetworkGetRequest (const NetworkGetRequest &)=delete
 
NetworkGetRequestoperator= (const NetworkGetRequest &)=delete
 

Private Attributes

std::vector< char > response_bytes_
 
std::string url_
 
int timeout_ = 0
 
bool has_error_ = false
 
std::string error_string_
 

Detailed Description

Synchronous HTTP GET request using libcurl.

Constructor & Destructor Documentation

◆ NetworkGetRequest() [1/2]

◆ ~NetworkGetRequest()

◆ NetworkGetRequest() [2/2]

NetworkGetRequest ( const NetworkGetRequest )
privatedelete

Member Function Documentation

◆ getErrorString()

std::string getErrorString ( ) const

returns the error message

◆ getResponse()

std::string getResponse ( ) const

returns the response as a string

◆ getResponseBinary()

const std::vector< char > & getResponseBinary ( ) const

returns the raw response bytes

◆ hasError()

bool hasError ( ) const

returns true if an error occurred during the query

◆ operator=()

NetworkGetRequest & operator= ( const NetworkGetRequest )
privatedelete

◆ run()

void run ( )

execute the GET request (blocks until complete or timeout)

◆ setTimeout()

void setTimeout ( int  seconds)

set the timeout in seconds (0 = no timeout)

◆ setUrl()

void setUrl ( const std::string &  url)

set the URL to request

Member Data Documentation

◆ error_string_

std::string error_string_
private

◆ has_error_

bool has_error_ = false
private

◆ response_bytes_

std::vector<char> response_bytes_
private

◆ timeout_

int timeout_ = 0
private

◆ url_

std::string url_
private