Exemplo n.º 1
0
static void https_send_request_set_channel_rsp_cb(VMUINT32 req_id,
		VMUINT8 channel_id, VMUINT8 result) {
	VMINT ret = -1;

	ret = vm_https_send_request(0, /* Request ID */
	VM_HTTPS_METHOD_GET, /* HTTP Method Constant */
	VM_HTTPS_OPTION_NO_CACHE, /* HTTP request options */
	VM_HTTPS_DATA_TYPE_BUFFER, /* Reply type (wps_data_type_enum) */
	100, /* bytes of data to be sent in reply at a time. If data is more that this, multiple response would be there */
	(VMUINT8 *) VMHTTPS_TEST_URL, /* The request URL */
	strlen(VMHTTPS_TEST_URL), /* The request URL length */
	NULL, /* The request header */
	0, /* The request header length */
	NULL, 0);

	if (ret != 0) {
		vm_https_unset_channel(channel_id);
	}
}
Exemplo n.º 2
0
//----------------------------------------------------------------------------------------------------
static void https_post_request_set_channel_rsp_cb(VMUINT32 req_id, VMUINT8 channel_id, VMUINT8 result)
{
    VMINT ret = -1;
    if (g_post_type == 0) {
		ret = vm_https_send_request(0,                            // Request ID
									VM_HTTPS_METHOD_POST,         // HTTP Method Constant
									VM_HTTPS_OPTION_NO_CACHE,     // HTTP request options
									VM_HTTPS_DATA_TYPE_BUFFER,    // Reply type (wps_data_type_enum)
									REPLY_SEGMENT_LENGTH,		  // bytes of data to be sent in reply at a time.
																  // If data is more that this, multiple response would be there
									g_https_url,                  // The request URL
									strlen(g_https_url),          // The request URL length
									CONTENT_TYPE_WWWFORM,         // The request header
									strlen(CONTENT_TYPE_WWWFORM), // The request header length
									g_postdata,					  // Post segment
									g_postdata_len);		 	  // Post segment length
	    vm_log_debug("[POST] to %s, result=%d", g_https_url, ret);
    }
    else {
        g_post_context->content = (vm_https_content_t *)g_post_content;
        g_postdata_ptr = g_postdata;

		ret = vm_https_request_ext(0,                             // Request ID
									VM_HTTPS_METHOD_POST,         // HTTP Method Constant
									VM_HTTPS_OPTION_NO_CACHE,     // HTTP request options
									VM_HTTPS_DATA_TYPE_BUFFER,    // Reply type (wps_data_type_enum)
									REPLY_SEGMENT_LENGTH,		  // bytes of data to be sent in reply at a time.
																  // If data is more that this, multiple response would be there
									VM_TRUE,                      // more posts
									VM_HTTPS_DATA_TYPE_MULTIPART, // post type
									g_post_context,               // The request data
									_post_cb);				      // The callback of post status
    	vm_log_debug("[POST] to '%s', nseg=%d, result=%d", g_post_context->url, g_post_context->number_entries, ret);
    }

    if(ret != 0) {
        vm_https_unset_channel(channel_id);
    }
}
Exemplo n.º 3
0
//----------------------------------------------------------------------------------------------------
static void https_send_request_set_channel_rsp_cb(VMUINT32 req_id, VMUINT8 channel_id, VMUINT8 result)
{
    VMINT ret = -1;

    g_channel_id = channel_id;
    ret = vm_https_send_request(0,							// Request ID
                                VM_HTTPS_METHOD_GET,		// HTTP Method Constant
                                VM_HTTPS_OPTION_NO_CACHE,	// HTTP request options
                                VM_HTTPS_DATA_TYPE_BUFFER,	// Reply type (wps_data_type_enum)
								REPLY_SEGMENT_LENGTH,		// bytes of data to be sent in reply at a time.
                                 	 	 	 	 	 	 	// If data is more that this, multiple response would be there
								g_https_url,				// The request URL
                                strlen(g_https_url),		// The request URL length
                                NULL,                		// The request header
                                0,                   		// The request header length
                                NULL,						// post segment
                                0							// post segment length
								);

    if(ret != 0) {
        vm_https_unset_channel(channel_id);
    }
    vm_log_debug("[HTTPS] GET req to %s, result %d", g_https_url, ret);
}