Compare commits

...

16 Commits

Author SHA1 Message Date
Ariya Hidayat cbc9be0a7f Don't create window.WebServer.
It was done for WebPage for backward compatibility and it would be
removed in the future, so don't do it for WebServer.

http://code.google.com/p/phantomjs/issues/detail?id=115
2011-12-22 21:34:47 -08:00
Ariya Hidayat 1ee0a4ce44 Mac build script: x86 only for better compatibility.
http://code.google.com/p/phantomjs/issues/detail?id=142
2011-12-22 21:20:52 -08:00
Ariya Hidayat fa4309e381 Mac build script: Make sure it's executable.
http://code.google.com/p/phantomjs/issues/detail?id=142
2011-12-22 17:33:58 -08:00
Ariya Hidayat 724d28863b Static build: Don't merge Mac and Linux script.
Apparently with Qt 4.8, static build on Linux does not work out of the
box so there is no need to merge the static build scripts.

Also, tweak some configure options.

http://code.google.com/p/phantomjs/issues/detail?id=142
http://code.google.com/p/phantomjs/issues/detail?id=197
2011-12-22 17:30:33 -08:00
Ariya Hidayat bfc16995b4 Linux build script: Keep to 4 parallel jobs at most.
http://code.google.com/p/phantomjs/issues/detail?id=197
2011-12-22 17:28:27 -08:00
Ariya Hidayat 3c13b9dca1 Static build script: Fix the build.
MIT SHM is needed on X11.
Local path is better passed directly to configure.

http://code.google.com/p/phantomjs/issues/detail?id=142
http://code.google.com/p/phantomjs/issues/detail?id=197
2011-12-22 09:32:35 -08:00
Ariya Hidayat c32d78747c Static build script: attempt to unify both Mac and Linux version.
http://code.google.com/p/phantomjs/issues/detail?id=142
http://code.google.com/p/phantomjs/issues/detail?id=197
2011-12-22 08:31:03 -08:00
Ariya Hidayat 62811468e4 Merge branch '1.4' of github.com:ariya/phantomjs into 1.4 2011-12-21 08:40:38 -08:00
Ariya Hidayat eb33e89e7a Merge branch 'master' into 1.4 2011-12-21 08:39:22 -08:00
Ariya Hidayat f4f59b2319 WebServer: make sure status code is used for writeHead() function.
http://code.google.com/p/phantomjs/issues/detail?id=115
2011-12-21 07:56:09 -08:00
Ariya Hidayat 56a5641b0e WebServer: make sure status code is used for writeHead() function. 2011-12-21 07:49:00 -08:00
Ariya Hidayat cd590f2524 Mac build script: update to get Qt 4.8.0.
http://code.google.com/p/phantomjs/issues/detail?id=142
2011-12-20 22:49:34 -08:00
Ariya Hidayat 2e2fef788d Refer to 1.4 in the README. 2011-12-20 08:35:21 -08:00
Ariya Hidayat dea72dcbd3 Remove the complex example for WebServer module.
The simpleserver should be a better starting point to learn the module.

