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

version» Context lines:

pike.git/lib/modules/Protocols.pmod/HTTP.pmod/module.pmod:273: Inside #if constant(SSL.sslfile)
   url->scheme);       con->https = (url->scheme=="https")? 1 : 0;   #else    if(url->scheme!="http")    error("Can't handle %O or any other protocol than HTTP "    "(HTTPS requires Nettle support).\n",    url->scheme);   #endif    -  if(!request_headers) -  request_headers = ([]); +     mapping default_headers = ([    "user-agent" : "Mozilla/5.0 (compatible; MSIE 6.0; Pike HTTP client)"    " Pike/" + __REAL_MAJOR__ + "." + __REAL_MINOR__ + "." + __REAL_BUILD__,    "host" : url->host +    (url->port!=(url->scheme=="https"?443:80)?":"+url->port:"")]);    -  if(url->user || url->passwd) +  if(url->user || url->password)    default_headers->authorization = "Basic "    + MIME.encode_base64(url->user + ":" +    (url->password || "")); -  request_headers = default_headers | request_headers; +     -  +  if(!request_headers) +  request_headers = default_headers; +  else +  request_headers = default_headers | +  mkmapping(lower_case(indices(request_headers)[*]), +  values(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;
pike.git/lib/modules/Protocols.pmod/HTTP.pmod/module.pmod:333:    path = "*";    else    path = "/";    }    string msg = method + " " + path + " HTTP/1.1\r\n";       Stdio.UDP udp = Stdio.UDP();    int port = 10000 + random(1000);    int i;    while(1) { -  if( !catch( udp->bind(port++) ) ) break; +  if( !catch( udp->bind(port++, 0, 1) ) ) break;    if( i++ > 1000 ) error("Could not open a UDP port.\n");    }    if(url->method=="httpmu") {    mapping ifs = Stdio.gethostip();    if(!sizeof(ifs)) error("No Internet interface found.\n");    foreach(ifs; string i; mapping data)    if(sizeof(data->ips)) {    udp->enable_multicast(data->ips[0]);    break;    }