private boolean consumeTralingHeaders(HTTPClientConnection cc) { long headerToken; boolean foundEnd = false; do { headerToken = TrieParserReader.parseNext(trieReader, cc.headerParser()); if (headerToken==HTTPSpecification.END_OF_HEADER_ID) { foundEnd = true; break;//MUST break here or we will read the headers of the folllowing message!! } } while (-1!=headerToken); return foundEnd; }
if (((null==cc) || (!cc.isValid()) || cc.isClientClosedNotificationSent())) { assert(ok) : "Internal error"; targetPipe = (int)cc.getResponsePipeIdx()>=0? output[i] : null; final int routeId = (int)cc.getResponsePipeIdx(); if (routeId>=0) { targetPipe = output[i];
return new HTTPClientConnection(engine, hostId, port, sessionId, requestPipeIdx, responsePipeIdx, connectionId, recordTypeData, timeoutNS, structureId,
private void processFoundRevision(int i, final int stateIdx, Pipe<NetResponseSchema> targetPipe, long ccId, HTTPClientConnection cc, int startingLength1) { clearConnectionStateData(i); //because we have started written the response we MUST do extra cleanup later. Pipe.addMsgIdx(targetPipe, NetResponseSchema.MSG_RESPONSE_101); Pipe.addLongValue(ccId, targetPipe); // NetResponseSchema.MSG_RESPONSE_101_FIELD_CONNECTIONID_1, ccId); Pipe.addIntValue(cc.sessionId, targetPipe); Pipe.addIntValue(ServerCoordinator.BEGIN_RESPONSE_MASK, targetPipe);//flags, init to zero, will set later if required positionMemoData[stateIdx]++;//state change is key DataOutputBlobWriter<NetResponseSchema> openOutputStream = Pipe.openOutputStream(targetPipe); DataOutputBlobWriter.tryClearIntBackData(openOutputStream, cc.totalSizeOfIndexes()); //NOTE: this is always first and not indexed... TrieParserReader.writeCapturedShort(trieReader, 0, openOutputStream); //status code runningHeaderBytes[i] = startingLength1 - trieReader.sourceLen; }
HTTPHeader header = cc.associatedFieldObject(headerToken);
DataOutputBlobWriter.commitBackData(writer2, cc.getStructureId()); DataOutputBlobWriter.commitBackData(writer2, cc.getStructureId()); DataOutputBlobWriter.commitBackData(writer3, cc.getStructureId()); DataOutputBlobWriter.commitBackData(writer3, cc.getStructureId());
private long processHeaderLogic(int i, final int memoIdx, final int stateIdx, Pipe<NetPayloadSchema> localInputPipe, HTTPClientConnection cc, DataOutputBlobWriter<NetResponseSchema> writer) { long headerToken; int startingLength = TrieParserReader.savePositionMemo(trieReader, positionMemoData, memoIdx); //TODO = save position is wrong if we continue??? headerToken = TrieParserReader.parseNext(trieReader, cc.headerParser()); assert(headerToken==-1 || headerToken>=(Integer.MAX_VALUE-2)) : "bad token "+headerToken; int consumed = startingLength - trieReader.sourceLen; runningHeaderBytes[i] += consumed; if (headerToken != -1) { if (HTTPSpecification.END_OF_HEADER_ID != headerToken) { headerProcessing(i, writer, headerToken, cc); //do not change state we want to come back here. } else { endOfHeaderProcessing(i, memoIdx, stateIdx, localInputPipe, writer); } } return headerToken; }