http://code.google.com/p/phantomjs/issues/detail?id=115
2011-12-20 08:35:20 -08:00
Ariya Hidayat ec57f2e2f1 Hide the experimental remote debugger support. 2011-12-20 08:27:13 -08:00
Ariya Hidayat d6219e16d6 Version is now 1.4.0, not 1.4.0 (development). 2011-12-20 08:26:20 -08:00
8 changed files with 71 additions and 63 deletions

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). There are two implementations, using C++ and Python.
The latest [stable release](http://code.google.com/p/phantomjs/wiki/ReleaseNotes) is version 1.3 ("Water Lily").
The latest [stable release](http://code.google.com/p/phantomjs/wiki/ReleaseNotes) is version 1.4 ("Glory of the Snow").
If you want to contribute, please read the [Contribution Guide](http://code.google.com/p/phantomjs/wiki/ContributionGuide).

View File

@ -2,7 +2,7 @@
QT_VERSION=0
QT_FOLDER=""
COMPILE_JOBS=10
COMPILE_JOBS=4
if [ "$1" = "--qt-4.8" ]
then

View File

@ -37,13 +37,74 @@ cd $QT_FOLDER
patch configure ../allow-static-qtwebkit.patch
patch -p1 < ../qapplication_skip_qtmenu.patch
rm -rf src/3rdparty/WebKit/qt/tests
rm -rf src/3rdparty/webkit/Source/WebKit/qt/tests
# Step 4: Build Qt
echo "Building Qt $QT_VERSION. Please wait..."
echo
./configure -opensource -confirm-license -release -static -no-exceptions -no-stl -no-xmlpatterns -no-phonon -no-qt3support -no-opengl -no-declarative -qt-libpng -qt-libjpeg -no-libmng -no-libtiff -D QT_NO_STYLE_CDE -D QT_NO_STYLE_CLEANLOOKS -D QT_NO_STYLE_MOTIF -D QT_NO_STYLE_PLASTIQUE -cocoa -prefix $PWD -arch x86 -nomake demos -nomake examples -nomake tools
CFG=''
CFG+=' -opensource' # Use the open-source license
CFG+=' -confirm-license' # Silently acknowledge the license confirmation
CFG+=' -release' # Build only for release (no debugging support)
CFG+=' -static' # Compile for static libraries
CFG+=' -fast' # Accelerate Makefiles generation
CFG+=' -nomake demos' # Don't build with the demos
CFG+=' -nomake docs' # Don't generate the documentatio
CFG+=' -nomake examples' # Don't build any examples
CFG+=' -nomake translations' # Ignore the translations
CFG+=' -nomake tools' # Don't built the tools
CFG+=' -no-exceptions' # Don't use C++ exception
CFG+=' -no-stl' # No need for STL compatibility
# Irrelevant Qt features
CFG+=' -no-libmng'
CFG+=' -no-libtiff'
# Unnecessary Qt modules
CFG+=' -no-declarative'
CFG+=' -no-multimedia'
CFG+=' -no-opengl'
CFG+=' -no-openvg'
CFG+=' -no-phonon'
CFG+=' -no-qt3support'
CFG+=' -no-script'
CFG+=' -no-scripttools'
CFG+=' -no-svg'
CFG+=' -no-xmlpatterns'
# Sets the default graphics system to the raster engine
CFG+=' -graphicssystem raster'
# Mac
CFG+=' -cocoa' # Cocoa only, ignore Carbon
CFG+=' -no-cups' # Disable CUPS support
CFG+=' -no-dwarf2'
# Unix
CFG+=' -no-dbus' # Disable D-Bus feature
CFG+=' -no-glib' # No need for Glib integration
CFG+=' -no-gstreamer' # Turn off GStreamer support
CFG+=' -no-gtkstyle' # Disable theming integration with Gtk+
CFG+=' -no-sm'
CFG+=' -no-xinerama'
CFG+=' -no-xkb'
# Use the bundled libraries, vs system-installed
CFG+=' -qt-libjpeg'
CFG+=' -qt-libpng'
# Useless styles
CFG+=' -D QT_NO_STYLESHEET'
CFG+=' -D QT_NO_STYLE_CDE'
CFG+=' -D QT_NO_STYLE_CLEANLOOKS'
CFG+=' -D QT_NO_STYLE_MOTIF'
./configure -prefix $PWD $CFG -arch x86
make -j$COMPILE_JOBS
cd ..

View File

@ -1,52 +0,0 @@
var page = require('webpage').create();
var server = require('webserver').create();
var host, port;
if (phantom.args.length !== 1) {
console.log('Usage: server.js <some port>');
phantom.exit();
} else {
port = phantom.args[0];
var listening = server.listen(port, function (request, response) {
console.log("GOT HTTP REQUEST");
console.log("request.url = " + request.url);
console.log("request.queryString = " + request.queryString);
console.log("request.method = " + request.method);
console.log("request.httpVersion = " + request.httpVersion);
console.log("request.statusCode = " + request.statusCode);
console.log("request.isSSL = " + request.isSSL);
console.log("request.remoteIP = " + request.remoteIP);
console.log("request.remotePort = " + request.remotePort);
console.log("request.remoteUser = " + request.remoteUser);
console.log("request.headers = " + request.headers);
for(var i = 0; i < request.headers; ++i) {
console.log("request.headerName(" + i + ") = " + request.headerName(i));
console.log("request.headerValue(" + i + ") = " + request.headerValue(i));
}
// we set the headers here
response.statusCode = 200;
response.headers = {"Cache": "no-cache", "Content-Type": "text/html"};
// this is also possible:
response.setHeader("foo", "bar");
// now we write the body
// note: the headers above will now be sent implictly
response.write("<html><head><title>YES!</title></head>");
// note: writeBody can be called multiple times
response.write("<body><p>pretty cool :)</body></html>");
});
if (!listening) {
console.log("could not create web server listening on port " + port);
phantom.exit();
}
var url = "http://localhost:" + port + "/foo/bar.php?asdf=true";
console.log(url);
page.open(url, function (status) {
if (status !== 'success') {
console.log('FAIL to load the address');
} else {
console.log(page.content);
}
phantom.exit();
});
}

View File

@ -55,4 +55,3 @@ function require(name) {
// Legacy way to use WebPage
window.WebPage = require('webpage').create;
window.WebServer = require('webserver').create;

View File

@ -60,7 +60,7 @@ Phantom::Phantom(QObject *parent)
if (m_config.versionFlag()) {
m_terminated = true;
Terminal::instance()->cout(QString("%1 (development)").arg(PHANTOMJS_VERSION_STRING));
Terminal::instance()->cout(QString("%1").arg(PHANTOMJS_VERSION_STRING));
return;
}

View File

@ -12,7 +12,6 @@ Options:
--local-to-remote-url-access=[yes|no] Local content can access remote URL (default is 'no')
--max-disk-cache-size=size Limits the size of disk cache (in KB)
--output-encoding Sets the encoding used for terminal output (default is 'utf8')
--remote-debugger-port=port Starts the script in a debug harness and listens on the desired port.
--proxy=address:port Sets the network proxy (e.g. "--proxy=192.168.1.42:8080")
--proxy-type=[http|socks5] Sets the proxy type, either "http" (default) or "socks5"
--script-encoding Sets the encoding used for the starting script (default is 'utf8')

View File

@ -1,10 +1,11 @@
describe("WebServer constructor", function() {
it("should exist in window", function() {
expect(window.hasOwnProperty('WebServer')).toBeTruthy();
it("should not exist in window", function() {
expect(window.hasOwnProperty('WebServer')).toBeFalsy();
});
it("should be a function", function() {
expect(typeof window.WebServer).toEqual('function');
var WebServer = require('webserver').create;
expect(typeof WebServer).toEqual('function');
});
});
@ -31,7 +32,7 @@ function checkRequest(request, response) {
}
describe("WebServer object", function() {
var server = new WebServer();
var server = require('webserver').create();
it("should be creatable", function() {
expect(typeof server).toEqual('object');