performs a HEAD request and passes the header info to the given callback
437678
function (url, callback) {
      pendingRequests[url] = true;
      var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XmlHttp");
      xhr.open("HEAD", url, true);
      xhr.onreadystatechange = function () {
        delete pendingRequests[url];
        if (xhr.readyState == 4 && xhr.status != 304) {
          xhr.getAllResponseHeaders();
          var info = {};
          for (var h in headers) {
            var value = xhr.getResponseHeader(h);
            // adjust the simple Etag variant to match on its significant part
            if (h.toLowerCase() == "etag" && value) value = value.replace(/^W\//, '');
            if (h.toLowerCase() == "content-type" && value) value = value.replace(/^(.*?);.*?$/i, "$1");
            info[h] = value;
          }
          callback(url, info);
        }
      }
      xhr.send();
    }
1062224
function(options, callback) {
    request({
      method: 'post',
      url: options.url,
      headers: {
        'Authorization': 'Bearer ' + access_token,
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      form: options.data
    },
    function(error, response, body) {
      callback(error, body);
    });
  }
605973
function(callback) {
        if (res.parsedHeader.payload.mode === 'handshake') {
          res.session = {
            sid: reqSid,
            cert: senderCert,
            token: reqToken
          };
          callback(null);
        } else {
          var querySid;
          if (sessionStore instanceof Store || 'undefined' !== typeof window) {
            querySid = my.config.urlBase;
          } else {
            querySid = reqSid;
          }
          // load the session if exists
          sessionStore.load(querySid, function(err, session){
            if (err) {
              callback(err);
            } else if (session) {
              log.debug('%s loaded session', app.name);
              log.debug(session);
              res.session = session;
              callback(null);
            } else {
              callback('session expired');
            }
          });
        }
      }
719536
function checkHeadsOnline(pattern, opts, callback) {
  var args = verify(pattern, opts, callback);
  var refs = 'refs/heads/' + cache.branch;
  request(refs, args.opts, args.callback);
}
652819
public static function head($url, $headers = array(), $options = array()) {
		return self::request($url, $headers, null, self::HEAD, $options);
	}
7603
def on_headers(self, response, exc=None):
        ''''''

        if response.status_code == 101:
            connection = response.connection
            request = response.request
            handler = request.websocket_handler
            if not handler:
                handler = WS()
            parser = request.client.frame_parser(kind=1)
            consumer = partial(WebSocketClient.create,
                               response, handler, parser)
            connection.upgrade(consumer)
            response.event('post_request').fire()
            websocket = connection.current_consumer()
            response.request_again = lambda r: websocket
954198
def send_header(self, keyword, value):
        """"""
        if self.request_version != 'HTTP/0.9':
            if not hasattr(self, '_headers_buffer'):
                self._headers_buffer = []
            self._headers_buffer.append(
                ("%s: %s\r\n" % (keyword, value)).encode('latin-1', 'strict'))

        if keyword.lower() == 'connection':
            if value.lower() == 'close':
                self.close_connection = 1
            elif value.lower() == 'keep-alive':
                self.close_connection = 0
372796
def head(self, path, query=None, data=None, redirects=True):
        
        return self.request('HEAD', path, query, None, redirects)
940851
def head_request(self, container, resource=None):
        """"""
        url = self.make_url(container, resource)
        headers = self._make_headers(None)

        try:
            rsp = requests.head(url, headers=self._base_headers,
                                verify=self._verify, timeout=self._timeout)
        except requests.exceptions.ConnectionError as e:
            RestHttp._raise_conn_error(e)

        if self._dbg_print:
            self.__print_req('HEAD', rsp.url, headers, None)

        return rsp.status_code
865338
function setRequestHeaders(connection, req) {
  if(_.isObject(connection.headers)){
    req.set(connection.headers);
  }
}
1313163
def head(path, options = {}, &block)
      ensure_method_maintained_across_redirects options
      perform_request Net::HTTP::Head, path, options, &block
    end
503236
function ClientRequest(client, opts, endpoint, head, body, date, callback, middlewares) {
    this.client = client;
    this.opts = opts;
    this.endpoint = endpoint;
    this.head = head;
    this.body = body;
    this.date = date || Date;
    this.callback = callback;
    this.id = uuid.v4();
    this.isCanceled = false;
    this.state = ClientRequestStates.initialized;
    this.timestamp = this.date.now();
    this.middlewareStack = new middleware.MiddlewareStack(middlewares || []);
}
434999
def _head(self, client_kwargs):
        
        with _handle_oss_error():
            bucket = self._get_bucket(client_kwargs)

            # Object
            if 'key' in client_kwargs:
                return bucket.head_object(
                    key=client_kwargs['key']).headers

            # Bucket
            return bucket.get_bucket_info().headers
1356798
function request(opts, cb) {
  opts = opts || {};
  opts.method = opts.method || 'GET';
  opts.headers = opts.headers || {};

  var req
    , z;

  /* jshint ignore:start */
  req = new XMLHttpRequest();
  /* jshint ignore:end */

  /**
   *  Parse response headers into an object.
   */
  function parse(headers) {
    var output = {}, i, p, k, v;
    headers = headers || '';
    headers = headers.replace('\r', '');
    headers = headers.split('\n');
    for(i = 0;i < headers.length;i++) {
      p = headers[i].indexOf(':');
      k = headers[i].substr(0, p);
      v = headers[i].substr(p + 1);
      if(k && v) {
        k = k.replace(/^\s+/, '').replace(/\s+$/, '');
        v = v.replace(/^\s+/, '').replace(/\s+$/, '');
        output[k.toLowerCase()] = v;
      }
    }
    return output;
  }

  function done() {
    req.onload = null;
    req.onerror = null;
    req.ontimeout = null;
    req.onprogress = null;
    cb.apply(null, arguments); 
  }

  if(opts.fields) {
    for(z in opts.fields) {
      req[z] = opts.fields[z];
    }
  }

  opts.headers['X-Requested-With'] = 'XMLHttpRequest';

  if(opts.json) {
    opts.headers['Content-Type'] = 'application/json';
    if(opts.body !== undefined) {
      opts.body = JSON.stringify(opts.body); 
    }
  }

  var url = opts.url;

  if(opts.qs) {
    var keys = Object.keys(opts.qs)
      , qs = '?';
    keys.forEach(function(key, index) {
      if(index) {
        qs += '&'; 
      }
      qs += encodeURIComponent(key) + '=' + encodeURIComponent(opts.qs[key]); 
    })

    url += qs;
  }

  req.open(opts.method, url);

  // sadly IE10/11 does not support `json` response type
  // see: http://caniuse.com/#feat=xhr2
  if(opts.responseType) {
    req.responseType = opts.responseType; 
  }

  // apply custom request headers
  for(z in opts.headers) {
    req.setRequestHeader(z, opts.headers[z]);
  }

  if(opts.mime && typeof(req.overrideMimeType) === 'function') {
    req.overrideMimeType(opts.mime);
  }

  req.onreadystatechange = function() {
    if(this.readyState === 4) {

      var res = opts.responseType ? this.response : this.responseText
        , info = {
            headers: parse(this.getAllResponseHeaders()),
            status: this.status
          };

      info.body = res;
      if(res && opts.json && (this.status === 200 || this.status === 201)) {
        try {
          info.body = JSON.parse(this.responseText);
        }catch(e) {
          return done(
            e,
            info,
            this);
        }
      }
      done(
        null,
        info,
        this);
    }
  }

  req.onerror = opts.error || function onError(err) {
    done(err);
  }

  req.onload = opts.load;
  req.ontimeout = opts.timeout;
  req.onprogress = opts.progress;

  req.send(opts.body);
}
394543
function createWriteHead (prevWriteHead, listener) {
  var fired = false

  // return function with core name and argument list
  return function writeHead (statusCode) {
    // set headers from arguments
    var args = setWriteHeadHeaders.apply(this, arguments)

    // fire listener
    if (!fired) {
      fired = true
      listener.call(this)

      // pass-along an updated status code
      if (typeof args[0] === 'number' && this.statusCode !== args[0]) {
        args[0] = this.statusCode
        args.length = 1
      }
    }

    return prevWriteHead.apply(this, args)
  }
}
1284616
def head(url, **kwargs):
    """"""
    _set_content_type(kwargs)
    if _content_type_is_json(kwargs) and kwargs.get('data') is not None:
        kwargs['data'] = dumps(kwargs['data'])
    _log_request('HEAD', url, kwargs)
    response = requests.head(url, **kwargs)
    _log_response(response)
    return response
140772
def head(self, route: str(), callback: object()):
        
        self.__set_route('head', {route: callback})
        return RouteMapping