private void validateFirstByteOfHeader(final int i, final int posIdx, final int lenIdx, final int memoIdx, final int stateIdx, Pipe<NetPayloadSchema> localInputPipe, HTTPClientConnection cc, int len) { //we may hit zero in the middle of a payload so this check //is only valid for the 0 state. if (len>0 && positionMemoData[stateIdx]==0) { //we have new data plus we know that we have no old data //because of this we know the first letter must be an H for HTTP. boolean isValid = localInputPipe.blobRing[localInputPipe.blobMask&trieReader.sourcePos]=='H'; if (!isValid) { logger.warn("invalid HTTP request from server should start with H"); if (null!=cc) { try { closeConnectionAndAbandonOldData(posIdx, lenIdx, stateIdx, cc, i); } catch (Throwable e) { //ignore this is not the source of the problem } } } } }
closeConnectionAndAbandonOldData(posIdx, lenIdx, stateIdx, cc, i); continue; closeConnectionAndAbandonOldData(posIdx, lenIdx, stateIdx, cc, i); targetPipe = output[i]; } else { closeConnectionAndAbandonOldData(posIdx, lenIdx, stateIdx, cc, i); continue; //was closed so we can not do anything with this connection
} else { reportCorruptStream("HTTP revision", cc); closeConnectionAndAbandonOldData(posIdx, lenIdx, stateIdx, cc, i);