Package io.undertow.util

Examples of io.undertow.util.HeaderValues


                //put the extra bits into the new buffer
                target.put((byte) extraData);
            }
        }
        while (it != -1) {
            HeaderValues values = headers.fiCurrent(it);
            boolean skip = false;
            if (firstPass) {
                if (values.getHeaderName().byteAt(0) != ':') {
                    skip = true;
                }
            } else {
                if (values.getHeaderName().byteAt(0) == ':') {
                    skip = true;
                }
            }
            if (!skip) {
                //initial super crappy implementation: just write everything out as literal header field never indexed
                //makes things much simpler
                for (int i = 0; i < values.size(); ++i) {

                    int required = 11 + values.getHeaderName().length(); //we use 11 to make sure we have enough room for the variable length itegers

                    StaticTableEntry[] staticTable = ENCODING_STATIC_TABLE.get(values.getHeaderName());

                    String val = values.get(i);
                    required += (1 + val.length());

                    if (target.remaining() < required) {
                        this.headersIterator = it;
                        this.currentBitPos = 0; //we don't use huffman yet
                        return State.UNDERFLOW;
                    }
                    if (staticTable == null) {
                        target.put((byte) 0);
                        target.put((byte) 0); //to use encodeInteger we need to place the first byte in the buffer.
                        encodeInteger(target, values.getHeaderName().length(), 7);
                        values.getHeaderName().appendTo(target);
                    } else {
                        boolean found = false;
                        for(StaticTableEntry st : staticTable) {
                            if(st.value != null && st.value.equals(val)) { //todo: some form of lookup?
                                target.put((byte) (1 << 7));
View Full Code Here


                SpdyProtocolUtils.putInt(inputBuffer, headers.size());

                long fiCookie = headers.fastIterateNonEmpty();
                while (fiCookie != -1) {
                    HeaderValues headerValues = headers.fiCurrent(fiCookie);
                    //TODO: for now it just fails if there are too many headers
                    SpdyProtocolUtils.putInt(inputBuffer, headerValues.getHeaderName().length());
                    for (int i = 0; i < headerValues.getHeaderName().length(); ++i) {
                        inputBuffer.put((byte) (Character.toLowerCase((char) headerValues.getHeaderName().byteAt(i))));
                    }
                    int pos = inputBuffer.position();
                    SpdyProtocolUtils.putInt(inputBuffer, 0); //size, back fill

                    int size = headerValues.size() - 1; //null between the characters

                    for (int i = 0; i < headerValues.size(); ++i) {
                        String val = headerValues.get(i);
                        size += val.length();
                        for (int j = 0; j < val.length(); ++j) {
                            inputBuffer.put((byte) val.charAt(j));
                        }
                        if (i != headerValues.size() - 1) {
                            inputBuffer.put((byte) 0);
                        }
                    }
                    SpdyProtocolUtils.putInt(inputBuffer, size, pos);
                    fiCookie = headers.fiNext(fiCookie);
View Full Code Here

                SpdyProtocolUtils.putInt(inputBuffer, headers.size());

                long fiCookie = headers.fastIterateNonEmpty();
                while (fiCookie != -1) {
                    HeaderValues headerValues = headers.fiCurrent(fiCookie);
                    //TODO: for now it just fails if there are too many headers
                    SpdyProtocolUtils.putInt(inputBuffer, headerValues.getHeaderName().length());
                    for (int i = 0; i < headerValues.getHeaderName().length(); ++i) {
                        inputBuffer.put((byte) (Character.toLowerCase((char) headerValues.getHeaderName().byteAt(i))));
                    }
                    int pos = inputBuffer.position();
                    SpdyProtocolUtils.putInt(inputBuffer, 0); //size, back fill

                    int size = headerValues.size() - 1; //null between the characters

                    for (int i = 0; i < headerValues.size(); ++i) {
                        String val = headerValues.get(i);
                        size += val.length();
                        for (int j = 0; j < val.length(); ++j) {
                            inputBuffer.put((byte) val.charAt(j));
                        }
                        if (i != headerValues.size() - 1) {
                            inputBuffer.put((byte) 0);
                        }
                    }
                    SpdyProtocolUtils.putInt(inputBuffer, size, pos);
                    fiCookie = headers.fiNext(fiCookie);
View Full Code Here

TOP

Related Classes of io.undertow.util.HeaderValues

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.