Compare commits

...

6 Commits

Author SHA1 Message Date
Ariya Hidayat 67a9e77770 Bracing for Ghost Flower. 2012-03-20 17:53:04 -07:00
Ariya Hidayat 77a23343e5 More changes for 1.5. 2012-03-20 17:52:58 -07:00
Ivan De Marino cb02a3340f Fix for Issue [439](http://code.google.com/p/phantomjs/issues/detail?id=439).
Even without "Content-Type" set to "application/x-www-form-urlencoded", content in the body of a POST or PUT should be available.
2012-03-20 17:44:25 -07:00
Ariya Hidayat 266a12bc11 The contents of debian/ is outdated.
For this 1.5 branch, remove debian/ directory.

http://code.google.com/p/phantomjs/issues/detail?id=438
2012-03-20 08:58:59 -07:00
Ivan De Marino abd7f73ee5 Fixing the "request.url" field, excluding symbols '/', '&' and '#' from "percent encoding".
Well, it's not really necessary for '#' but I'm just being safe (non-browser clients).

http://code.google.com/p/phantomjs/issues/detail?id=437
2012-03-20 08:57:49 -07:00
Ariya Hidayat 5a2f4879e8 Disable the default page error handler.
Treats onError like onConsoleMessage. If no handler is set explicitly, then
there is no need to flood standard output with error message.

http://code.google.com/p/phantomjs/issues/detail?id=166
2012-03-20 00:46:36 -07:00
14 changed files with 11 additions and 95 deletions

View File

@ -27,7 +27,9 @@ Please see also http://code.google.com/p/phantomjs/wiki/ReleaseNotes.
* Fixed the web server instance to be asynchronous (issue 326) and still support Keep Alive (issue 416)
* Workaround Qt 4.8.0 crash due to empty URL scheme (issue 365)
* Fixed a Content-Type problem where POST does not work (issue 337)
* Fixed reading body request in the web server even without specific Content-Type (issue 439)
* Fixed Jasmine test runner with Jasmine 1.1 (issue 402)
* Fixed request URL formatting in the web server (issue 437)
* Don't display debugging and warning messages (issue 323)
2011-12-31: Version 1.4.1

View File

@ -28,6 +28,6 @@ Do not forget to consult the concise [API Reference](http://code.google.com/p/ph
PhantomJS is based on [Qt](http://qt.nokia.com).
The latest [stable release](http://code.google.com/p/phantomjs/wiki/ReleaseNotes) is version 1.4 ("Glory of the Snow").
The latest [stable release](http://code.google.com/p/phantomjs/wiki/ReleaseNotes) is version 1.5 ("Ghost Flower").
If you want to contribute, please read the [Contribution Guide](http://code.google.com/p/phantomjs/wiki/ContributionGuide).

5
debian/changelog vendored
View File

@ -1,5 +0,0 @@
phantomjs (1.3-1~git20110703) unstable; urgency=low
* Initial release.
-- Dennis Kaarsemaker <dennis@kaarsemaker.net> Sun, 03 Jul 2011 20:45:52 +0200

1
debian/compat vendored
View File

@ -1 +0,0 @@
7

24
debian/control vendored
View File

@ -1,24 +0,0 @@
Source: phantomjs
Section: python
Priority: extra
Maintainer: Dennis Kaarsemaker <dennis@kaarsemaker.net>
Build-Depends: debhelper (>= 7), libqt4-dev (>= 4.6), libqtwebkit-dev, qt4-qmake, python-support (>= 0.6.4), python-all-dev (>= 2.5), python-qt4-dev, python-qt4
Standards-Version: 3.8.4
XS-Python-Version: >= 2.6
Vcs-Git: http://github.com/ariya/phantomjs
Package: phantomjs
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: phantomjs - minimalistic headless WebKit-based JavaScript-driven tool
PhantomJS is a minimalistic, headless, WebKit-based, JavaScript-driven tool.
PhantomJs has native support for different web technologies: DOM handling,
CSS selector, JSON, Canvas, SVG, and of course JavaScript.
Package: python-pyphantomjs
Architecture: all
Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends}, python-qt4, python-argparse
Description: phantomjs - minimalistic headless WebKit-based JavaScript-driven tool
PhantomJS is a minimalistic, headless, WebKit-based, JavaScript-driven tool.
PhantomJs has native support for different web technologies: DOM handling,
CSS selector, JSON, Canvas, SVG, and of course JavaScript.

35
debian/copyright vendored
View File

@ -1,35 +0,0 @@
Format-Specification: http://anonscm.debian.org/viewvc/dep/web/deps/dep5.mdwn?revision=174&view=co&pathrev=174
Name: phantomjs
Maintainer: Dennis Kaarsemaker <dennis@kaarsemaker.net>
Source: http://github.com/ariya/phantomjs
Copyright: 2011 Ariya Hidayat <ariya.hidayat@gmail.com>
License: BSD-3-clause
Files: debian/*
Copyright: 2011 Dennis Kaarsemaker <dennis@kaarsemaker.net>
License: BSD-3-clause
License: BSD-3-clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
.
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the <organization> nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,2 +0,0 @@
README.md
examples

View File

@ -1 +0,0 @@
debian/tmp/usr/bin/phantomjs

View File

@ -1 +0,0 @@
python/README.md

View File

@ -1,2 +0,0 @@
debian/tmp/usr/bin/pyphantomjs
debian/tmp/usr/lib

19
debian/rules vendored
View File

@ -1,19 +0,0 @@
#!/usr/bin/make -f
%:
dh $@
override_dh_auto_build:
qmake-qt4
$(MAKE)
cd python && python setup.py build
override_dh_auto_install:
$(MAKE) install
mkdir -p debian/tmp/usr/bin
cp bin/* debian/tmp/usr/bin
cd python && python setup.py install --root=../debian/tmp --install-layout=deb
override_dh_auto_clean:
if [ -f Makefile ]; then $(MAKE) distclean; fi
cd python && python setup.py clean

View File

@ -1 +0,0 @@
1.0

View File

@ -127,7 +127,7 @@ exports.create = function (opts) {
defineSetter("onError", "javaScriptErrorSent");
page.onError = phantom.defaultErrorHandler;
// page.onError = phantom.defaultErrorHandler;
page.open = function (url, arg1, arg2, arg3, arg4) {
if (arguments.length === 1) {

View File

@ -38,6 +38,7 @@
#include <QThread>
#include <QUrl>
#include <QVector>
#include <QDebug>
namespace UrlEncodedParser {
@ -172,7 +173,7 @@ bool WebServer::handleRequest(mg_event event, mg_connection *conn, const mg_requ
QByteArray uri(request->uri);
if (uri.startsWith('/'))
uri = '/' + QUrl::toPercentEncoding(QString::fromLatin1(request->uri + 1));
uri = '/' + QUrl::toPercentEncoding(QString::fromLatin1(request->uri + 1), "/?&#");
if (request->query_string)
uri.append('?').append(QByteArray(request->query_string));
requestObject["url"] = uri.data();
@ -204,9 +205,12 @@ bool WebServer::handleRequest(mg_event event, mg_connection *conn, const mg_requ
char * data = new char[contentLength];
int read = mg_read(conn, data, contentLength);
QByteArray rawData(data, read);
requestObject["rawData"] = rawData;
requestObject["rawData"] = QVariant(rawData);
// Check if the 'Content-Type' requires decoding
if (headersObject["Content-Type"] == "application/x-www-form-urlencoded") {
requestObject["post"] = UrlEncodedParser::parse(rawData);
} else {
requestObject["post"] = QVariant(rawData);
}
delete[] data;
}
@ -372,6 +376,7 @@ void WebServerResponse::writeHead(int statusCode, const QVariantMap &headers)
mg_printf(m_conn, "HTTP/1.1 %d %s\r\n", m_statusCode, responseCodeString(m_statusCode));
QVariantMap::const_iterator it = headers.constBegin();
while(it != headers.constEnd()) {
qDebug() << "Response Header key:" << it.key() << "value:" << it.value().toString();
mg_printf(m_conn, "%s: %s\r\n", qPrintable(it.key()), qPrintable(it.value().toString()));
++it;
}