Java Code Examples for okhttp3.internal.Util#equal()
The following examples show how to use
okhttp3.internal.Util#equal() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Handshake.java From styT with Apache License 2.0 | 5 votes |
@Override public boolean equals(Object other) { if (!(other instanceof Handshake)) return false; Handshake that = (Handshake) other; return Util.equal(cipherSuite, that.cipherSuite) && cipherSuite.equals(that.cipherSuite) && peerCertificates.equals(that.peerCertificates) && localCertificates.equals(that.localCertificates); }
Example 2
Source File: Handshake.java From AndroidProjects with MIT License | 5 votes |
@Override public boolean equals(Object other) { if (!(other instanceof Handshake)) return false; Handshake that = (Handshake) other; return Util.equal(cipherSuite, that.cipherSuite) && cipherSuite.equals(that.cipherSuite) && peerCertificates.equals(that.peerCertificates) && localCertificates.equals(that.localCertificates); }
Example 3
Source File: WebSocketRecorder.java From java-sdk with Apache License 2.0 | 5 votes |
/** * Equals. * * @param other the other * @return true, if successful */ @Override public boolean equals(Object other) { return other instanceof Message && Util.equal(((Message) other).bytes, bytes) && Util.equal(((Message) other).string, string); }
Example 4
Source File: Challenge.java From styT with Apache License 2.0 | 4 votes |
@Override public boolean equals(Object o) { return o instanceof Challenge && Util.equal(scheme, ((Challenge) o).scheme) && Util.equal(realm, ((Challenge) o).realm); }
Example 5
Source File: Hpack.java From styT with Apache License 2.0 | 4 votes |
/** This does not use "never indexed" semantics for sensitive headers. */ // http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-12#section-6.2.3 void writeHeaders(List<Header> headerBlock) throws IOException { if (emitDynamicTableSizeUpdate) { if (smallestHeaderTableSizeSetting < maxDynamicTableByteCount) { // Multiple dynamic table size updates! writeInt(smallestHeaderTableSizeSetting, PREFIX_5_BITS, 0x20); } emitDynamicTableSizeUpdate = false; smallestHeaderTableSizeSetting = Integer.MAX_VALUE; writeInt(maxDynamicTableByteCount, PREFIX_5_BITS, 0x20); } for (int i = 0, size = headerBlock.size(); i < size; i++) { Header header = headerBlock.get(i); ByteString name = header.name.toAsciiLowercase(); ByteString value = header.value; int headerIndex = -1; int headerNameIndex = -1; Integer staticIndex = NAME_TO_FIRST_INDEX.get(name); if (staticIndex != null) { headerNameIndex = staticIndex + 1; if (headerNameIndex > 1 && headerNameIndex < 8) { // Only search a subset of the static header table. Most entries have an empty value, so // it's unnecessary to waste cycles looking at them. This check is built on the // observation that the header entries we care about are in adjacent pairs, and we // always know the first index of the pair. if (Util.equal(STATIC_HEADER_TABLE[headerNameIndex - 1].value, value)) { headerIndex = headerNameIndex; } else if (Util.equal(STATIC_HEADER_TABLE[headerNameIndex].value, value)) { headerIndex = headerNameIndex + 1; } } } if (headerIndex == -1) { for (int j = nextHeaderIndex + 1, length = dynamicTable.length; j < length; j++) { if (Util.equal(dynamicTable[j].name, name)) { if (Util.equal(dynamicTable[j].value, value)) { headerIndex = j - nextHeaderIndex + STATIC_HEADER_TABLE.length; break; } else if (headerNameIndex == -1) { headerNameIndex = j - nextHeaderIndex + STATIC_HEADER_TABLE.length; } } } } if (headerIndex != -1) { // Indexed Header Field. writeInt(headerIndex, PREFIX_7_BITS, 0x80); } else if (headerNameIndex == -1) { // Literal Header Field with Incremental Indexing - New Name. out.writeByte(0x40); writeByteString(name); writeByteString(value); insertIntoDynamicTable(header); } else if (name.startsWith(Header.PSEUDO_PREFIX) && !Header.TARGET_AUTHORITY.equals(name)) { // Follow Chromes lead - only include the :authority pseudo header, but exclude all other // pseudo headers. Literal Header Field without Indexing - Indexed Name. writeInt(headerNameIndex, PREFIX_4_BITS, 0); writeByteString(value); } else { // Literal Header Field with Incremental Indexing - Indexed Name. writeInt(headerNameIndex, PREFIX_6_BITS, 0x40); writeByteString(value); insertIntoDynamicTable(header); } } }
Example 6
Source File: Challenge.java From AndroidProjects with MIT License | 4 votes |
@Override public boolean equals(Object o) { return o instanceof Challenge && Util.equal(scheme, ((Challenge) o).scheme) && Util.equal(realm, ((Challenge) o).realm); }
Example 7
Source File: Hpack.java From AndroidProjects with MIT License | 4 votes |
/** This does not use "never indexed" semantics for sensitive headers. */ // http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-12#section-6.2.3 void writeHeaders(List<Header> headerBlock) throws IOException { if (emitDynamicTableSizeUpdate) { if (smallestHeaderTableSizeSetting < maxDynamicTableByteCount) { // Multiple dynamic table size updates! writeInt(smallestHeaderTableSizeSetting, PREFIX_5_BITS, 0x20); } emitDynamicTableSizeUpdate = false; smallestHeaderTableSizeSetting = Integer.MAX_VALUE; writeInt(maxDynamicTableByteCount, PREFIX_5_BITS, 0x20); } for (int i = 0, size = headerBlock.size(); i < size; i++) { Header header = headerBlock.get(i); ByteString name = header.name.toAsciiLowercase(); ByteString value = header.value; int headerIndex = -1; int headerNameIndex = -1; Integer staticIndex = NAME_TO_FIRST_INDEX.get(name); if (staticIndex != null) { headerNameIndex = staticIndex + 1; if (headerNameIndex > 1 && headerNameIndex < 8) { // Only search a subset of the static header table. Most entries have an empty value, so // it's unnecessary to waste cycles looking at them. This check is built on the // observation that the header entries we care about are in adjacent pairs, and we // always know the first index of the pair. if (Util.equal(STATIC_HEADER_TABLE[headerNameIndex - 1].value, value)) { headerIndex = headerNameIndex; } else if (Util.equal(STATIC_HEADER_TABLE[headerNameIndex].value, value)) { headerIndex = headerNameIndex + 1; } } } if (headerIndex == -1) { for (int j = nextHeaderIndex + 1, length = dynamicTable.length; j < length; j++) { if (Util.equal(dynamicTable[j].name, name)) { if (Util.equal(dynamicTable[j].value, value)) { headerIndex = j - nextHeaderIndex + STATIC_HEADER_TABLE.length; break; } else if (headerNameIndex == -1) { headerNameIndex = j - nextHeaderIndex + STATIC_HEADER_TABLE.length; } } } } if (headerIndex != -1) { // Indexed Header Field. writeInt(headerIndex, PREFIX_7_BITS, 0x80); } else if (headerNameIndex == -1) { // Literal Header Field with Incremental Indexing - New Name. out.writeByte(0x40); writeByteString(name); writeByteString(value); insertIntoDynamicTable(header); } else if (name.startsWith(Header.PSEUDO_PREFIX) && !Header.TARGET_AUTHORITY.equals(name)) { // Follow Chromes lead - only include the :authority pseudo header, but exclude all other // pseudo headers. Literal Header Field without Indexing - Indexed Name. writeInt(headerNameIndex, PREFIX_4_BITS, 0); writeByteString(value); } else { // Literal Header Field with Incremental Indexing - Indexed Name. writeInt(headerNameIndex, PREFIX_6_BITS, 0x40); writeByteString(value); insertIntoDynamicTable(header); } } }