Validates 'Location' header

 @raise [Exceptions::Validation] When location header does not match to the defined one.
490293
def validate_location!(response)
      return if location.nil? || location === response.headers['Location']
      raise Exceptions::Validation.new("LOCATION does not match #{location.inspect}")
    end
75149
def validate_response(response)
      case response
      when *SERVER_ERRORS
        raise ::Lgtm::Errors::UnexpectedError
      when *CLIENT_ERRORS
        raise ::Lgtm::Errors::UnexpectedError
      end
    end
110579
def validate
      raise ArgumentError.new('No vuln_id.') unless @vuln_id
      raise ArgumentError.new('No scope.') unless @scope
      raise ArgumentError.new('No reason.') unless @reason

      case @scope
      when Scope::ALL_INSTANCES
        @asset_id = @port = @vuln_key = nil
      when Scope::ALL_INSTANCES_ON_A_SPECIFIC_ASSET
        raise ArgumentError.new('No asset_id.') unless @asset_id
        @port = @vuln_key = nil
      when Scope::SPECIFIC_INSTANCE_OF_SPECIFIC_ASSET
        raise ArgumentError.new('No asset_id.') unless @asset_id
        raise ArgumentError.new('Port or vuln_key is required.') unless @port || @vuln_key
      when Scope::ALL_INSTANCES_IN_A_SPECIFIC_SITE
        raise ArgumentError.new('No site_id.') unless @site_id
      else
        raise ArgumentError.new("Invalid scope: #{@scope}")
      end
    end
230051
def validate(self):
        """"""
        super(OutputContextVertex, self).validate()

        if self.location.field is not None:
            raise ValueError(u'Expected location at a vertex, but got: {}'.format(self.location))
902034
def validate_headers!(response)
      return unless headers
      headers.each do |name, value|
        if name.is_a? Symbol
          raise Exceptions::Validation.new(
            "Symbols are not supported in headers"
          )
        end

        unless response.headers.has_key?(name)
          raise Exceptions::Validation.new(
            "Header #{name.inspect} was required but is missing"
          )
        end

        case value
        when String
          if response.headers[name] != value
            raise Exceptions::Validation.new(
              "Header #{name.inspect}, with value #{value.inspect} does not match #{response.headers[name]}."
            )
          end
        when Regexp
          if response.headers[name] !~ value
            raise Exceptions::Validation.new(
              "Header #{name.inspect}, with value #{value.inspect} does not match #{response.headers[name].inspect}."
            )
          end
        end
      end
    end
1199720
def _validated_locations(self, locations):
        
        # The set difference between the given locations and the available locations
        # will be the set of invalid locations
        valid_locations = set(self.__location_map__.keys())
        given = set(locations)
        invalid_locations = given - valid_locations
        if len(invalid_locations):
            msg = "Invalid locations arguments: {0}".format(list(invalid_locations))
            raise ValueError(msg)
        return locations
568796
def required_header(header):
    
    if header in IGNORE_HEADERS:
        return False

    if header.startswith('HTTP_') or header == 'CONTENT_TYPE':
        return True

    return False
393826
def check_valid_locations(self, locations=None):
        
        if locations is None:
            locations = self.locations
        for location in locations:
            if (not self.is_server(location) and
                not self.is_ssh_url(location) and
                not self.has_host(location)):
                err_exit('Unknown location: %(location)s' % locals())
126401
def perform
      validate!

      party_options = options.dup

      # merge proxy
      if proxy = self.proxy
        addr, port = proxy.split(':')
        party_options[:http_proxyaddr] = addr
        party_options[:http_proxyport] = port || 80
      end

      # now merge runtime_options
      party_options = party_options.merge(sinew.runtime_options.httparty_options)

      # merge headers
      headers = sinew.runtime_options.headers
      headers = headers.merge(party_options[:headers]) if party_options[:headers]
      party_options[:headers] = headers

      party_response = HTTParty.send(method, uri, party_options)
      Response.from_network(self, party_response)
    end
559290
def location=(loc)
      unless loc.is_a?(EEML::Location)
        raise TypeError.new('loc must be an EEML::Location') 
      end
      @location = loc
    end
