Commit Graph

12 Commits (master)

Author SHA1 Message Date
Brikou CARRE 1125b86e72 Fixed missing exit code when errornous.
http://code.google.com/p/phantomjs/issues/detail?id=544
2012-05-17 23:35:02 -07:00
execjosh b73ec44796 Update examples to use system.args.
Also update coffee-script script path names in usage messages.

http://code.google.com/p/phantomjs/issues/detail?id=276
2012-03-15 01:11:30 -07:00
Milian Wolff 1411ebdff6 make POST/PUT data accessible from phantomjs server scripts
For POST and PUT request we now read all data as defined by
the Content-Length header into request.rawData property.
This property is a QByteArray which neatly maps to an array
in javascript.

For POST requests with Content-Type = applicaiton/x-www-form-urlencoded
we furthermore provide a parsed, easy-to-use request.post property.
This one is a QVariantMap of the decoded form data.

There is a new postserver.js example that shows the usage.

The unit test is extended to test the new (and old) features
of the server.

TODO: test that verifies proper decoding of UTF8 data, which
is not yet possible since I see no way to do a post-request
using phantomjs with an explicitly defined charset

ISSUE: 340 (http://code.google.com/p/phantomjs/issues/detail?id=340)
2012-02-15 18:41:51 -08:00
Leo Franchi bbce8920d0 Make Mongoose webserver asynchronous.
This allows for asynchronous reply handling, which is much more logical when dealing with the async
nature of PhantomJS like page.open(). This uses a async patch from Andy Rahn's Mongoose close,
available here: http://code.google.com/r/andyrahn-async/

This is from https://github.com/ariya/phantomjs/pull/202.

http://code.google.com/p/phantomjs/issues/detail?id=326
2012-02-14 23:08:38 -08:00
Ariya Hidayat 5528c046db Some API changes in the WebServer module.
Trying to match http://nodejs.org/docs/latest/api/http.html.

For the server response:

  * Change writeBody to write
  * Change writeHeaders to writeHead

For the request object, 'headers' is now an object containing all
key-value pairs of the actual HTTP headers.

'queryString' is folded into 'url' key.

Non-standard keys in the request: isSSL, remotePort, remoteIP,
remoteUser, are disabled in the mean-time (will be revisited after 1.4
release).

Implementation-wise, the request object is now a simple key-value pair
using QVariant, as opposed to the heavy QObject instance.

http://code.google.com/p/phantomjs/issues/detail?id=115
2011-12-19 18:38:21 -08:00
Milian Wolff bd2052631f basic unit testing for WebServer.listen 2011-11-15 13:45:11 +01:00
Milian Wolff a6bde751a9 extend WebServerResponse API 2011-11-15 13:45:11 +01:00
Milian Wolff 705eda8823 add read-properties to WebServerRequest 2011-11-15 13:45:11 +01:00
Milian Wolff 245eec551f make it possible to access the request headers 2011-11-15 13:45:11 +01:00
Milian Wolff f30bfa9fb7 extend WebServerRequest API 2011-11-15 13:45:11 +01:00
Milian Wolff 0abdc7f9ed very basic response + request handling for WebServer
the api is very limited but already makes the server.js example
do something useful with the server
2011-11-15 13:45:11 +01:00
Milian Wolff 73705e484b first work towards a WebServer
this is the minimal server that gets properly embedded into
the phantomjs space but the .listen api is missing actually
useful options (incoming request and ability to write to client)
2011-11-15 13:44:47 +01:00