Commit cc732dba authored by Matteo Quintiliani's avatar Matteo Quintiliani
Browse files

Merge branch 'release/1.9.0'

parents f30122be 24df2c1d
Pipeline #2611 passed with stages
in 1 minute and 59 seconds
......@@ -2,6 +2,10 @@
ew2openapi Release History
#########################
* Release 1.9.0 (2018/04/20)
- Add handler for classifyin HTTP CODE and manage errors to retry or not to POST message. Issue #13 (2018/04/20)
- Add parameter ApiBaseUrl in ew2openapi.d and earthworm_commonvars.d. (2018/04/20)
* Release 1.8.5 (2018/04/19)
- Change version of hypocenter to alphabetic name. Issue #10 (2018/02/01)
- Start handling exception based on http code. Issue #13 (2018/04/17)
......
1.8.5 - 2018-04-19
\ No newline at end of file
1.9.0 - 2018-04-20
\ No newline at end of file
......@@ -20,7 +20,10 @@
# Unique name that indentifies the EW instance is usually declared as variable
EWInstanceName ${EWMOLE_INSTANCENAME}
#
# ew2openapi connection parameter
ApiBaseUrl http://jabba.int.ingv.it:10013/ingvws/eventdb
# Rabbit DB connection parameters
RMQHostname ${RABBITMQ_HOSTNAME}
RMQPort ${RABBITMQ_PORT}
......@@ -29,8 +32,8 @@ RMQVirtualHost ${RABBITMQ_VIRTUALHOST}
RMQUsername ${RABBITMQUSER}
RMQPassword ${RABBITMQPASS}
# Seconds to wait after a DB error
WaitSecAfterDBError 5
# Seconds to wait after a Service Error
WaitSecAfterServiceError 5
# Flag to debug MySql instructions
DebugMySql 0
......
......@@ -53,7 +53,7 @@ DECLARE_SPECIFIC_SEMAPHORE_EW(sema_CountToProcess);
void earthworm_message_conversion_tool( int argc, char **argv );
thr_ret MessageStacker( void *p ); /* thread: messages from ring to queue */
thr_ret DBPopulate( void *p ); /* thread: messages from queue to database */
thr_ret MessageHandler( void *p ); /* thread: messages from queue to database */
thr_ret QueueDumpFile( void *p ); /* thread: messages from queue to file */
void inc_nStackerThread();
......@@ -111,14 +111,15 @@ typedef struct TYPE_PARAMS {
long MaxMsgSize; /* max size for input/output msgs */
int QueueSize; /* max messages in output circular buffer */
char QueueFilename[FILENAME_MAXLEN]; /* Filename for dumping and undumping the queue */
int WaitSecAfterDBError; /* Milliseconds to wait after a DB error */
char ewinstancename[256]; /* EW instance name */
char ApiBaseUrl[1024]; /* Api Base URL */
int WaitSecAfterServiceError; /* Seconds to wait after a Service Error */
char rmq_hostname[256]; /* RabbitMQ hostname */
int rmq_port; /* RabbitMQ port */
char rmq_exchange[256]; /* RabbitMQ exchange */
char rmq_vhost[256]; /* RabbitMQ virtual host */
char rmq_username[256]; /* RabbitMQ username */
char rmq_password[256]; /* RabbitMQ password */
char ewinstancename[256]; /* EW instance name */
char send_message_format_flags; /* Flags for message format conversion. (RAW, JSON, GEOJSON) */
/* Variables set from ew2openapi_lookup() before starting threads
......@@ -166,7 +167,7 @@ int main( int argc, char **argv ) {
pid_t MyPid; /* Our own pid, sent with heartbeat for restart purposes */
time_t MyLastBeat; /* time of last local (into Earthworm) hearbeat */
unsigned tidStacker[MAX_NUM_OF_RINGS]; /* Thread moving messages from transport to queue */
unsigned tidDBPopulate; /* Thread read message from queue and populate DB */
unsigned tidMessageHandler; /* Thread read message from queue and populate DB */
unsigned tidQueueDumpFile; /* Thread read message from queue and populate DB */
int ret_dq; /* stores errors from dumpqueue() and undumpqueue() */
int cur_NumOfElements = 0; /* Current value of number of elements in OutQueue */
......@@ -176,7 +177,6 @@ int main( int argc, char **argv ) {
char errText[STR_LEN_ERRTEXT]; /* string for log/error/heartbeat messages */
char *configfile; /* pointer to configuration file name argv[1] */
char default_configfilename_standalone[] = "ew2openapi_standalone.d";
// MYSQL *test_mysql_connection = NULL;
int r = 0;
TYPE_PARAMS params;
......@@ -337,9 +337,9 @@ int main( int argc, char **argv ) {
/* Start the DB populating thread
***********************************/
if ( StartThreadWithArg( DBPopulate, (void *) &params, (unsigned)THREAD_STACK, &tidDBPopulate ) == -1 )
if ( StartThreadWithArg( MessageHandler, (void *) &params, (unsigned)THREAD_STACK, &tidMessageHandler ) == -1 )
{
logit( "e", "%s(%s): Error starting thread DBPopulate(); exiting!\n",
logit( "e", "%s(%s): Error starting thread MessageHandler(); exiting!\n",
params.cmdname, params.MyModName );
tport_detach( &params.HeartBeatRegion );
exit( -1 );
......@@ -393,12 +393,12 @@ int main( int argc, char **argv ) {
}
/* The queue could be still full.
* (i.e. DBPopulate() could not be able to process messages in the queue. ) */
* (i.e. MessageHandler() could not be able to process messages in the queue. ) */
if(!testlck_flags_term(FLAG_TERM_THR_MS)) {
logit("et", "Warning: threads MessageStacker() not all terminated yet!\n");
}
/* Ask to terminate to DBPopulate thread */
/* Ask to terminate to MessageHandler thread */
setlck_flags_term(FLAG_TERM_REQ_DB);
wait_time_thr_count=0;
while( wait_time_thr_count < wait_time_thr_tot && !testlck_flags_term(FLAG_TERM_THR_DB) ) {
......@@ -408,8 +408,8 @@ int main( int argc, char **argv ) {
/* The queue could be still empty. */
if(!testlck_flags_term(FLAG_TERM_THR_DB)) {
logit("et", "Warning: thread DBPopulate() not terminated yet!\n");
/* One for DBPopulate which must quit since FLAG_TERM_REQ_DB */
logit("et", "Warning: thread MessageHandler() not terminated yet!\n");
/* One for MessageHandler which must quit since FLAG_TERM_REQ_DB */
POST_SPECIFIC_SEMAPHORE_EW(sema_CountToProcess);
}
......@@ -443,7 +443,7 @@ int main( int argc, char **argv ) {
logit("et", "Warning: threads MessageStacker() not all terminated yet!\n");
}
if(!testlck_flags_term(FLAG_TERM_THR_DB)) {
logit("et", "Warning: thread DBPopulate() not terminated yet!\n");
logit("et", "Warning: thread MessageHandler() not terminated yet!\n");
}
if(!testlck_flags_term(FLAG_TERM_THR_QF)) {
logit("et", "Warning: thread QueueDumpFile() not terminated yet!\n");
......@@ -727,11 +727,20 @@ void earthworm_message_conversion_tool( int argc, char **argv )
}
/* State for no error */
#define STATE_WS_NO_ERROR 0
/* State for error which implies infinity retries */
#define STATE_WS_ERROR_INFINITY_RETRIES 1
/* State for error which implies limited retries */
#define STATE_WS_ERROR_LIMITED_RETRIES 2
/* State for error which implies no retries */
#define STATE_WS_ERROR_NO_RETRIES 3
/************* Main Thread for populating DB from queue ***************
* Pull a messsage from the queue, and call stored procedure *
* for inserting information in to the database *
**********************************************************************/
thr_ret DBPopulate( void *p )
thr_ret MessageHandler( void *p )
{
TYPE_PARAMS *params = (TYPE_PARAMS *) p;
MSG_LOGO reclogo;
......@@ -744,17 +753,14 @@ thr_ret DBPopulate( void *p )
long inkey;
char *json_string = NULL;
char *iter_json_string = NULL;
char *sub_json_string = NULL;
char flag_geojson;
// int ret_ex_mysql_query = EW2OPENAPI_MYSQL_OK;
// MYSQL *mysql = NULL;
char *Wrmsg = NULL; /* message to get from queue */
int count_sql_tot = 0;
int count_sql_ok = 0;
int count_sql_err_conndb = 0;
int count_sql_err_exquery = 0;
int flag_remove_last_msg = 0;
int flag_wait_after_error = 0;
int state_count_attempt = 0; /* Default set here */
const int max_state_count_attempt = 5;
int state_error_handling = STATE_WS_NO_ERROR;
int num_elements_in_queue = 0;
long curl_http_code = 0;
......@@ -765,7 +771,7 @@ thr_ret DBPopulate( void *p )
/* error */
}
logit( "t", "ew2openapi: thread DBPopulate() started.\n");
logit( "t", "ew2openapi: thread MessageHandler() started.\n");
/* Allocate buffer for reading message from queue */
if ( ( Wrmsg = (char *) malloc(params->MaxMsgSize+1) ) == NULL )
......@@ -791,12 +797,13 @@ thr_ret DBPopulate( void *p )
RequestSpecificMutex(&mutex_OutQueue);
ret=cpqueuering( &OutQueue, Wrmsg, &msgSize, &reclogo, &inkey, &inseq);
ReleaseSpecificMutex(&mutex_OutQueue);
Wrmsg[msgSize] = '\0';
/* The following condition could occur only one time
* when the module quits. */
if (ret < 0 )
{ /* -1 means empty queue */
logit("t", "DBPopulate: queue is empty!\n");
logit("t", "MessageHandler: queue is empty!\n");
sleep_ew(100);
continue;
}
......@@ -817,12 +824,13 @@ thr_ret DBPopulate( void *p )
continue;
}
/* Build the SQL string for calling the stored procedure related to each different message */
Wrmsg[msgSize] = '\0';
logit("et", "logo <%s.%s.%s.%s>\n",
logit("et", "LOGO: <%s.%s.%s.%s>\n",
GetKeyName(inkey), GetInstName(reclogo.instid), GetModIdName(reclogo.mod), GetTypeName(reclogo.type));
/* Init default values for flag_remove_last_msg and flag_wait_after_error */
flag_remove_last_msg = 1;
flag_wait_after_error = 0;
if(params->send_message_format_flags & MESSAGE_FORMAT_RAW) {
amqp_sendstring(Wrmsg, msgSize, &reclogo, inkey, params, MESSAGE_FORMAT_RAW);
}
......@@ -833,29 +841,145 @@ thr_ret DBPopulate( void *p )
params->send_message_format_flags & MESSAGE_FORMAT_GEOJSON
) {
/* Build the JSON string for posting to service */
flag_geojson = params->send_message_format_flags & MESSAGE_FORMAT_GEOJSON;
json_string = get_json_string_from_ew_msg(Wrmsg, msgSize, &reclogo, params->ewinstancename, ewUserName, ewHostName, &flag_geojson);
if(json_string) {
amqp_sendstring(json_string, strlen(json_string), &reclogo, inkey, params, (flag_geojson)? MESSAGE_FORMAT_GEOJSON : MESSAGE_FORMAT_JSON);
logit("et", "%s %s\n", (flag_geojson)? "GeoJSON" : "JSON", json_string);
/* CURL message */
curl_http_code = ew2openapi_curl_sendstring(json_string, strlen(json_string), &reclogo, (flag_geojson)? MESSAGE_FORMAT_GEOJSON : MESSAGE_FORMAT_JSON);
logit("t", "URL: %s\n", params->ApiBaseUrl);
logit("t", "%s: %s\n", (flag_geojson)? "GeoJSON" : "JSON", json_string);
curl_http_code = ew2openapi_curl_sendstring(params->ApiBaseUrl, json_string, strlen(json_string), &reclogo, (flag_geojson)? MESSAGE_FORMAT_GEOJSON : MESSAGE_FORMAT_JSON);
logit("t", "HTTP CODE: %ld\n", curl_http_code);
/* Based on curl_http_code classify
*
* - STATE_WS_NO_ERROR
* - STATE_WS_ERROR_INFINITY_RETRIES
* - STATE_WS_ERROR_LIMITED_RETRIES
* - STATE_WS_ERROR_NO_RETRIES
*
* Refer https://httpstatuses.com/
*
*/
/* Init values before error classification */
state_error_handling = STATE_WS_NO_ERROR;
switch(curl_http_code) {
/* Generic errors: network connection, ... */
case -1:
/* Set state_error_handling to STATE_WS_ERROR_INFINITY_RETRIES */
state_error_handling = STATE_WS_ERROR_INFINITY_RETRIES;
break;
/* 4xx error codes */
case 408: // Request Timeout
/* Set state_error_handling to STATE_WS_ERROR_INFINITY_RETRIES */
state_error_handling = STATE_WS_ERROR_INFINITY_RETRIES;
break;
/* 5xx error codes */
case 500: // Internal Server Error
// case 501: // Not Implemented
case 502: // Bad Gateway
case 503: // Service Unavailable
case 504: // Gateway Timeout
// case 505: // HTTP Version Not Supported
// case 506: // Variant Also Negotiates
case 507: // Insufficient Storage
// case 508: // Loop Detected
// case 510: // Not Extended
case 511: // Network Authentication Required
case 599: // Network Connect Timeout Error
/* Set state_error_handling to STATE_WS_ERROR_INFINITY_RETRIES */
state_error_handling = STATE_WS_ERROR_INFINITY_RETRIES;
break;
/* Other error codes */
default:
/* Do nothing */
break;
}
/* TODO based on curl_http_code decide if removing last message from the queue */
/* Set flag_remove_last_msg and flag_wait_after_error based on state_error_handling */
switch(state_error_handling) {
case STATE_WS_NO_ERROR:
/* Do nothing. Leave default values */
break;
case STATE_WS_ERROR_INFINITY_RETRIES:
/* Do not remove item from queue, wait a while */
flag_remove_last_msg = 0;
flag_wait_after_error = 1;
break;
case STATE_WS_ERROR_LIMITED_RETRIES:
/* Count how many times occurred the error to POST
* the same message before giving up after a maximum
* number of attempts */
if(state_count_attempt < max_state_count_attempt) {
/* Do not remove item from queue, wait a while, count attempt */
flag_remove_last_msg = 0;
flag_wait_after_error = 1;
state_count_attempt++;
} else {
/* Remove item from queue, reset count attempt */
state_count_attempt = 0;
}
break;
case STATE_WS_ERROR_NO_RETRIES:
/* Do nothing. Leave default values */
break;
default:
/* TODO ERROR */
break;
}
}
}
/* Do actions based on flag_remove_last_msg and flag_wait_after_error */
/* Remove last message from queue
*************************/
WAIT_SPECIFIC_SEMAPHORE_EW(sema_CountBusy);
if(flag_remove_last_msg) {
WAIT_SPECIFIC_SEMAPHORE_EW(sema_CountBusy);
RequestSpecificMutex(&mutex_OutQueue);
ret=dequeuering( &OutQueue, Wrmsg, &msgSize, &reclogo, &inkey, &inseq);
ReleaseSpecificMutex(&mutex_OutQueue);
POST_SPECIFIC_SEMAPHORE_EW(sema_CountAvail);
} else {
/* The item has not been successfully processed due to
* WS connection error, then re-increment sema_CountToProcess */
POST_SPECIFIC_SEMAPHORE_EW(sema_CountToProcess);
logit("et", "Retry to POST last message later.\n");
}
/* Get number of elements in queue */
RequestSpecificMutex(&mutex_OutQueue);
ret=dequeuering( &OutQueue, Wrmsg, &msgSize, &reclogo, &inkey, &inseq);
num_elements_in_queue = getNumOfElementsInQueue(&OutQueue);
ReleaseSpecificMutex(&mutex_OutQueue);
POST_SPECIFIC_SEMAPHORE_EW(sema_CountAvail);
if(num_elements_in_queue > 1) {
logit("et", "Current number of items in queue: %d.\n", num_elements_in_queue);
}
/* At the end of the loop */
if(flag_wait_after_error) {
logit("et", "Wait %d seconds before retrying.\n", params->WaitSecAfterServiceError);
/* Wait a while after a Service Error */
sleep_ew(params->WaitSecAfterServiceError * 1000);
}
} /* End of main loop */
......@@ -865,7 +989,7 @@ thr_ret DBPopulate( void *p )
/* we're quitting
*****************/
logit("t", "ew2openapi: thread DBPopulate() terminated !\n");
logit("t", "ew2openapi: thread MessageHandler() terminated !\n");
setlck_flags_term(FLAG_TERM_THR_DB);
KillSelfThread(); /* main thread will not restart us */
RETURN_THREAD_FUNCTION;
......@@ -1193,6 +1317,7 @@ thr_ret QueueDumpFile( void *p )
RequestSpecificMutex(&mutex_OutQueue);
ret=cpqueuering( &OutQueue, Wrmsg, &msgSize, &reclogo, &inkey, &inseq);
ReleaseSpecificMutex(&mutex_OutQueue);
Wrmsg[msgSize] = '\0';
/* The following condition could occur only one time
* when the module quits. */
......@@ -1203,9 +1328,6 @@ thr_ret QueueDumpFile( void *p )
continue;
}
/* Build the SQL string for calling the stored procedure related to each different message */
Wrmsg[msgSize] = '\0';
/* Remove last message from queue
*************************/
WAIT_SPECIFIC_SEMAPHORE_EW(sema_CountBusy);
......@@ -1251,7 +1373,7 @@ thr_ret QueueDumpFile( void *p )
* ew2openapi_config() processes command file(s) using kom.c functions; *
* exits if any errors are encountered. *
*****************************************************************************/
#define NCOMMANDS 13
#define NCOMMANDS 9
void ew2openapi_config( char *configfile, TYPE_PARAMS *params )
{
int ncommand; /* # of required commands you expect to process */
......@@ -1268,7 +1390,7 @@ void ew2openapi_config( char *configfile, TYPE_PARAMS *params )
params->HeartBeatRing[0] = 0;
params->nRings = 0;
params->WaitSecAfterDBError = 5; /* Seconds to wait after a DB error */
params->WaitSecAfterServiceError = 5; /* Seconds to wait after a Service Error */
/* Set to zero one init flag for each required command
*****************************************************/
......@@ -1290,6 +1412,7 @@ void ew2openapi_config( char *configfile, TYPE_PARAMS *params )
// flag_debug_mysql = 0;
params->ewinstancename[0] = 0;
params->ApiBaseUrl[0] = 0;
params->QueueFilename[0] = 0;
params->QueueFilename[FILENAME_MAXLEN - 1] = 0;
......@@ -1422,67 +1545,73 @@ void ew2openapi_config( char *configfile, TYPE_PARAMS *params )
init[6] = 1;
}
/* EW instance name
********************/
/*7*/ else if( k_its("EWInstanceName") ) {
if ( (str = k_str() ) ) {
strncpy(params->ewinstancename, str, 255);
params->ewinstancename[255] = '\0';
init[7] = 1;
}
}
/* Api Base Url
********************/
/*8*/ else if( k_its("ApiBaseUrl") ) {
if ( (str = k_str() ) ) {
strncpy(params->ApiBaseUrl, str, 1023);
params->ApiBaseUrl[1023] = '\0';
init[8] = 1;
}
}
/* Optional commands */
/* RabbitMQ hostname
********************/
/*7*/ else if( k_its("RMQHostname") ) {
else if( k_its("RMQHostname") ) {
if ( (str = k_str() ) ) {
strncpy(params->rmq_hostname, str, 255);
params->rmq_hostname[255] = '\0';
init[7] = 1;
}
}
/* RabbitMQ username
********************/
/*8*/ else if( k_its("RMQUsername") ) {
else if( k_its("RMQUsername") ) {
if ( (str = k_str() ) ) {
strncpy(params->rmq_username, str, 255);
params->rmq_username[255] = '\0';
init[8] = 1;
}
}
/* RabbitMQ password
********************/
/*9*/ else if( k_its("RMQPassword") ) {
else if( k_its("RMQPassword") ) {
if ( (str = k_str() ) ) {
strncpy(params->rmq_password, str, 255);
params->rmq_password[255] = '\0';
init[9] = 1;
}
}
/* RabbitMQ Exchange
********************/
/*10*/ else if( k_its("RMQExchange") ) {
else if( k_its("RMQExchange") ) {
if ( (str = k_str() ) ) {
strncpy(params->rmq_exchange, str, 255);
params->rmq_exchange[255] = '\0';
init[10] = 1;
}
}
/* RabbitMQ VirtualHost
********************/
/*11*/ else if( k_its("RMQVirtualHost") ) {
else if( k_its("RMQVirtualHost") ) {
if ( (str = k_str() ) ) {
strncpy(params->rmq_vhost, str, 255);
params->rmq_vhost[255] = '\0';
init[11] = 1;
}
}
/* EW instance name
********************/
/*12*/ else if( k_its("EWInstanceName") ) {
if ( (str = k_str() ) ) {
strncpy(params->ewinstancename, str, 255);
params->ewinstancename[255] = '\0';
init[12] = 1;
}
}
/* Optional commands */
/*opt*/ else if( k_its("RMQPort") ) {
params->rmq_port = k_int();
......@@ -1568,10 +1697,10 @@ void ew2openapi_config( char *configfile, TYPE_PARAMS *params )
}
}
/* Milliseconds to wait after a DB error
/* Seconds to wait after a Service Error
********************************************************/
else if( k_its("WaitSecAfterDBError") ) {
params->WaitSecAfterDBError = k_long();
else if( k_its("WaitSecAfterServiceError") ) {
params->WaitSecAfterServiceError = k_long();
}
/* Flag to debug mysql instructions
......@@ -1617,12 +1746,8 @@ void ew2openapi_config( char *configfile, TYPE_PARAMS *params )
if ( !init[4] ) logit( "e", "<GetMsgLogo> " );
if ( !init[5] ) logit( "e", "<MaxMsgSize> " );
if ( !init[6] ) logit( "e", "<Queue>" );
if ( !init[7] ) logit( "e", "<RMQHostname>" );
if ( !init[8] ) logit( "e", "<RMQUsername>" );
if ( !init[9] ) logit( "e", "<RMQPassword>" );
if ( !init[10] ) logit( "e", "<RMQExchange>" );
if ( !init[11] ) logit( "e", "<RMQVirtualHost>" );
if ( !init[12] ) logit( "e", "<EWInstanceName>" );
if ( !init[7] ) logit( "e", "<EWInstanceName>" );
if ( !init[8] ) logit( "e", "<ApiBaseUrl>" );
logit( "e" , "command(s) in <%s>; exiting!\n", configfile );
exit( -1 );
}
......
......@@ -57,19 +57,15 @@ static size_t ew2openapi_curl_WRITEFUNCTION_logit(void *contents, size_t size, s
/* Send Earthworm message to EWOpenAPI */
long ew2openapi_curl_sendstring(char *buf, size_t len, MSG_LOGO *reclogo, char cur_send_message_format)
long ew2openapi_curl_sendstring(char *ApiBaseUrl, char *buf, size_t len, MSG_LOGO *reclogo, char cur_send_message_format)
{
CURL *curl;
CURLcode res;
long curl_http_code = 0;
long curl_http_code = -1; /* Init error code */
int i = 0;
char ch;
/* static const char *url = "http://jabba.int.ingv.it:10013/api/eventdb/ew/pick_scnl/1/"; */
// "http://jabba.int.ingv.it:10013/api/eventdb/ew/PICK_SCNL/1/"
/* static const char *baseurl = "http://jabba.int.ingv.it:10013/api/eventdb"; */
static const char *baseurl = "http://jabba.int.ingv.it:10013/ingvws/eventdb";
char apiurl[MAX_API_URL];
char url[MAX_API_URL];
char api_type_ew_msg[MAX_API_URL];
......@@ -83,7 +79,7 @@ long ew2openapi_curl_sendstring(char *buf, size_t len, MSG_LOGO *reclogo, char c
snprintf(JsonObj, JsonObj_len - 1, "%s%s%s", JsonObj_pre, buf, JsonObj_post);
} else {
/* TODO: Error */
return -1;
return curl_http_code;
}
struct curl_slist *headers = NULL;
......@@ -102,10 +98,9 @@ long ew2openapi_curl_sendstring(char *buf, size_t len, MSG_LOGO *reclogo, char c
api_type_ew_msg[i] = '\0';
snprintf(apiurl, MAX_API_URL, "ew/%s/1/", api_type_ew_msg);
snprintf(url, MAX_API_URL, "%s/%s", baseurl, apiurl);
snprintf(url, MAX_API_URL, "%s/%s", ApiBaseUrl, apiurl);
logit("t", "URL: %s\n", url);
logit("t", "JSON: %s\n", JsonObj);
logit("t", "JSON-DATA: %s\n", JsonObj);
curl = curl_easy_init();
......@@ -132,11 +127,11 @@ long ew2openapi_curl_sendstring(char *buf, size_t len, MSG_LOGO *reclogo, char c
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &curl_http_code);
/* If http code is between 100 and 299, it should be ok. Print only the returned http code */
if(curl_http_code >= 100 && curl_http_code < 300) {
logit("t", "HTTP CODE: %ld.\n", curl_http_code);
// Do nothing
} else {
switch(curl_http_code) {
default:
logit("et", "ERROR: POST to %s return http code %ld.\n", url, curl_http_code);
logit("et", "Error POST to %s with http code %ld.\n", url, curl_http_code);
break;
}
}
......
......@@ -8,7 +8,7 @@ CURLcode ew2openapi_curl_init(long flags);
void ew2openapi_curl_cleanup();
long ew2openapi_curl_sendstring(char *buf, size_t len, MSG_LOGO *reclogo, char cur_send_message_format);
long ew2openapi_curl_sendstring(char *ApiBaseUrl, char *buf, size_t len, MSG_LOGO *reclogo, char cur_send_message_format);
#endif
/* DO NOT EDIT. Automatically generated. Change file HISTORY in ew2openapi_version main directory. */
#define EW2OPENAPI_VERSION "1.8.5 - 2018-04-19"
#define EW2OPENAPI_VERSION "1.9.0 - 2018-04-20"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment