1 | throw new Error("Description for built in functions. Must not be included!");
|
---|
2 | /**
|
---|
3 | * @fileOverview
|
---|
4 | * A class which allows to issue simple http requests through 'curl'
|
---|
5 | */
|
---|
6 |
|
---|
7 |
|
---|
8 | /**
|
---|
9 | * @class
|
---|
10 | *
|
---|
11 | * This class represents an interface to the program 'curl'.
|
---|
12 | *
|
---|
13 | * Note that it currently only implements the minimum required
|
---|
14 | * interface but it can easily be extended.
|
---|
15 | *
|
---|
16 | * To send a http request, create an instance with the address
|
---|
17 | * and (if required) username and password as argument.
|
---|
18 | *
|
---|
19 | * @example
|
---|
20 | * var curl = new Curl("user:password@www.server.com/path/index.html");
|
---|
21 | *
|
---|
22 | * // You can add data with
|
---|
23 | * curl.data.push("argument1=value1");
|
---|
24 | * curl.data.push("argument2=value3");
|
---|
25 | *
|
---|
26 | * // Issue the request
|
---|
27 | * var ret = curl.send();
|
---|
28 | *
|
---|
29 | * @author <a href="mailto:tbretz@physik.rwth-aachen.de">Thomas Bretz</a>
|
---|
30 | *
|
---|
31 | */
|
---|
32 | function Curl()
|
---|
33 | {
|
---|
34 |
|
---|
35 | /**
|
---|
36 | * Data of the post/get request
|
---|
37 | *
|
---|
38 | * @type Array[String]
|
---|
39 | */
|
---|
40 | this.data = data;
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * Send the request. This calles the 'curl' program. For further
|
---|
44 | * details, e.g. on the return value, see the corresponding man page.
|
---|
45 | *
|
---|
46 | * @param {Boolean} [block=true]
|
---|
47 | * This parameter specifies whether the pipe should be closed,
|
---|
48 | * which means that a blocking wait is performed until the 'mail'
|
---|
49 | * program returns, or the pipe will be closed automatically
|
---|
50 | * in the background when the 'curl' program has finished.
|
---|
51 | * Note, that if the calling program terminates, maybe this
|
---|
52 | * call will never succeed.
|
---|
53 | *
|
---|
54 | * @returns {Object}
|
---|
55 | * An object with three properties is returned.
|
---|
56 | * 'cmd' contains the command issued
|
---|
57 | * 'data' contains the data returned from the server in case of
|
---|
58 | * success, some error string returned by curl otherwise.
|
---|
59 | * 'rc' is an integer and the return code of 'curl'
|
---|
60 | *
|
---|
61 | */
|
---|
62 | this.send = function() { /* [native code] */ }
|
---|
63 | }
|
---|