TODO(ericgribkoff): move header related method to a common place like GrpcUtil.
338412
private static boolean isApplicationHeader(String key) {
    // Don't allow reserved non HTTP/2 pseudo headers to be added
    // HTTP/2 headers can not be created as keys because Header.Key disallows the ':' character.
    return !CONTENT_TYPE_KEY.name().equalsIgnoreCase(key)
        && !USER_AGENT_KEY.name().equalsIgnoreCase(key)
        && !TE_HEADER.name().equalsIgnoreCase(key);
  }
711505
public void addHeaderOutImpl(String key, String value)
  {
    if (headerOutSpecial(key, value)) {
      return;
    }
    
    ArrayList<String> keys = _headerKeysOut;
    ArrayList<String> values = _headerValuesOut;
    
    int size = keys.size();
    
    // webapp/1k32
    for (int i = 0; i < size; i++) {
      if (keys.get(i).equals(key) && values.get(i).equals(value)) {
        return;
      }
    }

    keys.add(key);
    values.add(value);
  }
298530
def transfer_header(self, fw=sys.stdout):
        
        print("\n".join(self.header), file=fw)
926147
def AddHeader(self, header, value):
        '''
        '''
        self.user_headers.append((header, value))
        return self
440201
def header(cls, name, type_=Type.String, description=None, default=None, required=None, **options):
        
        return cls(name, In.Header, type_, None, description,
                   required=required, default=default,
                   **options)
957676
public void addMemberHeader(ExecutableElement member, Content methodsContentTree) {
        methodsContentTree.addContent(getHead(member));
        methodsContentTree.addContent(getSignature(member));
    }
172412
public T header(String name, String value) {
        Collection<String> l = headers.get(name);
        if (l == null) {
            l = new ArrayList<String>();
        }
        l.add(value);
        headers.put(name, l);
        return derived.cast(this);
    }
1085482
public static void addExtraHeaderToBundleManifest(File baseDir, String header, String value) throws IOException {
        Properties props = new Properties();
        File extra = new File(baseDir, EXTRA_HEADERS_FILE);
        extra.getParentFile().mkdirs();
        // If the file exist it loads it, if not nothing happens.
        props = Instructions.merge(props, extra);
        if (value != null) {
            props.setProperty(header, value);
        } else {
            props.remove(header);
        }
        FileOutputStream fos = null;
        try {
            fos = new FileOutputStream(extra);
            props.store(fos, "");
        } finally {
            IOUtils.closeQuietly(fos);
        }
    }
1339098
public static COFFFileHeader newInstance(byte[] headerbytes, long offset) {
        COFFFileHeader header = new COFFFileHeader(headerbytes, offset);
        header.read();
        return header;
    }
794419
private void addHeader(HeaderElement elem, boolean bFilter) {
        final HeaderKeys key = elem.getKey();
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(tc, "Adding header [" + key.getName()
                         + "] with value [" + elem.getDebugValue() + "]");
        }

        if (getRemoteIp() && key.getName().toLowerCase().startsWith("x-forwarded") && !forwardHeaderErrorState) {
            processForwardedHeader(elem, true);
        }

        else if (getRemoteIp() && key.getName().toLowerCase().startsWith("forwarded") && !forwardHeaderErrorState) {
            processForwardedHeader(elem, false);
        }

        if (bFilter) {
            if (key.useFilters() && !filterAdd(key, elem.asBytes())) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "filter disallowed: " + elem.getDebugValue());
                }
                return;
            }
        }
       if (HttpHeaderKeys.isWasPrivateHeader(key.getName())) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "checking to see if private header is allowed: " + key.getName());
            }
           if (!filterAdd(key, elem.asBytes())) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, key.getName() +" is not trusted for this host; not adding header");
                }
               return;
           }
       }
       
        incrementHeaderCounter();
        HeaderElement root = findHeader(key);
        boolean rc = addInstanceOfElement(root, elem);
        // did we change the root node?
        if (rc) {
            final int ord = key.getOrdinal();
            storage.put(ord, elem);

        }
    }
972438
def set_header(self,header):
        
        self.header = header
        self.root.insert(0,header.get_node())
469452
function adaptFrame2HeaderPosition(oldHeaderPos) {
        var position, frame, header;

        frame = W.getFrame();
        if (!frame) return;

        header = W.getHeader();

        // If no header is found, simulate the 'top' position
        // to better fit the whole screen.
        position = W.headerPosition || 'top';

        // When we move from bottom to any other configuration,
        // we need to move the header before the frame.
        if (oldHeaderPos === 'bottom' && position !== 'bottom') {
            W.getFrameRoot().insertBefore(W.headerElement, frame);
        }

        W.removeClass(frame, 'ng_mainframe-header-[a-z-]*');
        switch(position) {
        case 'right':
            W.addClass(frame, 'ng_mainframe-header-vertical-r');
            break;
        case 'left':
            W.addClass(frame, 'ng_mainframe-header-vertical-l');
            break;
        case 'top':
            W.addClass(frame, 'ng_mainframe-header-horizontal-t');
            if (header) W.getFrameRoot().insertBefore(header, frame);
            break;
        case 'bottom':
            W.addClass(frame, 'ng_mainframe-header-horizontal-b');
            if (header) {
                W.getFrameRoot().insertBefore(header, frame.nextSibling);
            }
            break;
        }
    }
677187
function createHeader (type, size) {
  var header = new Buffer(8);
  header.writeUInt8(type, 0);
  header.writeUInt32BE(size, 4);
  return header;
}
195971
def copy_headers(self, source_databox):
        
        for k in source_databox.hkeys: self.insert_header(k, source_databox.h(k))

        return self
511644
function FrameHeader(values) {
  if (values) {
    if (values instanceof Buffer) {
      this.fromBuffer(values);
    }
    else {
      for (var prop in values) {
        this[prop] = values[prop];
      }
    }
  }
}
1281502
def _adjust_header(cls, type_, orig_header):
        
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        return new_header if cls._use_header(new_header) else orig_header
621067
def build_headermap(headers):
    
    # TODO: what happens if some headers are circularly dependent?
    headermap = {}
    for hfile in headers:
        headermap[hfile] = None
    for hfile in headers:
        assert (hfile.startswith("c/") or
                hfile.startswith("datatable/include/"))
        inc = find_includes(hfile)
        for f in inc:
            assert f != hfile, "File %s includes itself?" % f
            assert f.startswith("c/")
            if f not in headers:
                raise ValueError("Unknown header \"%s\" included from %s"
                                 % (f, hfile))
        headermap[hfile] = set(inc)
    return headermap