~ubuntu-branches/ubuntu/lucid/qt4-x11/lucid

« back to all changes in this revision

Viewing changes to src/network/ssl/qsslsocket_openssl.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi, Jonathan Riddell, Alessandro Ghersi
  • Date: 2010-02-25 02:23:43 UTC
  • mfrom: (1.1.29 upstream)
  • Revision ID: james.westby@ubuntu.com-20100225022343-qy63knnsv86fi6tc
Tags: 4:4.6.2-0ubuntu1
[ Jonathan Riddell ]
* New upstream release
* Update kubuntu_07_phonon_4.3.80.diff
* Update 05_append_qt4_target.diff

[ Alessandro Ghersi ]
* Update patches:
  - 0180-window-role.diff
  - 15_fix_qmake_makefile_generation.diff
  - 18_enable_qt3support_qtwebkit_debug_info.diff
  - 81_hurd_architecture.diff
  - 82_hurd_SA_SIGINFO.diff
  - 96_powerpc_no_gc_sections.diff
* Sync 92_armel_gcc43_valist_compat.diff with Debian
* Add kubuntu_11_fix_main_window_without_central_widget.diff (LP: #515132)
  (backport from Qt 4.6.3)
* In libqt4-dbg add conflicts with qt-x11-free-dbg (LP: #517263)
* qt4-dev-tools replaces libqt4-core (<= 4.5.3really4.5.2-0ubuntu1)
  (LP: #527534)
* Sync manpages/qdbus.1 with Debian
  - Update libqt4-dev.manpages
* qt4-dev-tools conflicts with qt3-dev-tools-embedded
* qt4-dev-tools suggests qt4-doc-html
* Update all symbol files
* Bump build dependency of debhelper and pkg-kde-tools to version 0.6.4 as it
  is needed to handle symbol files and build with pkgkde symbolshelper and
  parallel addon
* Call dh_auto_build instead of $(MAKE) for parallel build
* In override_dh_makeshlibs: do not FTBS if there are lost symbols
* Drop rules to generating libphonon4 symbols, no longer need

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/****************************************************************************
2
2
**
3
 
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
 
3
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
4
** All rights reserved.
5
5
** Contact: Nokia Corporation (qt-info@nokia.com)
6
6
**
553
553
#endif
554
554
                writeBuffer.free(writtenBytes);
555
555
                totalBytesWritten += writtenBytes;
 
556
 
 
557
                if (writtenBytes < nextDataBlockSize) {
 
558
                    // break out of the writing loop and try again after we had read
 
559
                    transmitting = true;
 
560
                    break;
 
561
                }
556
562
            }
557
563
 
558
564
            if (totalBytesWritten > 0) {
586
592
            while ((pendingBytes = plainSocket->bytesAvailable()) > 0) {
587
593
                // Read encrypted data from the socket into a buffer.
588
594
                data.resize(pendingBytes);
589
 
                int decryptedBytesRead = plainSocket->read(data.data(), pendingBytes);
 
595
                // just peek() here because q_BIO_write could write less data than expected
 
596
                int encryptedBytesRead = plainSocket->peek(data.data(), pendingBytes);
590
597
#ifdef QSSLSOCKET_DEBUG
591
 
                qDebug() << "QSslSocketBackendPrivate::transmit: read" << decryptedBytesRead << "encrypted bytes from the socket";
 
598
                qDebug() << "QSslSocketBackendPrivate::transmit: read" << encryptedBytesRead << "encrypted bytes from the socket";
592
599
#endif
593
600
                // Write encrypted data from the buffer into the read BIO.
594
 
                q_BIO_write(readBio, data.constData(), decryptedBytesRead);
 
601
                int writtenToBio = q_BIO_write(readBio, data.constData(), encryptedBytesRead);
 
602
 
 
603
                // do the actual read() here and throw away the results.
 
604
                if (writtenToBio > 0) {
 
605
                    // ### TODO: make this cheaper by not making it memcpy. E.g. make it work with data=0x0 or make it work with seek
 
606
                    plainSocket->read(data.data(), writtenToBio);
 
607
                } else {
 
608
                    // ### Better error handling.
 
609
                    q->setErrorString(QSslSocket::tr("Unable to decrypt data: %1").arg(SSL_ERRORSTR()));
 
610
                    q->setSocketError(QAbstractSocket::UnknownSocketError);
 
611
                    emit q->error(QAbstractSocket::UnknownSocketError);
 
612
                    return;
 
613
                }
 
614
 
595
615
                transmitting = true;
596
616
            }
597
617