pike.git / lib / modules / Protocols.pmod / HTTP.pmod / Session.pike

version» Context lines:

pike.git/lib/modules/Protocols.pmod/HTTP.pmod/Session.pike:1:   #pike __REAL_VERSION__    - // $Id: Session.pike,v 1.11 2003/04/07 17:12:02 nilsson Exp $ + // $Id: Session.pike,v 1.12 2003/06/08 21:56:02 mirar Exp $      import Protocols.HTTP;      typedef string|Standards.URI|SessionURL URL;      //! The number of redirects to follow, if any.   //! This is the default to the created Request objects.   //!   //! A redirect automatically turns into a GET request,   //! and all header, query, post or put information is dropped.
pike.git/lib/modules/Protocols.pmod/HTTP.pmod/Session.pike:294:    con->async_fetch(async_data); // start data downloading    else    extra_callback_arguments=0; // to allow garb    }       static void async_fail(object q)    {    // clear callbacks for possible garbation of this Request object    con->set_callbacks(0,0);    -  if (fail_callback) fail_callback(@extra_callback_arguments); -  extra_callback_arguments=0; // clear references there too +  array eca=extra_callback_arguments; +  function fc=fail_callback; +  set_callbacks(0,0,0); // drop all references +  +  if (fc) fc(@eca); // note that we may be destructed here    }       static void async_data()    {    // clear callbacks for possible garbation of this Request object    con->set_callbacks(0,0);       if (data_callback) data_callback(@extra_callback_arguments);    extra_callback_arguments=0; // clear references there too    }
pike.git/lib/modules/Protocols.pmod/HTTP.pmod/Session.pike:710:    }   }      //! Return a previously used Query object to the keep-alive   //! storage. This function will determine if the given object   //! is suitable to keep or not by checking status and headers.   void return_connection(Standards.URI url,Query query)   {    connections_inuse_n--;    string lookup=connection_lookup(url); -  if (query->con && query->is_sessionquery) +  if (query && query->con && query->is_sessionquery && query->headers)    {    if (query->headers->connection &&    lower_case(query->headers->connection)=="keep-alive" &&    connections_kept_n+connections_inuse_n    < maximum_total_connections &&    time_to_keep_unused_connections>0 &&    query->n_used < maximum_connection_reuse)    {    // clean up    query->set_callbacks(0,0);
pike.git/lib/modules/Protocols.pmod/HTTP.pmod/Session.pike:749:    void|mapping extra_headers)   {    if (method=="POST")    extra_headers=    (extra_headers||([]))|    (["content-type":"application/x-www-form-urlencoded"]);       Request p=Request();    p->do_sync(p->prepare_method(method,url,query_variables,    extra_headers,data)); -  return p; +  return p->ok() && p;   }      //! @decl Request get_url(URL url, @   //! void|mapping query_variables)   //! @decl Request post_url(URL url, @   //! mapping query_variables)   //! @decl Request put_url(URL url,string file, @   //! void|mapping query_variables)   //! @decl Request delete_url(URL url, @   //! void|mapping query_variables)