Exemplo n.º 1
0
void AdobeDRMProcessorClient::reportWorkflowError(unsigned int errorCode, const dp::String& errorMsg)
{
    qDebug() << Q_FUNC_INFO << errorCode << errorMsg.utf8();
    emit workflowError(errorCode, QString::fromUtf8(errorMsg.utf8()));
}
Exemplo n.º 2
0
void AdobeDRMProcessorClient::reportWorkflowProgress(unsigned int workflow, const dp::String& title, double progress)
{
    qDebug() << Q_FUNC_INFO << workflow << title.utf8() << progress;
//    emit workflowProgress(QString::fromUtf8(title.utf8()), progress);
}
Exemplo n.º 3
0
void AdobeDRMProcessorClient::requestConfirmation(const dp::String& code)
{
    qDebug() << Q_FUNC_INFO << code.utf8();
}
Exemplo n.º 4
0
    CurlStream(const dp::String& method, const dp::String& url, dpio::StreamClient * client, dpio::Stream * data_to_post) :
        method_(method),
        client_(client),
        data_to_post_(data_to_post),
        read_offset_(0),
        write_offset_(0),
        data_read_(NULL),
        data_capacity_(0),
        data_bytes_read_(0),
        state_(0),
        saved_(NULL),
        saved_size_(0)
    {
        char * szHeaders = NULL;
        char szContentTypeHeader[] = "Content-type: ";
        size_t contentTypeHeaderLen = sizeof(szContentTypeHeader)/sizeof(char) - 1;

        // Create our cur_ handle
        cur_ = curl_easy_init();
        headers_ = NULL;
        if (cur_)
        {
            // Now set up all of the cur_ options  
            curl_easy_setopt(cur_, CURLOPT_URL, url.utf8());  
            curl_easy_setopt(cur_, CURLOPT_FOLLOWLOCATION, 1);  
            curl_easy_setopt(cur_, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);		

            if( 0 == strcmp(method.utf8(), "POST") )
            {
                curl_easy_setopt(cur_, CURLOPT_POST, true );

                // Read all the data to be posted
                // WARNING: this code works only for the synchronous stream
                if (data_to_post_)
                {
                    data_to_post_->setStreamClient(this);
                    data_to_post_->requestInfo();
                    data_to_post_->requestBytes(0, (size_t)-1);
                }

                //const char *strContentType = contentTypeUTF16.utf16();
                size_t contentTypeLen = content_type_.length();

                size_t headersLen = 0;
                if( contentTypeLen != 0 && data_bytes_read_ != 0 )
                {
                    headersLen = contentTypeLen + contentTypeHeaderLen;
                    szHeaders = new char[headersLen + 1];
                    ::strcpy( szHeaders, szContentTypeHeader );
                    ::strcpy( szHeaders + contentTypeHeaderLen, content_type_.utf8() );

                    headers_ = curl_slist_append (headers_, szHeaders);
                    curl_easy_setopt(cur_, CURLOPT_HTTPHEADER, headers_);
                    curl_easy_setopt(cur_, CURLOPT_READFUNCTION, CurlStream_reader );
                    curl_easy_setopt(cur_, CURLOPT_READDATA, static_cast<void*>(this));
                    curl_easy_setopt(cur_, CURLOPT_POSTFIELDSIZE, data_bytes_read_);
                }
                else
                {
                    curl_easy_setopt(cur_, CURLOPT_HEADER, 0);
                }
            }

            curl_easy_setopt(cur_, CURLOPT_HEADERFUNCTION, CurlStream_header);  
            curl_easy_setopt(cur_, CURLOPT_HEADERDATA, static_cast<void *>(this));
            curl_easy_setopt(cur_, CURLOPT_WRITEFUNCTION, CurlStream_writer);  
            curl_easy_setopt(cur_, CURLOPT_WRITEDATA, static_cast<void *>(this));
        }

        if (szHeaders)
        {
            delete[] szHeaders;
        }

    }
Exemplo n.º 5
0
 virtual void propertyReady( const dp::String& name, const dp::String& value )
 {
     if( ::strcmp(name.utf8(), "Content-Type") == 0) 
         content_type_ = value;
 }
Exemplo n.º 6
0
	CurlStream(const dp::String& method, const dp::String& url, dpio::StreamClient * client,
		 dpio::Stream * dataToPost, bool verbose) :
		m_method(method),
		m_client(client),
		m_dataToPost(dataToPost),
		m_readOffset(0),
		m_writeOffset(0),
		m_pDataRead(NULL),
		m_DataCapacity(0),
		m_DataBytesRead(0),
		m_state(0),
		m_saved(NULL),
		m_savedSize(0),
		m_verbose(verbose)
	{
		char * szHeaders = NULL;
		char szContentTypeHeader[] = "Content-type: ";
		size_t contentTypeHeaderLen = sizeof(szContentTypeHeader)/sizeof(char) - 1;
		
		// Create our m_curl handle  
		m_curl = curl_easy_init();  
		m_headers = NULL;
			
		if( m_verbose )
			printf( "Created stream %08x, %s %s\n", this, method.utf8(), url.utf8() );

		if (m_curl)  
		{  
		
			// Now set up all of the m_curl options  
			curl_easy_setopt(m_curl, CURLOPT_URL, url.utf8());  
			curl_easy_setopt(m_curl, CURLOPT_FOLLOWLOCATION, 1);  
			curl_easy_setopt(m_curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);		

			if( 0 == strcmp(method.utf8(), "POST") )
			{
				curl_easy_setopt(m_curl, CURLOPT_POST, true );

				// Read all the data to be posted
				// WARNING: this code works only for the synchronous stream
				if (dataToPost)
				{
					dataToPost->setStreamClient(this);
					dataToPost->requestInfo();
					dataToPost->requestBytes(0, (size_t)-1);
				}

				//const char *strContentType = contentTypeUTF16.utf16();
				size_t contentTypeLen = m_contentType.length();

				size_t headersLen = 0;
				if( contentTypeLen != 0 && m_DataBytesRead != 0 )
				{
					headersLen = contentTypeLen + contentTypeHeaderLen;
					szHeaders = new char[headersLen + 1];
					::strcpy( szHeaders, szContentTypeHeader );
					::strcpy( szHeaders + contentTypeHeaderLen, m_contentType.utf8() );

					m_headers = curl_slist_append (m_headers, szHeaders);
					curl_easy_setopt(m_curl, CURLOPT_HTTPHEADER, m_headers);
					curl_easy_setopt(m_curl, CURLOPT_READFUNCTION, CurlStream_reader );
					curl_easy_setopt(m_curl, CURLOPT_READDATA, static_cast<void*>(this));
					curl_easy_setopt(m_curl, CURLOPT_POSTFIELDSIZE, m_DataBytesRead);
				}
				else
				{
					curl_easy_setopt(m_curl, CURLOPT_HEADER, 0);  
				}
			}

			curl_easy_setopt(m_curl, CURLOPT_HEADERFUNCTION, CurlStream_header);  
			curl_easy_setopt(m_curl, CURLOPT_HEADERDATA, static_cast<void *>(this));  			
			curl_easy_setopt(m_curl, CURLOPT_WRITEFUNCTION, CurlStream_writer);  
			curl_easy_setopt(m_curl, CURLOPT_WRITEDATA, static_cast<void *>(this));  			
		}

		if (szHeaders)
		{
			delete[] szHeaders;
		}

	}