Exemple #1
0
        public int endRead(Buffer buf)
        {
            //
            // Check if we received the full HTTP response, if not, continue
            // reading otherwise we're done.
            //
            int end = new HttpParser().isCompleteMessage(buf.b, 0, buf.b.position());

            if (end < 0 && !buf.b.hasRemaining())
            {
                //
                // Read one more byte, we can't easily read bytes in advance
                // since the transport implenentation might be be able to read
                // the data from the memory instead of the socket.
                //
                buf.resize(buf.size() + 1, true);
                return(SocketOperation.Read);
            }
            return(SocketOperation.None);
        }
Exemple #2
0
 public void finish(Buffer readBuffer, Buffer writeBuffer)
 {
     HttpParser parser = new HttpParser();
     parser.parse(readBuffer.b, 0, readBuffer.b.position());
     if(parser.status() != 200)
     {
         throw new Ice.ConnectFailedException();
     }
 }
Exemple #3
0
 public int endRead(Buffer buf)
 {
     //
     // Check if we received the full HTTP response, if not, continue
     // reading otherwise we're done.
     //
     int end = new HttpParser().isCompleteMessage(buf.b, 0, buf.b.position());
     if(end < 0 && !buf.b.hasRemaining())
     {
         //
         // Read one more byte, we can't easily read bytes in advance
         // since the transport implenentation might be be able to read
         // the data from the memory instead of the socket.
         //
         buf.resize(buf.size() + 1, true);
         return SocketOperation.Read;
     }
     return SocketOperation.None;
 }
Exemple #4
0
 private void init(ProtocolInstance instance, Transceiver del)
 {
     _instance = instance;
     _delegate = del;
     _state = StateInitializeDelegate;
     _parser = new HttpParser();
     _readState = ReadStateOpcode;
     _readBuffer = new Buffer(ByteBuffer.ByteOrder.BIG_ENDIAN); // Network byte order
     _readBufferSize = 1024;
     _readLastFrame = true;
     _readOpCode = 0;
     _readHeaderLength = 0;
     _readPayloadLength = 0;
     _writeState = WriteStateHeader;
     _writeBuffer = new Buffer(ByteBuffer.ByteOrder.BIG_ENDIAN); // Network byte order
     _writeBufferSize = 1024;
     _readPending = false;
     _finishRead = false;
     _writePending = false;
     _readMask = new byte[4];
     _writeMask = new byte[4];
     _key = "";
     _pingPayload = new byte[0];
     _rand = new Random();
 }