Web.Api: Remove dependency on this_thread when no threads
Web.Api.Google: Catch errors, then pass them on to the callback.
This is a bit of a kludge, the API should be streamlined with regard
to where and when exceptions are thrown. This currently is done
in a slightly haphazard way.
Web.Api: Add rest args to the callbacks.
Web.Api: Add and rewrite support for all Google APIs (past/present/future).
Merge commit '722771973bd' into patches/lyslyskom22891031
* commit '722771973bd': (6177 commits)
Verify that callablep responses are aligned with reality.
Merge remote-tracking branch 'origin/master' into new_utf8
Merge remote-tracking branch 'origin/8.1' into gobject-introspection
Merge branch '8.1' into peter/travis
Promise is always present.
misc: remove executable bit
Removed invalid method chaining when Promises is used.
We always have Protocols.HTTP.Promise.
It's tedious to write trim_all_whites. Make trim the canonical name.
Protocols.HTTP.Promise: The arguments are now passes as an object of class Arguments for better type cheking and more coherent method signatures for the request methods.
Also some refactoring.
Web.Api.Api: Using Protocols.HTTP.Promise for the requests if available and applicable.
Protocols.HTTP.Query: Fixed an old bug (https://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=7676) where basically the timeout in timed_async_fetch wasn't reset each new data read.
This timeout had it's own property (data_timeout) which now is "deprecated" since the property "timeout" pretty much serves the same purpose, but on connection. So now timeout is the default value to use unless data_timeout is explicitly set, in which case that value will be used.
Since there was no proper way to set a max time for the entire operation (well, that was by accident and not intention how the data_timeout in timed_async_fetch worked) the new property "maxtime" has been added. If this is set (default is 0=indefinetly) the request will be aborted after maxtime second even if data is still being read.
So in short:
data_timeout = 0 // unless explicitly set
timeout = 120 // connection timeout, and then data read timeout
maxtime = 0 // 0 = off, otherwise the entire operation must be done within maxtime seconds or else the request is aborted
Protocols.HTTP.Session: Added some documentation
Protocols.HTTP.Promise: New module which utilise the new Concurrent.Promise/Future stuff for HTTP requests. Internally uses Protcols.HTTP.Session for the actual HTTP stuff.
Web.Api.Api: Now fetches data asynchronously when async calls are made.
Concurrent: on_success and on_fail now returns the object being called so that they can be chained.
Parser.Markdown: Fixed the #require macro directive.
Web.Api.Api: Fixed so that POST actions actually works.
It now also tries to detect if a file is being uploaded. This works by looking at the parameter values and if a value contains "filename=..." a multipart message will be created. So in short this would look something like:
string file = "the-file.png";
string data = Stdio.read_file(file);
mapping params = ([ "the_file_param" : "filename=" + file ]);
api->post("method/endpoint", params, data);
Web.Api.Api: When running async the requests gets stored so that they can be forcefully closed if something goes wrong. The public method "close_connections()" will close all open connections.
Web.Api.Api: If running async and the response isn't 200 the callback is now called anyway. If the response status is 301 or 302 the response headers is sent to the callback, otherwise 0 is send to the callback which is the same as if an error occured (this will happen if the request timed out or instance).
Added the posibility to define the HTTP request timeout in async queries.
Fixed a typo in pike_to_html.pike
Backport from 8.1
Ident cpp to 0.
Added some protected modifiers.
Updated all references since the modules were moved from root namespace to the Web namespace
Moving Auth.pmod to Web.pmod/Auth.pmod and WebApi.pmod to Web.pmod/Api.pmod