Skip to content

Commit

Permalink
Fixed regression in http proxy handling code
Browse files Browse the repository at this point in the history
  • Loading branch information
Ri0n committed Feb 11, 2013
1 parent 4a5b054 commit 3508b95
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
17 changes: 5 additions & 12 deletions src/irisnet/noncore/cutestuff/httpconnect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ void HttpConnect::reset(bool clear)
d->recvBuf.resize(0);
}
d->active = false;
setOpenMode(QIODevice::NotOpen);
}

void HttpConnect::setAuth(const QString &user, const QString &pass)
Expand Down Expand Up @@ -173,27 +174,18 @@ void HttpConnect::connectToHost(const QString &proxyHost, int proxyPort, const Q
d->sock.connectToHost(d->host, d->port);
}

bool HttpConnect::isOpen() const
{
return d->active;
}

void HttpConnect::close()
{
d->sock.close();
if(d->sock.bytesToWrite() == 0)
reset();
}

void HttpConnect::write(const QByteArray &buf)
qint64 HttpConnect::writeData(const char *data, qint64 maxSize)
{
if(d->active)
d->sock.write(buf);
}

QByteArray HttpConnect::read(int bytes)
{
return ByteStream::read(bytes);
return d->sock.write(data, maxSize);
return 0;
}

qint64 HttpConnect::bytesToWrite() const
Expand Down Expand Up @@ -299,6 +291,7 @@ void HttpConnect::sock_readyRead()
fprintf(stderr, "HttpConnect: << Success >>\n");
#endif
d->active = true;
setOpenMode(QIODevice::ReadWrite);
connected();

if(!d->recvBuf.isEmpty()) {
Expand Down
5 changes: 2 additions & 3 deletions src/irisnet/noncore/cutestuff/httpconnect.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ class HttpConnect : public ByteStream
void connectToHost(const QString &proxyHost, int proxyPort, const QString &host, int port);

// from ByteStream
bool isOpen() const;
void close();
void write(const QByteArray &);
QByteArray read(int bytes=0);
qint64 bytesToWrite() const;
protected:
qint64 writeData(const char *data, qint64 maxSize);

signals:
void connected();
Expand Down

0 comments on commit 3508b95

Please sign in to comment.