int test_publish_not_connected() { IT("publish fails when not connected"); ShimClient shimClient; PubSubClient client(server, 1883, callback, shimClient); int rc = client.publish((char*)"topic",(char*)"payload"); IS_FALSE(rc); IS_FALSE(shimClient.error()); END_IT }
//----------------------------------------------------------// // CWinSysConfigDialog::Initialise //----------------------------------------------------------// //-- Description // Initialises widgets and registers the rollup container // class. Activates config dialog. //----------------------------------------------------------// s32 CWinSysConfigDialog::Initialise(const s8* strTitle, const s8* strVersion) { s32 nReturnStatus = WINSYS_OK; gDebugLog.Printf("CWinSysConfigDialog::Initialise:"); SCOPED_LOG_INDENT(gDebugLog); if (IS_FALSE(m_bRegistered)) { CWinSysRollupContainer::RegisterRollupContainerClass(); m_bRegistered = true; } if (IS_FALSE(m_ConfigIni.Initialise())) { //-- Failed to initialise config ini gDebugLog.Printf("Failed to initialise Configuration Ini storage."); return WINSYS_CONFIG_INI_NOT_LOADED; } m_strTitle = strTitle; m_strVersion = strVersion; ChangeShowAtStartup(true); SetDesiredWindowMode(DesiredWindowMode::Windowed); SetDesiredResolution(DesiredResolution::Res640x480); SetDesiredBPP(DesiredBPP::Bpp32); SetServerAddress("192.168.1.100:1234"); SetServerLoginEmail("*****@*****.**"); SetServerLoginPassword("ABC123"); if (IS_FALSE(m_ConfigIni.Load(WINSYS_CONFIG_SAVE_FILE))) { //-- Failed to load config ini MessageBox(NULL, "Configuration Ini cannot be created. Using defaults.", TEXT(m_strTitle.ConstBuffer()), MB_OK|MB_ICONEXCLAMATION); } nReturnStatus = m_RollupContainer.Initialise(this); if (WINSYS_OK != nReturnStatus) { //-- Failed to Initialise rollup container gDebugLog.Printf("Failed to initialise rollup container."); return nReturnStatus; } gDebugLog.Printf("Complete. (OK)"); //-- Success return WINSYS_OK; }
int test_publish_retained() { IT("publishes retained"); ShimClient shimClient; shimClient.setAllowConnect(true); byte payload[] = { 0x01,0x02,0x03,0x0,0x05 }; int length = 5; byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; shimClient.respond(connack,4); PubSubClient client(server, 1883, callback, shimClient); int rc = client.connect((char*)"client_test1"); IS_TRUE(rc); byte publish[] = {0x31,0xc,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x1,0x2,0x3,0x0,0x5}; shimClient.expect(publish,14); rc = client.publish((char*)"topic",payload,length,true); IS_TRUE(rc); IS_FALSE(shimClient.error()); END_IT }
// part:data(str[, type[, name[, filename]]][, headers]) static int lcurl_mime_part_data(lua_State *L){ lcurl_mime_part_t *p = lcurl_getmimepart(L); size_t len; const char *data; CURLcode ret; if(IS_FALSE(L, 2)){ data = NULL; len = 0; } else{ data = luaL_checklstring(L, 2, &len); /*string too long*/ if(len == CURL_ZERO_TERMINATED){ return lcurl_fail_ex(L, p->err_mode, LCURL_ERROR_EASY, CURLE_BAD_FUNCTION_ARGUMENT); } } /* curl_mime_data copies data */ ret = curl_mime_data(p->part, data, len); if(ret != CURLE_OK){ return lcurl_fail_ex(L, p->err_mode, LCURL_ERROR_EASY, ret); } if (lua_gettop(L) > 2){ int res = lcurl_mime_part_assing_ext(L, 1, 3); if (res) return res; } lua_settop(L, 1); return 1; }
int test_receive_max_sized_message() { IT("receives an max-sized message"); reset_callback(); ShimClient shimClient; shimClient.setAllowConnect(true); byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; shimClient.respond(connack,4); PubSubClient client(server, 1883, callback, shimClient); int rc = client.connect((char*)"client_test1"); IS_TRUE(rc); byte length = MQTT_MAX_PACKET_SIZE; byte publish[] = {0x30,length-2,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x70,0x61,0x79,0x6c,0x6f,0x61,0x64}; byte bigPublish[length]; memset(bigPublish,'A',length); bigPublish[length] = 'B'; memcpy(bigPublish,publish,16); shimClient.respond(bigPublish,length); rc = client.loop(); IS_TRUE(rc); IS_TRUE(callback_called); IS_TRUE(strcmp(lastTopic,"topic")==0); IS_TRUE(lastLength == length-9); IS_TRUE(memcmp(lastPayload,bigPublish+9,lastLength)==0); IS_FALSE(shimClient.error()); END_IT }
int test_receive_callback() { IT("receives a callback message"); reset_callback(); ShimClient shimClient; shimClient.setAllowConnect(true); byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; shimClient.respond(connack,4); PubSubClient client(server, 1883, callback, shimClient); int rc = client.connect((char*)"client_test1"); IS_TRUE(rc); byte publish[] = {0x30,0xe,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x70,0x61,0x79,0x6c,0x6f,0x61,0x64}; shimClient.respond(publish,16); rc = client.loop(); IS_TRUE(rc); IS_TRUE(callback_called); IS_TRUE(strcmp(lastTopic,"topic")==0); IS_TRUE(memcmp(lastPayload,"payload",7)==0); IS_TRUE(lastLength == 7); IS_FALSE(shimClient.error()); END_IT }
int test_keepalive_pings_with_inbound_qos0() { IT("keeps a connection alive that only receives qos0 (takes 1 minute)"); ShimClient shimClient; shimClient.setAllowConnect(true); byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; shimClient.respond(connack,4); PubSubClient client(server, 1883, callback, shimClient); int rc = client.connect((char*)"client_test1"); IS_TRUE(rc); byte publish[] = {0x30,0xe,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x70,0x61,0x79,0x6c,0x6f,0x61,0x64}; for (int i = 0; i < 50; i++) { TRACE(i<<":"); sleep(1); if ( i == 15 || i == 31 || i == 47) { byte pingreq[] = { 0xC0,0x0 }; shimClient.expect(pingreq,2); byte pingresp[] = { 0xD0,0x0 }; shimClient.respond(pingresp,2); } shimClient.respond(publish,16); rc = client.loop(); IS_TRUE(rc); IS_FALSE(shimClient.error()); } END_IT }
int test_connect_properly_formatted() { IT("sends a properly formatted connect packet and succeeds"); ShimClient shimClient; shimClient.setAllowConnect(true); byte expectServer[] = { 172, 16, 0, 2 }; shimClient.expectConnect(expectServer,1883); byte connect[] = {0x10,0x18,0x0,0x4,0x4d,0x51,0x54,0x54,0x4,0x2,0x0,0xf,0x0,0xc,0x63,0x6c,0x69,0x65,0x6e,0x74,0x5f,0x74,0x65,0x73,0x74,0x31}; byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; shimClient.expect(connect,26); shimClient.respond(connack,4); PubSubClient client(server, 1883, callback, shimClient); int state = client.state(); IS_TRUE(state == MQTT_DISCONNECTED); int rc = client.connect((char*)"client_test1"); IS_TRUE(rc); IS_FALSE(shimClient.error()); state = client.state(); IS_TRUE(state == MQTT_CONNECTED); END_IT }
static int dns_config (const char *key, const char *value) { if (strcasecmp (key, "Interface") == 0) { if (pcap_device != NULL) free (pcap_device); if ((pcap_device = strdup (value)) == NULL) return (1); } else if (strcasecmp (key, "IgnoreSource") == 0) { if (value != NULL) ignore_list_add_name (value); } else if (strcasecmp (key, "SelectNumericQueryTypes") == 0) { if ((value != NULL) && IS_FALSE (value)) select_numeric_qtype = 0; else select_numeric_qtype = 1; } else { return (-1); } return (0); }
int test_keepalive_pings_idle() { IT("keeps an idle connection alive (takes 1 minute)"); ShimClient shimClient; shimClient.setAllowConnect(true); byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; shimClient.respond(connack,4); PubSubClient client(server, 1883, callback, shimClient); int rc = client.connect((char*)"client_test1"); IS_TRUE(rc); byte pingreq[] = { 0xC0,0x0 }; shimClient.expect(pingreq,2); byte pingresp[] = { 0xD0,0x0 }; shimClient.respond(pingresp,2); for (int i = 0; i < 50; i++) { sleep(1); if ( i == 15 || i == 31 || i == 47) { shimClient.expect(pingreq,2); shimClient.respond(pingresp,2); } rc = client.loop(); IS_TRUE(rc); } IS_FALSE(shimClient.error()); END_IT }
int test_keepalive_no_pings_inbound_qos1() { IT("does not send pings for connections with inbound qos1 (takes 1 minute)"); ShimClient shimClient; shimClient.setAllowConnect(true); byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; shimClient.respond(connack,4); PubSubClient client(server, 1883, callback, shimClient); int rc = client.connect((char*)"client_test1"); IS_TRUE(rc); byte publish[] = {0x32,0x10,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x12,0x34,0x70,0x61,0x79,0x6c,0x6f,0x61,0x64}; byte puback[] = {0x40,0x2,0x12,0x34}; for (int i = 0; i < 50; i++) { shimClient.respond(publish,18); shimClient.expect(puback,4); sleep(1); rc = client.loop(); IS_TRUE(rc); IS_FALSE(shimClient.error()); } END_IT }
//----------------------------------------------------------// // CFileDirectTextReader::Open //----------------------------------------------------------// CFile::Error::Enum CFileDirectTextReader::Open(void) { if (IS_TRUE(Validate())) { if (IS_FALSE(IsOpen())) { m_pFile = SysFileIO::Fopen(m_strFileName.ConstBuffer(), "rt"); m_nSize = 0; if (IS_TRUE(IsOpen())) { SysFileIO::Fseek(m_pFile, 0, SEEK_END); m_nSize = SysFileIO::Ftell(m_pFile); SysFileIO::Fseek(m_pFile, 0, SEEK_SET); return Error::Ok; } return Error::FileOpenFailed; } return Error::FileAlreadyOpen; } return Error::Failed; }
static int mysql_config_set_boolean (int *ret_boolean, /* {{{ */ oconfig_item_t *ci) { int status = 0; if (ci->values_num != 1) status = -1; if (status == 0) { if (ci->values[0].type == OCONFIG_TYPE_BOOLEAN) *ret_boolean = ci->values[0].value.boolean; else if (ci->values[0].type == OCONFIG_TYPE_STRING) { if (IS_TRUE (ci->values[0].value.string)) *ret_boolean = 1; else if (IS_FALSE (ci->values[0].value.string)) *ret_boolean = 0; else status = -1; } else status = -1; } if (status != 0) { WARNING ("mysql plugin: The `%s' config option " "needs exactly one boolean argument.", ci->key); return (-1); } return (0); } /* }}} mysql_config_set_boolean */
//----------------------------------------------------------// // CPacketSerializer::SerializeBitfield //----------------------------------------------------------// size_t CPacketSerializer::SerializeBitfield(bitfield& nFlags, u32 nFourCC) { UBAbitfield convertor; size_t nConvertorSize = sizeof(convertor); if (Mode::Serializing == m_eMode) { convertor.m_nValue = nFlags; //-- To be consistent with big-endian network traffic, //-- apply endian swap if system is little-endian. if (IS_FALSE(SysMemory::IsSystemBigEndian())) { //-- little-endian system. Convert data to big-endian SysMemory::EndianSwap(convertor.m_Bytes, nConvertorSize); } return SerializeBytes(convertor.m_Bytes, nConvertorSize, nFourCC); } else { size_t nExpectedSize = nConvertorSize; #if defined(PACKET_SERIALIZER_USES_DEBUG_FOURCC) nExpectedSize += sizeof(UBAFourCC); #endif //PACKET_SERIALIZER_USES_DEBUG_FOURCC if (nExpectedSize == SerializeBytes(convertor.m_Bytes, nConvertorSize, nFourCC)) { if (IS_FALSE(SysMemory::IsSystemBigEndian())) { //-- little-endian system. Convert data from big-endian SysMemory::EndianSwap(convertor.m_Bytes, nConvertorSize); } nFlags = convertor.m_nValue; return nExpectedSize; } } //-- Failed. if (Error::Ok == m_eError) { m_eError = Error::Fail; } return 0; }
int test_connect_disconnect_connect() { IT("connects, disconnects and connects again"); ShimClient shimClient; shimClient.setAllowConnect(true); byte expectServer[] = { 172, 16, 0, 2 }; shimClient.expectConnect(expectServer,1883); byte connect[] = {0x10,0x18,0x0,0x4,0x4d,0x51,0x54,0x54,0x4,0x2,0x0,0xf,0x0,0xc,0x63,0x6c,0x69,0x65,0x6e,0x74,0x5f,0x74,0x65,0x73,0x74,0x31}; byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; shimClient.expect(connect,26); shimClient.respond(connack,4); PubSubClient client(server, 1883, callback, shimClient); int state = client.state(); IS_TRUE(state == MQTT_DISCONNECTED); int rc = client.connect((char*)"client_test1"); IS_TRUE(rc); IS_FALSE(shimClient.error()); state = client.state(); IS_TRUE(state == MQTT_CONNECTED); byte disconnect[] = {0xE0,0x00}; shimClient.expect(disconnect,2); client.disconnect(); IS_FALSE(client.connected()); IS_FALSE(shimClient.connected()); IS_FALSE(shimClient.error()); state = client.state(); IS_TRUE(state == MQTT_DISCONNECTED); shimClient.expect(connect,28); shimClient.respond(connack,4); rc = client.connect((char*)"client_test1"); IS_TRUE(rc); IS_FALSE(shimClient.error()); state = client.state(); IS_TRUE(state == MQTT_CONNECTED); END_IT }
_boolean_t Object::operator != ( const Object & object ) { return IS_FALSE(this->EqualTo(object)); }
int test_connect_fails_on_no_response() { IT("fails to connect if no response received after 15 seconds"); ShimClient shimClient; shimClient.setAllowConnect(true); PubSubClient client(server, 1883, callback, shimClient); int rc = client.connect((char*)"client_test1"); IS_FALSE(rc); END_IT }
int test_connect_fails_no_network() { IT("fails to connect if underlying client doesn't connect"); ShimClient shimClient; shimClient.setAllowConnect(false); PubSubClient client(server, 1883, callback, shimClient); int rc = client.connect((char*)"client_test1"); IS_FALSE(rc); END_IT }
static int init_hostname(void) { const char *str = global_option_get("Hostname"); if (str && str[0] != '\0') { hostname_set(str); return 0; } #ifdef WIN32 long hostname_len = NI_MAXHOST; #else long hostname_len = sysconf(_SC_HOST_NAME_MAX); if (hostname_len == -1) { hostname_len = NI_MAXHOST; } #endif /* WIN32 */ char hostname[hostname_len]; if (gethostname(hostname, hostname_len) != 0) { fprintf(stderr, "`gethostname' failed and no " "hostname was configured.\n"); return -1; } hostname_set(hostname); str = global_option_get("FQDNLookup"); if (IS_FALSE(str)) return 0; struct addrinfo *ai_list; struct addrinfo ai_hints = {.ai_flags = AI_CANONNAME}; int status = getaddrinfo(hostname, NULL, &ai_hints, &ai_list); if (status != 0) { ERROR("Looking up \"%s\" failed. You have set the " "\"FQDNLookup\" option, but I cannot resolve " "my hostname to a fully qualified domain " "name. Please fix the network " "configuration.", hostname); return -1; } for (struct addrinfo *ai_ptr = ai_list; ai_ptr; ai_ptr = ai_ptr->ai_next) { if (ai_ptr->ai_canonname == NULL) continue; hostname_set(ai_ptr->ai_canonname); break; } freeaddrinfo(ai_list); return 0; } /* int init_hostname */
int test_connect_fails_on_bad_rc() { IT("fails to connect if a bad return code is received"); ShimClient shimClient; shimClient.setAllowConnect(true); byte connack[] = { 0x20, 0x02, 0x00, 0x01 }; shimClient.respond(connack,4); PubSubClient client(server, 1883, callback, shimClient); int rc = client.connect((char*)"client_test1"); IS_FALSE(rc); END_IT }
int test_subscribe_invalid_qos() { IT("subscribe fails with invalid qos values"); ShimClient shimClient; shimClient.setAllowConnect(true); byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; shimClient.respond(connack,4); PubSubClient client(server, 1883, callback, shimClient); int rc = client.connect((char*)"client_test1"); IS_TRUE(rc); rc = client.subscribe((char*)"topic",2); IS_FALSE(rc); rc = client.subscribe((char*)"topic",254); IS_FALSE(rc); IS_FALSE(shimClient.error()); END_IT }
int test_connect_properly_formatted_hostname() { IT("accepts a hostname"); ShimClient shimClient; shimClient.setAllowConnect(true); shimClient.expectConnect((char* const)"localhost",1883); byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; shimClient.respond(connack,4); PubSubClient client((char* const)"localhost", 1883, callback, shimClient); int rc = client.connect((char*)"client_test1"); IS_TRUE(rc); IS_FALSE(shimClient.error()); END_IT }
int test_connect_ignores_password_no_username() { IT("ignores a password but no username"); ShimClient shimClient; shimClient.setAllowConnect(true); byte connect[] = {0x10,0x1a,0x0,0x6,0x4d,0x51,0x49,0x73,0x64,0x70,0x3,0x2,0x0,0xf,0x0,0xc,0x63,0x6c,0x69,0x65,0x6e,0x74,0x5f,0x74,0x65,0x73,0x74,0x31}; byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; shimClient.expect(connect,28); shimClient.respond(connack,4); PubSubClient client(server, 1883, callback, shimClient); int rc = client.connect((char*)"client_test1",'\0',(char*)"pass"); IS_TRUE(rc); IS_FALSE(shimClient.error()); END_IT }
int test_connect_with_will_username_password() { IT("accepts a will, username and password"); ShimClient shimClient; shimClient.setAllowConnect(true); byte connect[] = {0x10,0x42,0x0,0x6,0x4d,0x51,0x49,0x73,0x64,0x70,0x3,0xce,0x0,0xf,0x0,0xc,0x63,0x6c,0x69,0x65,0x6e,0x74,0x5f,0x74,0x65,0x73,0x74,0x31,0x0,0x9,0x77,0x69,0x6c,0x6c,0x54,0x6f,0x70,0x69,0x63,0x0,0xb,0x77,0x69,0x6c,0x6c,0x4d,0x65,0x73,0x73,0x61,0x67,0x65,0x0,0x4,0x75,0x73,0x65,0x72,0x0,0x8,0x70,0x61,0x73,0x73,0x77,0x6f,0x72,0x64}; byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; shimClient.expect(connect,0x44); shimClient.respond(connack,4); PubSubClient client(server, 1883, callback, shimClient); int rc = client.connect((char*)"client_test1",(char*)"user",(char*)"password",(char*)"willTopic",1,0,(char*)"willMessage"); IS_TRUE(rc); IS_FALSE(shimClient.error()); END_IT }
int test_connect_accepts_username_password() { IT("accepts a username and password"); ShimClient shimClient; shimClient.setAllowConnect(true); byte connect[] = { 0x10,0x26,0x0,0x6,0x4d,0x51,0x49,0x73,0x64,0x70,0x3,0xc2,0x0,0xf,0x0,0xc,0x63,0x6c,0x69,0x65,0x6e,0x74,0x5f,0x74,0x65,0x73,0x74,0x31,0x0,0x4,0x75,0x73,0x65,0x72,0x0,0x4,0x70,0x61,0x73,0x73}; byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; shimClient.expect(connect,0x28); shimClient.respond(connack,4); PubSubClient client(server, 1883, callback, shimClient); int rc = client.connect((char*)"client_test1",(char*)"user",(char*)"pass"); IS_TRUE(rc); IS_FALSE(shimClient.error()); END_IT }
//----------------------------------------------------------// // WinSys_Main //----------------------------------------------------------// //-- Description // The main function. //----------------------------------------------------------// int WinSys_Main(LPSTR lpCmdLine) { if (WINSYS_OK != WinSys_Initialise()) { WinSys_Shutdown(); return 0; } //-- Attempt to Initialise the game if (IS_FALSE(Game_Initialise())) { //-- Initialise failed, so shut down nicely Game_Shutdown(); WinSys_Shutdown(); return 0; } //-- Main game loop while (true) { if (WINSYS_OK != WinSys_Update()) { //-- Loop until the message handler returns something not OK break; } Game_Main(); gWinSysGLWindow.SwapBuffers(); // while (IS_FALSE(m_FrameTimer.LockFrameRate(60.0f))) // { // //-- Todo more stuff while waiting for VSync. // gMemMgr.Update(); // gFileMgr.Update(); // } } //-- Shut down Game_Shutdown(); WinSys_Shutdown(); return 0; }
static int lcurl_mime_part_assing_table(lua_State *L, int part, int t){ int top = lua_gettop(L); const char *method; int i; part = lua_absindex(L, part); t = lua_absindex(L, t); if(lutil_isarray(L, t)){ int ret; lua_pushvalue(L, t); ret = lcurl_mime_part_assign(L, part, "headers"); if(ret != 1) return ret; lua_pop(L, 1); assert(top == lua_gettop(L)); } else{ for(i=0;method = lcurl_mime_part_fields[i]; ++i){ lua_getfield(L, t, method); if(!lua_isnil(L, -1)){ int ret = lcurl_mime_part_assign(L, part, method); if(ret != 1) return ret; } lua_pop(L, 1); assert(top == lua_gettop(L)); } lua_getfield(L, t, "subparts"); if(!lua_isnil(L, -1)){ if(IS_FALSE(L, -1) || lcurl_getmime_at(L, -1)){ int ret = lcurl_mime_part_assign(L, part, "subparts"); if(ret != 1) return ret; } } lua_pop(L, 1); assert(top == lua_gettop(L)); } return 0; }
// part:encoder(t) static int lcurl_mime_part_encoder(lua_State *L){ lcurl_mime_part_t *p = lcurl_getmimepart(L); const char *mime_encode; CURLcode ret; if(IS_FALSE(L, 2)){ mime_encode = NULL; } else{ mime_encode = luaL_checkstring(L, 2); } ret = curl_mime_encoder(p->part, mime_encode); if(ret != CURLE_OK){ return lcurl_fail_ex(L, p->err_mode, LCURL_ERROR_EASY, ret); } lua_settop(L, 1); return 1; }
int test_publish() { IT("publishes a null-terminated string"); ShimClient shimClient; shimClient.setAllowConnect(true); byte connack[] = { 0x20, 0x02, 0x00, 0x00 }; shimClient.respond(connack,4); PubSubClient client(server, 1883, callback, shimClient); int rc = client.connect((char*)"client_test1"); IS_TRUE(rc); byte publish[] = {0x30,0xe,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x70,0x61,0x79,0x6c,0x6f,0x61,0x64}; shimClient.expect(publish,16); rc = client.publish((char*)"topic",(char*)"payload"); IS_TRUE(rc); IS_FALSE(shimClient.error()); END_IT }
// part:headers(t) static int lcurl_mime_part_headers(lua_State *L){ lcurl_mime_part_t *p = lcurl_getmimepart(L); struct curl_slist *list; CURLcode ret; if(IS_FALSE(L, 2)){ list = NULL; } else{ list = lcurl_util_to_slist(L, 2); luaL_argcheck(L, list || IS_TABLE(L, 2), 2, "array or null expected"); } ret = curl_mime_headers(p->part, list, 1); if(ret != CURLE_OK){ if(list) curl_slist_free_all(list); return lcurl_fail_ex(L, p->err_mode, LCURL_ERROR_EASY, ret); } lua_settop(L, 1); return 1; }