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

version» Context lines:

pike.git/lib/modules/Protocols.pmod/HTTP.pmod/module.pmod:60:   //! Similar to the <ref>get_url</ref> class of functions, except that the   //! query variables is sent as a post request instead of a get.   //!      object do_method(string method,    string|Standards.URI url,    void|mapping query_variables,    void|mapping request_headers,    void|Protocols.HTTP.Query con, void|string data)   { -  if(!con) +  if(!con) {    con = Protocols.HTTP.Query(); -  +  } +  if(!request_headers) +  request_headers = ([]);    -  +     if(stringp(url))    url=Standards.URI(url);    -  if(url->scheme!="http") + #if constant(SSL.sslfile) +  if(url->scheme!="http" && url->scheme!="https") +  error("Protocols.HTTP can't handle %O or any other protocols than HTTP or HTTPS\n", +  url->scheme); +  +  con->https= (url->scheme=="https")? 1 : 0; + #else +  if(url->scheme!="http" )    error("Protocols.HTTP can't handle %O or any other protocol than HTTP\n",    url->scheme);    -  if(!request_headers) -  request_headers = ([]); -  mapping default_headers = ([ -  "user-agent" : "Mozilla/4.0 compatible (Pike HTTP client)", -  "host" : url->host ]); + #endif    -  if(url->user || url->passwd) -  default_headers->authorization = "Basic " -  + MIME.encode_base64(url->user + ":" + -  (url->password || "")); -  request_headers = default_headers | request_headers; +     -  +  +     string query=url->query;    if(query_variables && sizeof(query_variables))    {    if(query)    query+="&"+http_encode_query(query_variables);    else    query=http_encode_query(query_variables);    }       string path=url->path;    if(path=="") path="/";       con->sync_request(url->host,url->port,    method+" "+path+(query?("?"+query):"")+" HTTP/1.0", -  request_headers, data); +  ([ +  "user-agent":"Mozilla/4.0 compatible (Pike HTTP client)", +  /* "Connection":"Keep-Alive", */ +  "host":url->host +  ]) | request_headers, data); +  if (!con->ok) { +  return 0;    -  if (!con->ok) return 0; +  }    return con;   }      object get_url(string|Standards.URI url,    void|mapping query_variables,    void|mapping request_headers,    void|Protocols.HTTP.Query con)   {    return do_method("GET", url, query_variables, request_headers, con);   }
pike.git/lib/modules/Protocols.pmod/HTTP.pmod/module.pmod:311:    "%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07",    "%08", "%09", "%0a", "%0b", "%0c", "%0d", "%0e", "%0f",    "%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17",    "%18", "%19", "%1a", "%1b", "%1c", "%1d", "%1e", "%1f",    "%80", "%81", "%82", "%83", "%84", "%85", "%86", "%87",    "%88", "%89", "%8a", "%8b", "%8c", "%8d", "%8e", "%8f",    "%90", "%91", "%92", "%93", "%94", "%95", "%96", "%97",    "%98", "%99", "%9a", "%9b", "%9c", "%9d", "%9e", "%9f",    "%20", "%25", "%27", "%22", "%2c", "%3b", "%3d" }));   } +  +