Группа :: Сети/WWW
Пакет: cutycapt
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: CutyCapt-bea8c782-debian-01-assume_http_as_default.patch
Скачать
Скачать
From: David Paleino <dapal@debian.org>
Subject: if no scheme is present, assume http
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=611900
Forwarded: no
--- CutyCapt.cpp.orig 2015-08-30 13:15:13.812068542 +0000
+++ CutyCapt.cpp 2015-08-30 13:17:22.982246649 +0000
@@ -409,7 +409,7 @@
int argVerbosity = 0;
int argSmooth = 0;
- const char* argUrl = NULL;
+ QByteArray argUrl = NULL;
const char* argUserStyle = NULL;
const char* argUserStylePath = NULL;
const char* argUserStyleString = NULL;
@@ -417,6 +417,7 @@
const char* argInjectScript = NULL;
const char* argScriptObject = NULL;
QString argOut;
+ QUrl parsedUrl;
CutyCapt::OutputFormat format = CutyCapt::OtherFormat;
@@ -478,7 +479,7 @@
// --name=value options
if (strncmp("--url", s, nlen) == 0) {
- argUrl = value;
+ argUrl = QByteArray(value);
} else if (strncmp("--min-width", s, nlen) == 0) {
// TODO: add error checking here?
@@ -628,14 +629,21 @@
}
}
- if (argUrl == NULL || argOut == NULL || argHelp) {
+ if (argUrl.isNull() || argOut == NULL || argHelp) {
CaptHelp();
return EXIT_FAILURE;
}
+ // Check if a scheme is present, if not, assume http.
+ parsedUrl = QUrl::fromEncoded(argUrl);
+ if (parsedUrl.scheme() == "") {
+ argUrl = "http://" + argUrl;
+ parsedUrl = QUrl::fromEncoded(argUrl);
+ }
+
// This used to use QUrl(argUrl) but that escapes %hh sequences
// even though it should not, as URLs can assumed to be escaped.
- req.setUrl( QUrl::fromEncoded(argUrl) );
+ req.setUrl(parsedUrl);
QString scriptProp(argScriptObject);
QString scriptCode;