639046
public function validate_target_location() {

        if (!isset($this->assertions['plugintype'])) {
            throw new coding_exception('Required plugin type must be set before calling this');
        }

        $plugintypepath = $this->get_plugintype_location($this->assertions['plugintype']);

        if (is_null($plugintypepath)) {
            $this->add_message(self::ERROR, 'unknowntype', $this->assertions['plugintype']);
            return false;
        }

        if (!is_dir($plugintypepath)) {
            throw new coding_exception('Plugin type location does not exist!');
        }

        // Always check that the plugintype root is writable.
        if (!is_writable($plugintypepath)) {
            $this->add_message(self::ERROR, 'pathwritable', $plugintypepath);
            return false;
        } else {
            $this->add_message(self::INFO, 'pathwritable', $plugintypepath);
        }

        // The target location itself may or may not exist. Even if installing an
        // available update, the code could have been removed by accident (and
        // be reported as missing) etc. So we just make sure that the code
        // can be replaced if it already exists.
        $target = $plugintypepath.'/'.$this->rootdir;
        if (file_exists($target)) {
            if (!is_dir($target)) {
                $this->add_message(self::ERROR, 'targetnotdir', $target);
                return false;
            }
            $this->add_message(self::WARNING, 'targetexists', $target);
            if ($this->get_plugin_manager()->is_directory_removable($target)) {
                $this->add_message(self::INFO, 'pathwritable', $target);
            } else {
                $this->add_message(self::ERROR, 'pathwritable', $target);
                return false;
            }
        }

        return true;
    }
237799
def check_header_validity(header):
    
    name, value = header

    if isinstance(value, bytes):
        pat = _CLEAN_HEADER_REGEX_BYTE
    else:
        pat = _CLEAN_HEADER_REGEX_STR
    try:
        if not pat.match(value):
            raise InvalidHeader("Invalid return character or leading space in header: %s" % name)
    except TypeError:
        raise InvalidHeader("Value for header {%s: %s} must be of type str or "
                            "bytes, not %s" % (name, value, type(value)))
61654
def validate_attributes
      unless address.present? || (lat.present? && lng.present?)
        raise ArgumentError, 'Must provide an address, or lat and lng.'
      end

      if address.present? && lat.present? && lng.present?
        raise ArgumentError, 'Cannot provide address, lat and lng.'
      end
    end
1348558
def validate(index)
      unless %w[l ctr r just].include?(@align)
        raise "Shape #{index} (#{@type}) alignment (#{@align}) not in ['l', 'ctr', 'r', 'just']\n"
      end

      unless %w[t ctr b].include?(@valign)
        raise "Shape #{index} (#{@type}) vertical alignment (#{@valign}) not in ['t', 'ctr', 'v']\n"
      end
    end
618151
def validate_redirect_uri(value):
    
    sch, netloc, path, par, query, fra = urlparse(value)
    if not (sch and netloc):
        raise InvalidRedirectURIError()
    if sch != 'https':
        if ':' in netloc:
            netloc, port = netloc.split(':', 1)
        if not (netloc in ('localhost', '127.0.0.1') and sch == 'http'):
            raise InsecureTransportError()
324288
def validate_locations(locations):
    
    locations = if_pandas_df_convert_to_numpy(locations)
    try:
        iter(locations)
    except TypeError:
        raise TypeError('Locations should be an iterable with coordinate pairs,'
                        ' but instead got {!r}.'.format(locations))
    try:
        next(iter(locations))
    except StopIteration:
        raise ValueError('Locations is empty.')
    try:
        float(next(iter(next(iter(next(iter(locations)))))))
    except (TypeError, StopIteration):
        # locations is a list of coordinate pairs
        return [validate_location(coord_pair) for coord_pair in locations]
    else:
        # locations is a list of a list of coordinate pairs, recurse
        return [validate_locations(lst) for lst in locations]
1044877
def validate(self):
        

        extents_valid = (0 <= self.lower_extent <= self.upper_extent
            <= self.global_size)

        if not extents_valid:
            raise ValueError("Dimension '{d}' fails 0 <= {el} <= {eu} <= {gs}"
                .format(d=self.name, gs=self.global_size,
                    el=self.lower_extent, eu=self.upper_extent))