if (!has_server&&_status>100&&getSendServerVersion()) { num_fields++; addString("Server"); addString(SERVER); }
_state = STATE_CONTENT;
    public void completeHeader(HttpFields fields, boolean allContentAdded) throws IOException    {        if (_state!=STATE_HEADER)            return;        if (_last&&!allContentAdded)            throw new IllegalStateException("last?");        _last=_last|allContentAdded;        boolean has_server=false;        if (_version==HttpVersions.HTTP_1_0_ORDINAL)            _close=true;        // get a header buffer        if (_header==null)            _header=_buffers.getBuffer(_headerBufferSize);        Buffer tmpbuf=_buffer;        _buffer=_header;        try        {            // start the header            _buffer.put((byte)'A');            _buffer.put((byte)'B');            addInt(0);            _buffer.put((byte)0x4);            addInt(_status);            if (_reason==null)                _reason=getReasonBuffer(_status);            if (_reason==null)                _reason=new ByteArrayBuffer(TypeUtil.toString(_status));            addBuffer(_reason);            if (_status==100||_status==204||_status==304)            {                _noContent=true;                _content=null;            }            // allocate 2 bytes for number of headers            int field_index=_buffer.putIndex();            addInt(0);            // Add headers            Iterator i=fields.getFields();            int num_fields=0;            while (i.hasNext())            {                num_fields++;                Field f=(Field)i.next();                byte[] codes=(byte[])__headerHash.get(f.getName());                if (codes!=null)                {                    _buffer.put(codes);                }                else                {                    addString(f.getName());                }                addString(f.getValue());            }            if (!has_server&&_status>100&&getSendServerVersion())            {                num_fields++;                addString("Server");                addString(SERVER);            }            // TODO Add content length if last content known.            // insert the number of headers            int tmp=_buffer.putIndex();            _buffer.setPutIndex(field_index);            addInt(num_fields);            _buffer.setPutIndex(tmp);            // get the payload size ( - 4 bytes for the ajp header)            // excluding the            // ajp header            int payloadSize=_buffer.length()-4;            // insert the total packet size on 2nd and 3rd byte that            // was previously            // allocated            addInt(2,payloadSize);        }        finally        {            _buffer=tmpbuf;        }        _state=STATE_CONTENT;    }