Original article here author Joe Kuan
http://joekuan.wordpress.com/2012/03/30/changes-to-make-cutycapt-bypassing-ssl-certificate-confirmation/
NOTE THAT IS A COPY OF ORIGINAL POST
Please Go to the original post for reading comments and updates here
Changes to make CutyCapt bypassing ssl certificate confirmation
by Joe Kuan
I need to use CutyCapt to run with https url on server side. However, it doesn’t support https url. A patch for bypassing the SSL certificate confirmation has been submitted on this page (and other additional features). However that change has never been pulled to the main release. So I tried to apply the patch to the source, the patch process didn’t work and the build failed.
[root@AppQoS /home/appqos/CutyCapt]# patch < /tmp/patch.diff
Hmm... Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: CutyCapt.hpp
|===================================================================
|--- CutyCapt.hpp (revision 2)
|+++ CutyCapt.hpp (working copy)
--------------------------
Patching file CutyCapt.hpp using Plan A...
Hunk #1 failed at 27.
Hunk #2 succeeded at 50 with fuzz 2 (offset 2 lines).
1 out of 2 hunks failed--saving rejects to CutyCapt.hpp.rej
Hmm... The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: CutyCapt.cpp
|===================================================================
|--- CutyCapt.cpp (revision 2)
|+++ CutyCapt.cpp (working copy)
--------------------------
Patching file CutyCapt.cpp using Plan A...
Hunk #1 failed at 120.
Hunk #2 succeeded at 273 (offset 56 lines).
Hunk #3 failed at 338.
Hunk #4 failed at 359.
Hunk #5 succeeded at 346 with fuzz 1 (offset 28 lines).
Hunk #6 succeeded at 561 (offset 103 lines).
Hunk #7 failed at 581.
4 out of 7 hunks failed--saving rejects to CutyCapt.cpp.rej
done
So I examine the patch content and thankfully the changes are simple enough to apply manually. Here is what you need to change the CutyCapt source. Presume you already have CutyCapt built successfully.
On CutyCapt.hpp file, add the highlighted line
CutyCapt(CutyPage* page,
const QString& output,
int delay,
OutputFormat format,
const QString& scriptProp,
const QString& scriptCode);
private slots:
void DocumentComplete(bool ok);
void InitialLayoutCompleted();
void JavaScriptWindowObjectCleared();
void Timeout();
void Delayed();
void handleSslErrors(QNetworkReply* reply, QList<QSslError> errors);
private:
Then on CutyCapt.cpp, add the following highlighted lines
view source
print?
CutyCapt::CutyCapt(CutyPage* page, const QString& output, int delay, OutputFormat format,
const QString& scriptProp, const QString& scriptCode) {
mPage = page;
mOutput = output;
mDelay = delay;
mSawInitialLayout = false;
mSawDocumentComplete = false;
mFormat = format;
mScriptProp = scriptProp;
mScriptCode = scriptCode;
mScriptObj = new QObject();
// This is not really nice, but some restructuring work is
// needed anyway, so this should not be that bad for now.
mPage->setCutyCapt(this);
// Ignore SSL errors
QNetworkAccessManager* mManager = mPage->networkAccessManager();
connect(mManager, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),
this, SLOT(handleSslErrors(QNetworkReply*,QList<QSslError>)));
}
void CutyCapt::handleSslErrors(QNetworkReply* reply, QList<QSslError> errors) {
reply->ignoreSslErrors();
}
void
CutyCapt::InitialLayoutCompleted() {
mSawInitialLayout = true;
if (mSawInitialLayout && mSawDocumentComplete)
TryDelayedRender();
}
Build the program and this should work as a treat on https urls.