Roxen.git
/
server
/
etc
/
modules
/
HTTPClient.pmod
version
»
Context lines:
10
20
40
80
file
none
3
Roxen.git/server/etc/modules/HTTPClient.pmod:42:
#ifdef HTTP_CLIENT_DEBUG # define TRACE(X...)werror("%s:%d: %s",basename(__FILE__),__LINE__,sprintf(X)) #else # define TRACE(X...)0 #endif protected constant DEFAULT_MAXTIME = 60; //! Do a HTTP GET request
-
public Result sync_get(Protocols.HTTP.Session.URL uri, void|Arguments args)
+
public Result sync_get(Protocols.HTTP.Session.URL uri,
+
void|Arguments args
,
+
void|Session session
)
{
-
return do_safe_method("GET", uri, args);
+
return do_safe_method("GET", uri, args
, false, session
);
} //! Do a HTTP POST request
-
public Result sync_post(Protocols.HTTP.Session.URL uri, void|Arguments args)
+
public Result sync_post(Protocols.HTTP.Session.URL uri,
+
void|Arguments args
,
+
void|Session session
)
{
-
return do_safe_method("POST", uri, args);
+
return do_safe_method("POST", uri, args
, false, session
);
} //! Do a HTTP PUT request
-
public Result sync_put(Protocols.HTTP.Session.URL uri, void|Arguments args)
+
public Result sync_put(Protocols.HTTP.Session.URL uri,
+
void|Arguments args
,
+
void|Session session
)
{
-
return do_safe_method("PUT", uri, args);
+
return do_safe_method("PUT", uri, args
, false, session
);
} //! Do a HTTP DELETE request
-
public Result sync_delete(Protocols.HTTP.Session.URL uri, void|Arguments args)
+
public Result sync_delete(Protocols.HTTP.Session.URL uri,
+
void|Arguments args
,
+
void|Session session
)
{
-
return do_safe_method("DELETE", uri, args);
+
return do_safe_method("DELETE", uri, args
, false, session
);
} //! Do an async HTTP GET request
-
public void async_get(Protocols.HTTP.Session.URL uri, void|Arguments args)
+
public void async_get(Protocols.HTTP.Session.URL uri,
+
void|Arguments args
,
+
void|Session session
)
{
-
do_safe_method("GET", uri, args, true);
+
do_safe_method("GET", uri, args, true
, session
);
} //! Do an async HTTP POST request
-
public void async_post(Protocols.HTTP.Session.URL uri, void|Arguments args)
+
public void async_post(Protocols.HTTP.Session.URL uri,
+
void|Arguments args
,
+
void|Session session
)
{
-
do_safe_method("POST", uri, args, true);
+
do_safe_method("POST", uri, args, true
, session
);
} //! Do an async HTTP PUT request
-
public void async_put(Protocols.HTTP.Session.URL uri, void|Arguments args)
+
public void async_put(Protocols.HTTP.Session.URL uri,
+
void|Arguments args
,
+
void|Session session
)
{
-
do_safe_method("PUT", uri, args, true);
+
do_safe_method("PUT", uri, args, true
, session
);
} //! Do an async HTTP DELETE request
-
public void async_delete(Protocols.HTTP.Session.URL uri, void|Arguments args)
+
public void async_delete(Protocols.HTTP.Session.URL uri,
+
void|Arguments args
,
+
void|Session session
)
{
-
do_safe_method("DELETE", uri, args, true);
+
do_safe_method("DELETE", uri, args, true
, session
);
} //! Fetch an URL with a timeout with the @[http_method] method. public Result do_safe_method(string http_method, Protocols.HTTP.Session.URL uri, void|Arguments args,
-
void|bool async)
+
void|bool async
,
+
void|Session session
)
{ if (!args) { args = Arguments(); } Result res;
-
Session s = Session();
+
Session s =
session ||
Session();
if (args && args->follow_redirects > -1) { s->follow_redirects = args->follow_redirects; } object /* Session.Request */ qr; Thread.Queue q; mixed co_maxtime; if (args->maxtime) s->maxtime = args->maxtime; if (args->timeout) s->timeout = args->timeout;
Roxen.git/server/etc/modules/HTTPClient.pmod:165:
"status" : 504, "status_desc" : "Gateway timeout", "host" : qr->con->host, "headers" : qr->con->headers, "url" : qr->url_requested ])); qr->set_callbacks(0, 0, 0, 0); qr->con->set_callbacks(0, 0, 0); destruct(qr);
-
destruct(
s
)
;
+
s
= 0
;
q && q->write("@"); if (async) { if (args->on_failure) { args->on_failure(res); } qr = 0; s = 0;
Roxen.git/server/etc/modules/HTTPClient.pmod:405:
//! @[Concurrent.Future()->on_failure()] callback registered on the returned //! @[Concurrent.Future] object from @[get_url()], @[post_url()], //! @[delete_url()], @[put_url()] or @[do_method()]. class Failure { inherit Result; public bool `ok() { return false; } }
-
//!
Internal
class
for the actual HTTP requests
-
protected
class Session
+
//!
Class
for the actual HTTP requests
+
public
class Session
{ inherit Protocols.HTTP.Session : parent; public int(0..) maxtime, timeout; public int maximum_connections_per_server = 20; Request async_do_method_url(string method, URL url, void|mapping query_variables, void|string|mapping data,