#include <iostream>
#include "msparser.hpp"
 
using namespace matrix_science;
 
int main(int argc, char ** argv)
{
    std::string url, action, httpUserName, httpPassword, username, password;
 
    if (argc == 3 || argc == 5 || argc == 7)
    {
        url = argv[1];
        action = argv[2];
        if(argc == 5 || argc == 7)
        {
            httpUserName = argv[3];
            httpPassword = argv[4];
        }
        if (argc == 7)
        {
            username = argv[5];
            password = argv[6];
        }
    }
    else
    {
        std::cerr << "Usage: " << argv[0] << " <url> <action> [httpUserName] [httpPassword] [username] [password]" << std::endl;
        return 1;
    }
 
    std::cout << "url: " << url << " action: " << action;
    if(httpUserName != "")
    {
         std::cout << " httpUserName: " << httpUserName << " httpPassword: " << httpPassword;
    }
    if(username != "")
    {
        std::cout << " username: " << username << " password: " << password;
    }
    std::cout << std::endl;
    
    
    if(httpUserName != "")
    {
    }
    
    if(httpPassword != "")
    {
    }
 
    
    {
        {
        }
        std::cout << std::endl;
        
        return -1;
    }
    
    std::string httpGETString;
    
    if(helperReturn_string.
isOk())
 
    {
        std::cout << "httpGETString - OK: " << std::endl << httpGETString << std::endl;
    }
    else
    {
        std::cout << 
"httpGETString - Error: " << helperReturn_string.
getErrorText() << 
" (" << helperReturn_string.
getHttpStatusCode() << 
")" << std::endl;
    }
 
    std::string header;
 
    if(helperReturn_header.
isOk())
 
    {
        std::cout << "httpGetHeader - OK : " << std::endl << header << std::endl;
    }
    else
    {
        std::cout << 
"httpGetHeader - Error: " << helperReturn_header.
getErrorText() << 
" (" << helperReturn_header.
getHttpStatusCode() << 
")" << std::endl;
    }
 
    if(helperReturn_buffer.
isOk())
 
    {
        std::cout << "httpBufferedOpen - OK :" << std::endl;
        std::string buffer;
        while (true)
        {
            if (buffer.length() == 0 || !result.
isOk())
 
            {
                break;
            }
            std::cout << buffer;
        }
    }
    else
    {
        std::cout << 
"httpBufferedOpen - Error: " << helperReturn_buffer.
getErrorText() << 
" (" << helperReturn_buffer.
getHttpStatusCode() << 
")" << std::endl;
    }
    
    std::cout << std::endl;
 
    return 0;
}
Settings required to make an HTTP connection to a Mascot server.
Definition: ms_connection_settings.hpp:54
void setUserAgent(const std::string userAgent)
Set the user agent string.
Definition: ms_connection_settings.cpp:374
void setHttpUsername(const std::string httpUsername)
Sets the username for an authenticated web server.
Definition: ms_connection_settings.cpp:563
std::string getUserAgent() const
Get the user agent string.
Definition: ms_connection_settings.cpp:486
void setHttpPassword(const std::string httpPassword)
Sets the password for an authenticated web server.
Definition: ms_connection_settings.cpp:581
std::string getLastErrorString() const
Return the error description of the last error that occurred.
Definition: ms_errors.cpp:1488
const ms_errs * getErrorHandler() const
Retrive the error object using this function to get access to all errors and error parameters.
Definition: ms_errors.cpp:1518
bool isValid() const
Call this function to determine if there have been any errors.
Definition: ms_errors.cpp:1472
int getErrorRepeats(const int num=-1) const
Returns a number of times the specified error has been repeated.
Definition: ms_errors.cpp:1171
int getErrorNumber(const int num=-1) const
Return a specific error number or ERR_NO_ERROR.
Definition: ms_errors.cpp:1044
std::string getErrorString(const int num) const
Returns a specific error as a string.
Definition: ms_errors.cpp:1094
int getNumberOfErrors() const
Return the number of errors since the last call to clearAllErrors().
Definition: ms_errors.cpp:1004
Indicates any problem that may have occurred during a request to an ms_http_helper object.
Definition: ms_http_helper_return.hpp:37
bool isOk() const
Returns true if no problem was encountered.
Definition: ms_http_helper_return.cpp:109
int getHttpStatusCode() const
Returns the HTTP response code (if the type is ERR_http).
Definition: ms_http_helper_return.cpp:151
std::string getErrorText() const
Returns the text, if any, associated with the error.
Definition: ms_http_helper_return.cpp:161
The class provides HTTP, FTP and FILE protocol access to a server.
Definition: ms_http_helper.hpp:57
ms_http_helper_return httpBufferedOpen(const std::string &action)
Creates and opens a session for buffered reading from the supplied base URL and action.
Definition: ms_http_helper.cpp:2878
ms_http_helper_return httpGetHeader(const std::string &action, std::string &httpHeaderInfo)
Sends an HTTP HEAD message to the server and returns the header information separated with CR LF.
Definition: ms_http_helper.cpp:2525
ms_http_helper_return httpBufferedGetString(std::string &httpBuffer, unsigned long requiredSize)
Get available data from the open session. Writes data into the supplied buffer up to at least the req...
Definition: ms_http_helper.cpp:2934
ms_http_helper_return httpGetString(const std::string &action, std::string &httpGETString)
Sends an HTTP GET message to the server and returns the reply in a string.
Definition: ms_http_helper.cpp:888
ms_http_helper_return httpBufferedClose()
Closes the current buffered read session.
Definition: ms_http_helper.cpp:2684