#include <httprequest.h>
Public Member Functions | |
GetRequest () | |
virtual | ~GetRequest () |
void | setUserAgent (const std::string &ua) |
std::string | getUserAgent () const |
void | addHeader (const std::string &key, const std::string &value) |
void | addHeader (const std::string &key, int value) |
void | clearHeaders () |
void | reset () |
bool | connect (const std::string &host, int port) |
bool | request (const std::string &page) |
bool | process () |
std::string | getHeader () const |
std::string | getHeaderAsString (const std::string &key) const |
int | getHeaderAsInt (const std::string &key) const |
unsigned int | getHeaderSize () const |
std::string | getData () const |
unsigned int | getDataSize () const |
std::string | getFooter () const |
unsigned int | getFooterSize () const |
std::string | getRaw () const |
unsigned int | getRawSize () const |
std::string | getError () const |
bool | success () const |
Protected Member Functions | |
void | setError (std::string message) |
bool | splitData () |
bool | postProcessData () |
unsigned int | findSize (unsigned int n, const std::string &source) const |
bool | isChunkedTransfer () const |
bool | isTransferFinished () const |
unsigned int | getContentLength () const |
std::string data, header; HTTP::GetRequest gr; gr.setUserAgent("HTTPTool/1.1"); gr.addHeader("Accept", "image/jpegn"); gr.addHeader("header1", "value1"); if ( gr.connect( "www.google.de", 80 ) ) { if ( gr.request( "index.html" ) ) { while ( gr.process() ); // you may want to update a progress bar with gr.getRawSize(); } } if ( gr.success() ) { header = gr.getHeader(); data = gr.getData(); } else { cout << gr.getError(); } // now do something with data and header using getData() and getHeader()
Definition at line 79 of file httprequest.h.
|
standard constructor Definition at line 57 of file httprequest.cpp. |
|
destructor Definition at line 62 of file httprequest.cpp. |
|
see above
Definition at line 79 of file httprequest.cpp. References addHeader(). |
Here is the call graph for this function:
|
add a header entry like "Content-Length" etc. This header will be sent to the server with the request.
Definition at line 74 of file httprequest.cpp. Referenced by addHeader(). |
|
remove all headers. Definition at line 90 of file httprequest.cpp. Referenced by reset(). |
|
connect to a server
Definition at line 101 of file httprequest.cpp. References setError(). |
Here is the call graph for this function:
|
get size of one chunk (helper function for postProcessData)
Definition at line 425 of file httprequest.cpp. Referenced by isTransferFinished(), and postProcessData(). |
|
the exact length is given by "Content-Length: "
Definition at line 340 of file httprequest.cpp. Referenced by splitData(). |
|
get data, this may be text or binary
Definition at line 262 of file httprequest.cpp. Referenced by WDS::CDlgUpdate::CheckDownload(). |
|
Definition at line 282 of file httprequest.cpp. |
|
get error message set by setError()
Definition at line 297 of file httprequest.cpp. |
|
get footer
Definition at line 267 of file httprequest.cpp. |
|
Definition at line 287 of file httprequest.cpp. |
|
get header from the answer the server returned.
Definition at line 225 of file httprequest.cpp. |
|
get a value out of the header
Definition at line 247 of file httprequest.cpp. References getHeaderAsString(). Referenced by WDS::CDlgUpdate::CheckDownload(). |
Here is the call graph for this function:
|
get a value out of the header
Definition at line 230 of file httprequest.cpp. Referenced by WDS::CDlgUpdate::CheckDownload(), and getHeaderAsInt(). |
|
Definition at line 277 of file httprequest.cpp. |
|
get all data without any modifications
Definition at line 272 of file httprequest.cpp. |
|
during the process get the growing size with this function
Definition at line 292 of file httprequest.cpp. |
|
get user agent (UA) Definition at line 69 of file httprequest.cpp. |
|
check, whether this is a chunked transfer
Definition at line 308 of file httprequest.cpp. Referenced by isTransferFinished(), and splitData(). |
|
If the transfer mode is 'chunked' and stepping through the sizes ends with the '0' we definitely have reached the end of the data transfer and may stop recieving more data.
Definition at line 313 of file httprequest.cpp. References findSize(), and isChunkedTransfer(). Referenced by process(). |
Here is the call graph for this function:
|
if the transfer was chunked, remove the size infos
Definition at line 350 of file httprequest.cpp. References findSize(). Referenced by splitData(). |
Here is the call graph for this function:
|
continue to get data
Definition at line 193 of file httprequest.cpp. References isTransferFinished(), and splitData(). |
Here is the call graph for this function:
|
initialize HTTP GET request
Definition at line 151 of file httprequest.cpp. References setError(). |
Here is the call graph for this function:
|
reset headers, user agent and setup the object for a new connection Definition at line 95 of file httprequest.cpp. References clearHeaders(). |
Here is the call graph for this function:
|
set error message returned by getError()
Definition at line 303 of file httprequest.cpp. Referenced by connect(), request(), and splitData(). |
|
set the user agent (UA) Definition at line 64 of file httprequest.cpp. |
|
remove headers and footers
Definition at line 452 of file httprequest.cpp. References getContentLength(), isChunkedTransfer(), postProcessData(), and setError(). Referenced by process(). |
Here is the call graph for this function:
|
get status of the transfer
Definition at line 219 of file httprequest.cpp. |