1
0
mirror of https://github.com/square/okhttp.git synced 2025-07-31 05:04:26 +03:00

Upgrade Okio and some build dependencies

The new ktlint sorts imports which makes this diff large.

The new japicmp ignores 'final' modifier changes in final classes.

We adopt the Google style for checkstyle.xml.

Okio readByteString() now uses segments more aggressively, so we
need to mitigate that to avoid tracking those segments in a test.
This commit is contained in:
Jesse Wilson
2020-01-11 22:24:12 -05:00
parent 93efc26a15
commit c1d50e371f
146 changed files with 874 additions and 1095 deletions

View File

@ -2,24 +2,24 @@ import net.ltgt.gradle.errorprone.CheckSeverity
buildscript {
ext.versions = [
'animalSniffer': '1.17',
'assertj': '3.11.0',
'animalSniffer': '1.18',
'assertj': '3.14.0',
'bouncycastle': '1.64',
'brotli': '0.1.2',
'checkstyle': '8.15',
'checkstyle': '8.28',
'conscrypt': '2.2.1',
'corretto': '1.1.1',
'corretto': '1.2.0',
'findbugs': '3.0.2',
'guava': '27.0.1-jre',
'guava': '28.2-jre',
'java': '1.8',
'jnrUnixsocket': '0.22',
'jsoup': '1.11.3',
'junit': '4.12',
'jnrUnixsocket': '0.25',
'jsoup': '1.12.1',
'junit': '4.13',
'kotlin': '1.3.61',
'moshi': '1.9.2',
'okio': '2.4.1',
'ktlint': '0.31.0',
'picocli': '4.0.1',
'okio': '2.4.3',
'ktlint': '0.36.0',
'picocli': '4.1.4',
'openjsse': '1.1.0'
]
@ -50,8 +50,8 @@ buildscript {
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.8.0'
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:1.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.18"
classpath 'com.diffplug.spotless:spotless-plugin-gradle:3.26.1'
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.10.0"
classpath 'com.diffplug.spotless:spotless-plugin-gradle:3.27.0'
classpath 'com.android.tools.build:gradle:3.4.2'
}
@ -64,8 +64,8 @@ buildscript {
plugins {
id 'ru.vyarus.animalsniffer' version '1.5.0'
id 'com.github.johnrengelman.shadow' version '4.0.1'
id 'me.champeau.gradle.japicmp' version '0.2.6'
id 'com.github.johnrengelman.shadow' version '5.2.0'
id 'me.champeau.gradle.japicmp' version '0.2.9'
}
allprojects {
@ -176,7 +176,7 @@ subprojects { project ->
dependencies {
errorproneJavac 'com.google.errorprone:javac:9+181-r4173-1'
errorprone 'com.google.errorprone:error_prone_core:2.3.3'
errorprone 'com.google.errorprone:error_prone_core:2.3.4'
}
tasks.withType(JavaCompile).configureEach {
sourceCompatibility = JavaVersion.VERSION_1_8
@ -193,10 +193,11 @@ subprojects { project ->
// plugin overwrites our dokka configuration on projects where it's applied.
afterEvaluate { p ->
p.tasks.dokka {
configuration {
reportUndocumented = false
skipDeprecated = true
jdkVersion = 8
packageOptions {
perPackageOption {
prefix = "okhttp3.internal"
suppress = true
}
@ -210,6 +211,7 @@ subprojects { project ->
}
}
}
}
tasks.wrapper {
distributionType = Wrapper.DistributionType.ALL
@ -234,6 +236,7 @@ def alpnBootVersion() {
}
def alpnBootVersionForPatchVersion(String javaVersion, int patchVersion) {
// https://www.eclipse.org/jetty/documentation/current/alpn-chapter.html#alpn-versions
switch (patchVersion) {
case 0..24:
return '8.1.0.v20141016'

View File

@ -1,145 +1,321 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<!--
Checkstyle configuration that checks the Google coding conventions from Google Java Style
that can be found at https://google.github.io/styleguide/javaguide.html
Checkstyle is very configurable. Be sure to read the documentation at
http://checkstyle.org (or in your downloaded distribution).
To completely disable a check, just comment it out or delete it from the file.
To suppress certain violations please review suppression filters.
Authors: Max Vetrenko, Ruslan Diachenko, Roman Ivanov.
-->
<module name = "Checker">
<module name="SuppressWarningsFilter"/>
<module name="NewlineAtEndOfFile"/>
<module name="FileLength"/>
<module name="FileTabCharacter"/>
<property name="charset" value="UTF-8"/>
<!-- Trailing spaces -->
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="message" value="Line has trailing spaces."/>
<property name="severity" value="warning"/>
<property name="fileExtensions" value="java, properties, xml"/>
<!-- Excludes all 'module-info.java' files -->
<!-- See https://checkstyle.org/config_filefilters.html -->
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>
<!-- https://checkstyle.org/config_filters.html#SuppressionFilter -->
<module name="SuppressionFilter">
<property name="file" value="${org.checkstyle.google.suppressionfilter.config}"
default="checkstyle-suppressions.xml" />
<property name="optional" value="true"/>
</module>
<!-- Space after 'for' and 'if' -->
<module name="RegexpSingleline">
<property name="format" value="^\s*(for|if)\b[^ ]"/>
<property name="message" value="Space needed before opening parenthesis."/>
<!-- Checks for whitespace -->
<!-- See http://checkstyle.org/config_whitespace.html -->
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<!-- For each spacing -->
<module name="RegexpSingleline">
<property name="format" value="^\s*for \(.*?([^ ]:|:[^ ])"/>
<property name="message" value="Space needed around ':' character."/>
<module name="LineLength">
<property name="fileExtensions" value="java"/>
<property name="max" value="100"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<module name="TreeWalker">
<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
<!--module name="JavadocMethod"/-->
<!--module name="JavadocType"/-->
<!--module name="JavadocVariable"/-->
<module name="JavadocStyle"/>
<!-- Checks for Naming Conventions. -->
<!-- See http://checkstyle.sf.net/config_naming.html -->
<!--<module name="ConstantName"/>-->
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<!--<module name="PackageName"/>-->
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<!-- Checks for imports -->
<!-- See http://checkstyle.sf.net/config_import.html -->
<module name="OuterTypeFilename"/>
<module name="IllegalTokenText">
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
<property name="format"
value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
<property name="message"
value="Consider using special escape sequence instead of octal value or Unicode escaped value."/>
</module>
<module name="AvoidEscapedUnicodeCharacters">
<property name="allowEscapesForControlCharacters" value="true"/>
<property name="allowByTailComment" value="true"/>
<property name="allowNonPrintableEscapes" value="true"/>
</module>
<module name="AvoidStarImport"/>
<module name="IllegalImport"/>
<!-- defaults to sun.* packages -->
<module name="RedundantImport"/>
<module name="UnusedImports">
<property name="processJavadoc" value="true"/>
<module name="OneTopLevelClass"/>
<module name="NoLineWrap">
<property name="tokens" value="PACKAGE_DEF, IMPORT, STATIC_IMPORT"/>
</module>
<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
<module name="LineLength">
<property name="max" value="100"/>
</module>
<module name="MethodLength">
<property name="max" value="200"/>
</module>
<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="GenericWhitespace"/>
<!--<module name="EmptyForIteratorPad"/>-->
<module name="MethodParamPad"/>
<!--<module name="NoWhitespaceAfter"/>-->
<!--<module name="NoWhitespaceBefore"/>-->
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround">
<module name="EmptyBlock">
<property name="option" value="TEXT"/>
<property name="tokens"
value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN,
COLON, DIV, DIV_ASSIGN, DO_WHILE, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_CATCH,
LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN,
LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS,
MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, SL, SLIST,
SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND"/>
value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
</module>
<!-- Modifier Checks -->
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>
<!-- Checks for blocks. You know, those {}'s -->
<!-- See http://checkstyle.sf.net/config_blocks.html -->
<module name="AvoidNestedBlocks"/>
<!--module name="EmptyBlock"/-->
<module name="LeftCurly"/>
<!--<module name="NeedBraces"/>-->
<module name="RightCurly"/>
<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
<!--module name="AvoidInlineConditionals"/-->
<module name="CovariantEquals"/>
<module name="EmptyStatement"/>
<!--<module name="EqualsAvoidNull"/>-->
<module name="EqualsHashCode"/>
<!--module name="HiddenField"/-->
<module name="IllegalInstantiation"/>
<!--module name="InnerAssignment"/-->
<!--module name="MagicNumber"/-->
<!--module name="MissingSwitchDefault"/-->
<!--<module name="RedundantThrows"/>-->
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<!-- Checks for class design -->
<!-- See http://checkstyle.sf.net/config_design.html -->
<!--module name="DesignForExtension"/-->
<!--<module name="FinalClass"/>-->
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
<!--module name="VisibilityModifier"/-->
<!-- Miscellaneous other checks. -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
<module name="NeedBraces">
<property name="tokens"
value="LITERAL_DO, LITERAL_ELSE, LITERAL_FOR, LITERAL_IF, LITERAL_WHILE"/>
</module>
<module name="LeftCurly">
<property name="tokens"
value="ANNOTATION_DEF, CLASS_DEF, CTOR_DEF, ENUM_CONSTANT_DEF, ENUM_DEF,
INTERFACE_DEF, LAMBDA, LITERAL_CASE, LITERAL_CATCH, LITERAL_DEFAULT,
LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF,
LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF,
OBJBLOCK, STATIC_INIT"/>
</module>
<module name="RightCurly">
<property name="id" value="RightCurlySame"/>
<property name="tokens"
value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE,
LITERAL_DO"/>
</module>
<module name="RightCurly">
<property name="id" value="RightCurlyAlone"/>
<property name="option" value="alone"/>
<property name="tokens"
value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT,
INSTANCE_INIT, ANNOTATION_DEF"/>
</module>
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyLambdas" value="true"/>
<property name="allowEmptyMethods" value="true"/>
<property name="allowEmptyTypes" value="true"/>
<property name="allowEmptyLoops" value="true"/>
<property name="tokens"
value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR,
BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, DO_WHILE, EQUAL, GE, GT, LAMBDA, LAND,
LCURLY, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY,
LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH, LITERAL_SYNCHRONIZED,
LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN,
NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR,
SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND"/>
<message key="ws.notFollowed"
value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/>
<message key="ws.notPreceded"
value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
</module>
<module name="OneStatementPerLine"/>
<module name="MultipleVariableDeclarations"/>
<module name="ArrayTypeStyle"/>
<!--module name="FinalParameters"/-->
<!--module name="TodoComment"/-->
<module name="MissingSwitchDefault"/>
<module name="FallThrough"/>
<module name="UpperEll"/>
<!-- Make the @SuppressWarnings annotations available to Checkstyle -->
<module name="SuppressWarningsHolder"/>
<module name="ModifierOrder"/>
<module name="EmptyLineSeparator">
<property name="tokens"
value="PACKAGE_DEF, IMPORT, STATIC_IMPORT, CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
STATIC_INIT, INSTANCE_INIT, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
<property name="allowNoEmptyLineBetweenFields" value="true"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapDot"/>
<property name="tokens" value="DOT"/>
<property name="option" value="nl"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapComma"/>
<property name="tokens" value="COMMA"/>
<property name="option" value="EOL"/>
</module>
<module name="SeparatorWrap">
<!-- ELLIPSIS is EOL until https://github.com/google/styleguide/issues/258 -->
<property name="id" value="SeparatorWrapEllipsis"/>
<property name="tokens" value="ELLIPSIS"/>
<property name="option" value="EOL"/>
</module>
<module name="SeparatorWrap">
<!-- ARRAY_DECLARATOR is EOL until https://github.com/google/styleguide/issues/259 -->
<property name="id" value="SeparatorWrapArrayDeclarator"/>
<property name="tokens" value="ARRAY_DECLARATOR"/>
<property name="option" value="EOL"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapMethodRef"/>
<property name="tokens" value="METHOD_REF"/>
<property name="option" value="nl"/>
</module>
<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
<message key="name.invalidPattern"
value="Package name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="TypeName">
<property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, ANNOTATION_DEF"/>
<message key="name.invalidPattern"
value="Type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MemberName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
<message key="name.invalidPattern"
value="Member name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="LambdaParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Lambda parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="CatchParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Catch parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="LocalVariableName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Local variable name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ClassTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Class type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MethodTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Method type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="InterfaceTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Interface type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="NoFinalizer"/>
<module name="GenericWhitespace">
<message key="ws.followed"
value="GenericWhitespace ''{0}'' is followed by whitespace."/>
<message key="ws.preceded"
value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
<message key="ws.illegalFollow"
value="GenericWhitespace ''{0}'' should followed by whitespace."/>
<message key="ws.notPreceded"
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
</module>
<module name="Indentation">
<property name="basicOffset" value="2"/>
<property name="braceAdjustment" value="0"/>
<property name="caseIndent" value="2"/>
<property name="throwsIndent" value="4"/>
<property name="lineWrappingIndentation" value="4"/>
<property name="arrayInitIndent" value="2"/>
</module>
<module name="AbbreviationAsWordInName">
<property name="ignoreFinal" value="false"/>
<property name="allowedAbbreviationLength" value="1"/>
<property name="tokens"
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, ANNOTATION_DEF, ANNOTATION_FIELD_DEF,
PARAMETER_DEF, VARIABLE_DEF, METHOD_DEF"/>
</module>
<module name="OverloadMethodsDeclarationOrder"/>
<module name="VariableDeclarationUsageDistance"/>
<module name="CustomImportOrder">
<property name="sortImportsInGroupAlphabetically" value="true"/>
<property name="separateLineBetweenGroups" value="true"/>
<property name="customImportOrderRules" value="STATIC###THIRD_PARTY_PACKAGE"/>
<property name="tokens" value="IMPORT, STATIC_IMPORT, PACKAGE_DEF"/>
</module>
<module name="MethodParamPad">
<property name="tokens"
value="CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF,
SUPER_CTOR_CALL, ENUM_CONSTANT_DEF"/>
</module>
<module name="NoWhitespaceBefore">
<property name="tokens"
value="COMMA, SEMI, POST_INC, POST_DEC, DOT, ELLIPSIS, METHOD_REF"/>
<property name="allowLineBreaks" value="true"/>
</module>
<module name="ParenPad">
<property name="tokens"
value="ANNOTATION, ANNOTATION_FIELD_DEF, CTOR_CALL, CTOR_DEF, DOT, ENUM_CONSTANT_DEF,
EXPR, LITERAL_CATCH, LITERAL_DO, LITERAL_FOR, LITERAL_IF, LITERAL_NEW,
LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_WHILE, METHOD_CALL,
METHOD_DEF, QUESTION, RESOURCE_SPECIFICATION, SUPER_CTOR_CALL, LAMBDA"/>
</module>
<module name="OperatorWrap">
<property name="option" value="NL"/>
<property name="tokens"
value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR,
LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR, METHOD_REF "/>
</module>
<module name="AnnotationLocation">
<property name="id" value="AnnotationLocationMostCases"/>
<property name="tokens"
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
</module>
<module name="AnnotationLocation">
<property name="id" value="AnnotationLocationVariables"/>
<property name="tokens" value="VARIABLE_DEF"/>
<property name="allowSamelineMultipleAnnotations" value="true"/>
</module>
<module name="NonEmptyAtclauseDescription"/>
<module name="InvalidJavadocPosition"/>
<module name="JavadocTagContinuationIndentation"/>
<module name="SummaryJavadoc">
<property name="forbiddenSummaryFragments"
value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
</module>
<module name="JavadocParagraph"/>
<module name="AtclauseOrder">
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
<property name="target"
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
</module>
<module name="JavadocMethod">
<property name="scope" value="public"/>
<property name="allowMissingParamTags" value="true"/>
<property name="allowMissingReturnTag" value="true"/>
<property name="allowedAnnotations" value="Override, Test"/>
<property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF"/>
</module>
<module name="MissingJavadocMethod">
<property name="scope" value="public"/>
<property name="minLineCount" value="2"/>
<property name="allowedAnnotations" value="Override, Test"/>
<property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF"/>
</module>
<module name="MethodName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
<message key="name.invalidPattern"
value="Method name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="SingleLineJavadoc">
<property name="ignoreInlineTags" value="false"/>
</module>
<module name="EmptyCatchBlock">
<property name="exceptionVariableName" value="expected"/>
</module>
<module name="CommentsIndentation">
<property name="tokens" value="SINGLE_LINE_COMMENT, BLOCK_COMMENT_BEGIN"/>
</module>
<!-- https://checkstyle.org/config_filters.html#SuppressionXpathFilter -->
<module name="SuppressionXpathFilter">
<property name="file" value="${org.checkstyle.google.suppressionxpathfilter.config}"
default="checkstyle-xpath-suppressions.xml" />
<property name="optional" value="true"/>
</module>
</module>
</module>

View File

@ -33,87 +33,7 @@ task japicmp(type: me.champeau.gradle.japicmp.JapicmpTask, dependsOn: 'jar') {
includeSynthetic = true
packageExcludes = [
'okhttp3.mockwebserver.internal',
]
methodExcludes = [
// Became 'final' in 4.0.0:
'okhttp3.mockwebserver.RecordedRequest#getChunkSizes()',
'okhttp3.mockwebserver.RecordedRequest#getHandshake()',
'okhttp3.mockwebserver.RecordedRequest#getHeader(java.lang.String)',
'okhttp3.mockwebserver.RecordedRequest#getHeaders()',
'okhttp3.mockwebserver.RecordedRequest#getMethod()',
'okhttp3.mockwebserver.RecordedRequest#getPath()',
'okhttp3.mockwebserver.RecordedRequest#getRequestLine()',
'okhttp3.mockwebserver.RecordedRequest#getRequestUrl()',
'okhttp3.mockwebserver.RecordedRequest#getSequenceNumber()',
'okhttp3.mockwebserver.RecordedRequest#getTlsVersion()',
'okhttp3.mockwebserver.RecordedRequest#getUtf8Body()',
'okhttp3.mockwebserver.RecordedRequest#getBody()',
'okhttp3.mockwebserver.RecordedRequest#getBodySize()',
'okhttp3.mockwebserver.PushPromise#headers()',
'okhttp3.mockwebserver.PushPromise#method()',
'okhttp3.mockwebserver.PushPromise#path()',
'okhttp3.mockwebserver.PushPromise#response()',
'okhttp3.mockwebserver.MockResponse#addHeader(java.lang.String)',
'okhttp3.mockwebserver.MockResponse#addHeader(java.lang.String, java.lang.Object)',
'okhttp3.mockwebserver.MockResponse#addHeaderLenient(java.lang.String, java.lang.Object)',
'okhttp3.mockwebserver.MockResponse#clearHeaders()',
'okhttp3.mockwebserver.MockResponse#getBody()',
'okhttp3.mockwebserver.MockResponse#getBodyDelay(java.util.concurrent.TimeUnit)',
'okhttp3.mockwebserver.MockResponse#getDuplexResponseBody()',
'okhttp3.mockwebserver.MockResponse#getHeadersDelay(java.util.concurrent.TimeUnit)',
'okhttp3.mockwebserver.MockResponse#getHttp2ErrorCode()',
'okhttp3.mockwebserver.MockResponse#getPushPromises()',
'okhttp3.mockwebserver.MockResponse#getSettings()',
'okhttp3.mockwebserver.MockResponse#getSocketPolicy()',
'okhttp3.mockwebserver.MockResponse#getStatus()',
'okhttp3.mockwebserver.MockResponse#getThrottleBytesPerPeriod()',
'okhttp3.mockwebserver.MockResponse#getThrottlePeriod(java.util.concurrent.TimeUnit)',
'okhttp3.mockwebserver.MockResponse#getTrailers()',
'okhttp3.mockwebserver.MockResponse#getWebSocketListener()',
'okhttp3.mockwebserver.MockResponse#removeHeader(java.lang.String)',
'okhttp3.mockwebserver.MockResponse#setBody(okio.Buffer)',
'okhttp3.mockwebserver.MockResponse#setBody(java.lang.String)',
'okhttp3.mockwebserver.MockResponse#setBodyDelay(long, java.util.concurrent.TimeUnit)',
'okhttp3.mockwebserver.MockResponse#setChunkedBody(okio.Buffer, int)',
'okhttp3.mockwebserver.MockResponse#setChunkedBody(java.lang.String, int)',
'okhttp3.mockwebserver.MockResponse#setHeader(java.lang.String, java.lang.Object)',
'okhttp3.mockwebserver.MockResponse#setHeaders(okhttp3.Headers)',
'okhttp3.mockwebserver.MockResponse#setHeadersDelay(long, java.util.concurrent.TimeUnit)',
'okhttp3.mockwebserver.MockResponse#setHttp2ErrorCode(int)',
'okhttp3.mockwebserver.MockResponse#setResponseCode(int)',
'okhttp3.mockwebserver.MockResponse#setSocketPolicy(okhttp3.mockwebserver.SocketPolicy)',
'okhttp3.mockwebserver.MockResponse#setTrailers(okhttp3.Headers)',
'okhttp3.mockwebserver.MockResponse#throttleBody(long, long, java.util.concurrent.TimeUnit)',
'okhttp3.mockwebserver.MockResponse#withPush(okhttp3.mockwebserver.PushPromise)',
'okhttp3.mockwebserver.MockResponse#withSettings(okhttp3.internal.http2.Settings)',
'okhttp3.mockwebserver.MockResponse#withWebSocketUpgrade(okhttp3.WebSocketListener)',
'okhttp3.mockwebserver.MockResponse#getHeaders()',
'okhttp3.mockwebserver.MockResponse#setStatus(java.lang.String)',
'okhttp3.mockwebserver.MockResponse#isDuplex()',
'okhttp3.mockwebserver.MockResponse#setBody(okhttp3.mockwebserver.internal.duplex.DuplexResponseBody)',
'okhttp3.mockwebserver.MockWebServer#enqueue(okhttp3.mockwebserver.MockResponse)',
'okhttp3.mockwebserver.MockWebServer#getDispatcher()',
'okhttp3.mockwebserver.MockWebServer#getHostName()',
'okhttp3.mockwebserver.MockWebServer#getPort()',
'okhttp3.mockwebserver.MockWebServer#getRequestCount()',
'okhttp3.mockwebserver.MockWebServer#noClientAuth()',
'okhttp3.mockwebserver.MockWebServer#protocols()',
'okhttp3.mockwebserver.MockWebServer#requestClientAuth()',
'okhttp3.mockwebserver.MockWebServer#requireClientAuth()',
'okhttp3.mockwebserver.MockWebServer#setBodyLimit(long)',
'okhttp3.mockwebserver.MockWebServer#setDispatcher(okhttp3.mockwebserver.Dispatcher)',
'okhttp3.mockwebserver.MockWebServer#setProtocolNegotiationEnabled(boolean)',
'okhttp3.mockwebserver.MockWebServer#setProtocols(java.util.List)',
'okhttp3.mockwebserver.MockWebServer#setServerSocketFactory(javax.net.ServerSocketFactory)',
'okhttp3.mockwebserver.MockWebServer#shutdown()',
'okhttp3.mockwebserver.MockWebServer#start()',
'okhttp3.mockwebserver.MockWebServer#start(int)',
'okhttp3.mockwebserver.MockWebServer#start(java.net.InetAddress, int)',
'okhttp3.mockwebserver.MockWebServer#takeRequest()',
'okhttp3.mockwebserver.MockWebServer#takeRequest(long, java.util.concurrent.TimeUnit)',
'okhttp3.mockwebserver.MockWebServer#toProxyAddress()',
'okhttp3.mockwebserver.MockWebServer#url(java.lang.String)',
'okhttp3.mockwebserver.MockWebServer#useHttps(javax.net.ssl.SSLSocketFactory, boolean)',
'okhttp3.mockwebserver.internal.duplex',
]
}
check.dependsOn(japicmp)

View File

@ -15,13 +15,13 @@
*/
package okhttp3.mockwebserver
import java.util.concurrent.TimeUnit
import okhttp3.Headers
import okhttp3.WebSocketListener
import okhttp3.internal.addHeaderLenient
import okhttp3.internal.http2.Settings
import okhttp3.mockwebserver.internal.duplex.DuplexResponseBody
import okio.Buffer
import java.util.concurrent.TimeUnit
/** A scripted response to be replayed by the mock web server. */
class MockResponse : Cloneable {

View File

@ -17,6 +17,33 @@
package okhttp3.mockwebserver
import java.io.Closeable
import java.io.IOException
import java.net.InetAddress
import java.net.InetSocketAddress
import java.net.ProtocolException
import java.net.Proxy
import java.net.ServerSocket
import java.net.Socket
import java.net.SocketException
import java.security.SecureRandom
import java.security.cert.CertificateException
import java.security.cert.X509Certificate
import java.util.Collections
import java.util.Locale
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.CountDownLatch
import java.util.concurrent.LinkedBlockingQueue
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicInteger
import java.util.logging.Level
import java.util.logging.Logger
import javax.net.ServerSocketFactory
import javax.net.ssl.SSLContext
import javax.net.ssl.SSLSocket
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.TrustManager
import javax.net.ssl.X509TrustManager
import okhttp3.Headers
import okhttp3.Headers.Companion.headersOf
import okhttp3.HttpUrl
@ -64,33 +91,6 @@ import okio.buffer
import okio.sink
import okio.source
import org.junit.rules.ExternalResource
import java.io.Closeable
import java.io.IOException
import java.net.InetAddress
import java.net.InetSocketAddress
import java.net.ProtocolException
import java.net.Proxy
import java.net.ServerSocket
import java.net.Socket
import java.net.SocketException
import java.security.SecureRandom
import java.security.cert.CertificateException
import java.security.cert.X509Certificate
import java.util.Collections
import java.util.Locale
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.CountDownLatch
import java.util.concurrent.LinkedBlockingQueue
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicInteger
import java.util.logging.Level
import java.util.logging.Logger
import javax.net.ServerSocketFactory
import javax.net.ssl.SSLContext
import javax.net.ssl.SSLSocket
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.TrustManager
import javax.net.ssl.X509TrustManager
/**
* A scriptable web server. Callers supply canned responses and the server replays them upon request

View File

@ -16,6 +16,10 @@
package okhttp3.mockwebserver
import java.io.IOException
import java.net.Inet6Address
import java.net.Socket
import javax.net.ssl.SSLSocket
import okhttp3.Handshake
import okhttp3.Handshake.Companion.handshake
import okhttp3.Headers
@ -23,10 +27,6 @@ import okhttp3.HttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import okhttp3.TlsVersion
import okio.Buffer
import java.io.IOException
import java.net.Inet6Address
import java.net.Socket
import javax.net.ssl.SSLSocket
/** An HTTP request that came into the mock web server. */
class RecordedRequest @JvmOverloads constructor(

View File

@ -15,9 +15,9 @@
*/
package okhttp3.mockwebserver.internal.duplex
import java.io.IOException
import okhttp3.internal.http2.Http2Stream
import okhttp3.mockwebserver.RecordedRequest
import java.io.IOException
interface DuplexResponseBody {
@Throws(IOException::class)

View File

@ -15,6 +15,11 @@
*/
package okhttp3.mockwebserver.internal.duplex
import java.io.IOException
import java.util.concurrent.CountDownLatch
import java.util.concurrent.FutureTask
import java.util.concurrent.LinkedBlockingQueue
import java.util.concurrent.TimeUnit
import okhttp3.internal.http2.ErrorCode
import okhttp3.internal.http2.Http2Stream
import okhttp3.mockwebserver.RecordedRequest
@ -25,11 +30,6 @@ import okio.utf8Size
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Assert.fail
import java.io.IOException
import java.util.concurrent.CountDownLatch
import java.util.concurrent.FutureTask
import java.util.concurrent.LinkedBlockingQueue
import java.util.concurrent.TimeUnit
private typealias Action = (RecordedRequest, BufferedSource, BufferedSink, Http2Stream) -> Unit

View File

@ -15,6 +15,20 @@
*/
package okhttp3.curl
import java.io.IOException
import java.security.cert.X509Certificate
import java.util.Properties
import java.util.concurrent.TimeUnit.SECONDS
import java.util.logging.ConsoleHandler
import java.util.logging.Level
import java.util.logging.LogRecord
import java.util.logging.Logger
import java.util.logging.SimpleFormatter
import javax.net.ssl.HostnameVerifier
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.TrustManager
import javax.net.ssl.X509TrustManager
import kotlin.system.exitProcess
import okhttp3.MediaType
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.OkHttpClient
@ -34,20 +48,6 @@ import picocli.CommandLine.Command
import picocli.CommandLine.IVersionProvider
import picocli.CommandLine.Option
import picocli.CommandLine.Parameters
import java.io.IOException
import java.security.cert.X509Certificate
import java.util.Properties
import java.util.concurrent.TimeUnit.SECONDS
import java.util.logging.ConsoleHandler
import java.util.logging.Level
import java.util.logging.LogRecord
import java.util.logging.Logger
import java.util.logging.SimpleFormatter
import javax.net.ssl.HostnameVerifier
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.TrustManager
import javax.net.ssl.X509TrustManager
import kotlin.system.exitProcess
@Command(name = NAME, description = ["A curl for the next-generation web."],
mixinStandardHelpOptions = true, versionProvider = Main.VersionProvider::class)

View File

@ -15,6 +15,7 @@
*/
package okhttp3.brotli
import java.io.IOException
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.Protocol
import okhttp3.Request
@ -26,7 +27,6 @@ import okio.ByteString.Companion.encodeUtf8
import org.assertj.core.api.Assertions.assertThat
import org.junit.Assert.fail
import org.junit.Test
import java.io.IOException
class BrotliInterceptorTest {
@Test

View File

@ -15,9 +15,9 @@
*/
package okhttp3.dnsoverhttps
import okhttp3.Dns
import java.net.InetAddress
import java.net.UnknownHostException
import okhttp3.Dns
/**
* Internal Bootstrap DNS implementation for handling initial connection to DNS over HTTPS server.

View File

@ -15,6 +15,11 @@
*/
package okhttp3.dnsoverhttps
import java.io.IOException
import java.net.InetAddress
import java.net.UnknownHostException
import java.util.ArrayList
import java.util.concurrent.CountDownLatch
import okhttp3.CacheControl
import okhttp3.Call
import okhttp3.Callback
@ -29,11 +34,6 @@ import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.Response
import okhttp3.internal.platform.Platform
import okhttp3.internal.publicsuffix.PublicSuffixDatabase
import java.io.IOException
import java.net.InetAddress
import java.net.UnknownHostException
import java.util.ArrayList
import java.util.concurrent.CountDownLatch
/**
* [DNS over HTTPS implementation][doh_spec].

View File

@ -15,13 +15,13 @@
package okhttp3.dnsoverhttps
import okio.Buffer
import okio.ByteString
import okio.utf8Size
import java.io.EOFException
import java.net.InetAddress
import java.net.UnknownHostException
import java.nio.charset.StandardCharsets
import okio.Buffer
import okio.ByteString
import okio.utf8Size
/**
* Trivial Dns Encoder/Decoder, basically ripped from Netty full implementation.

View File

@ -34,11 +34,5 @@ task japicmp(type: me.champeau.gradle.japicmp.JapicmpTask, dependsOn: 'jar') {
txtOutputFile = file("$buildDir/reports/japi.txt")
ignoreMissingClasses = true
includeSynthetic = true
methodExcludes = [
// Became 'final' in 4.0.0:
'okhttp3.logging.HttpLoggingInterceptor#redactHeader(java.lang.String)',
'okhttp3.logging.HttpLoggingInterceptor#getLevel()',
'okhttp3.logging.HttpLoggingInterceptor#setLevel(okhttp3.logging.HttpLoggingInterceptor$Level)'
]
}
check.dependsOn(japicmp)

View File

@ -15,6 +15,11 @@
*/
package okhttp3.logging
import java.io.IOException
import java.nio.charset.Charset
import java.nio.charset.StandardCharsets.UTF_8
import java.util.TreeSet
import java.util.concurrent.TimeUnit
import okhttp3.Headers
import okhttp3.Interceptor
import okhttp3.OkHttpClient
@ -23,11 +28,6 @@ import okhttp3.internal.http.promisesBody
import okhttp3.internal.platform.Platform
import okio.Buffer
import okio.GzipSource
import java.io.IOException
import java.nio.charset.Charset
import java.nio.charset.StandardCharsets.UTF_8
import java.util.TreeSet
import java.util.concurrent.TimeUnit
/**
* An OkHttp interceptor which logs request and response information. Can be applied as an

View File

@ -15,6 +15,11 @@
*/
package okhttp3.logging
import java.io.IOException
import java.net.InetAddress
import java.net.InetSocketAddress
import java.net.Proxy
import java.util.concurrent.TimeUnit
import okhttp3.Call
import okhttp3.Connection
import okhttp3.EventListener
@ -24,11 +29,6 @@ import okhttp3.OkHttpClient
import okhttp3.Protocol
import okhttp3.Request
import okhttp3.Response
import java.io.IOException
import java.net.InetAddress
import java.net.InetSocketAddress
import java.net.Proxy
import java.util.concurrent.TimeUnit
/**
* An OkHttp EventListener, which logs call events. Can be applied as an

View File

@ -15,8 +15,8 @@
*/
package okhttp3.logging
import okio.Buffer
import java.io.EOFException
import okio.Buffer
/**
* Returns true if the body in question probably contains human readable text. Uses a small

View File

@ -15,6 +15,7 @@
*/
package okhttp3.internal.sse
import java.io.IOException
import okhttp3.Call
import okhttp3.Callback
import okhttp3.EventListener
@ -26,7 +27,6 @@ import okhttp3.internal.EMPTY_RESPONSE
import okhttp3.internal.connection.Exchange
import okhttp3.sse.EventSource
import okhttp3.sse.EventSourceListener
import java.io.IOException
class RealEventSource(
private val request: Request,

View File

@ -15,12 +15,12 @@
*/
package okhttp3.internal.sse
import java.io.IOException
import okhttp3.internal.toLongOrDefault
import okio.Buffer
import okio.BufferedSource
import okio.ByteString.Companion.encodeUtf8
import okio.Options
import java.io.IOException
class ServerSentEventReader(
private val source: BufferedSource,

View File

@ -15,15 +15,15 @@
*/
package okhttp3
import java.net.InetAddress
import java.util.concurrent.TimeUnit
import java.util.logging.Logger
import okhttp3.internal.concurrent.TaskRunner
import okhttp3.testing.Flaky
import org.assertj.core.api.Assertions.assertThat
import org.junit.rules.TestRule
import org.junit.runner.Description
import org.junit.runners.model.Statement
import java.net.InetAddress
import java.util.concurrent.TimeUnit
import java.util.logging.Logger
/**
* Apply this rule to all tests. It adds additional checks for leaked resources and uncaught

View File

@ -15,8 +15,6 @@
*/
package okhttp3
import okhttp3.internal.concurrent.TaskRunner
import okhttp3.internal.http2.Http2
import java.util.concurrent.CopyOnWriteArraySet
import java.util.logging.ConsoleHandler
import java.util.logging.Level
@ -24,6 +22,8 @@ import java.util.logging.LogRecord
import java.util.logging.Logger
import java.util.logging.SimpleFormatter
import kotlin.reflect.KClass
import okhttp3.internal.concurrent.TaskRunner
import okhttp3.internal.http2.Http2
object OkHttpDebugLogging {
// Keep references to loggers to prevent their configuration from being GC'd.

View File

@ -15,6 +15,13 @@
*/
package okhttp3
import java.io.IOException
import java.net.InetAddress
import java.net.InetSocketAddress
import java.net.Proxy
import java.util.Deque
import java.util.concurrent.ConcurrentLinkedDeque
import java.util.concurrent.TimeUnit
import okhttp3.CallEvent.CallEnd
import okhttp3.CallEvent.CallFailed
import okhttp3.CallEvent.CallStart
@ -42,13 +49,6 @@ import okhttp3.CallEvent.SecureConnectStart
import org.assertj.core.api.Assertions.assertThat
import org.assertj.core.data.Offset
import org.junit.Assert.assertTrue
import java.io.IOException
import java.net.InetAddress
import java.net.InetSocketAddress
import java.net.Proxy
import java.util.Deque
import java.util.concurrent.ConcurrentLinkedDeque
import java.util.concurrent.TimeUnit
open class RecordingEventListener : EventListener() {
val eventSequence: Deque<CallEvent> = ConcurrentLinkedDeque()

View File

@ -15,12 +15,13 @@
*/
package okhttp3.testing
import com.amazon.corretto.crypto.provider.AmazonCorrettoCryptoProvider
import com.amazon.corretto.crypto.provider.SelfTestStatus
import java.security.Security
import okhttp3.internal.platform.ConscryptPlatform
import okhttp3.internal.platform.Jdk8WithJettyBootPlatform
import okhttp3.internal.platform.Jdk9Platform
import okhttp3.internal.platform.OpenJSSEPlatform
import com.amazon.corretto.crypto.provider.AmazonCorrettoCryptoProvider
import com.amazon.corretto.crypto.provider.SelfTestStatus
import okhttp3.internal.platform.Platform
import org.bouncycastle.jce.provider.BouncyCastleProvider
import org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
@ -40,7 +41,6 @@ import org.junit.AssumptionViolatedException
import org.junit.rules.TestRule
import org.junit.runners.model.Statement
import org.openjsse.net.ssl.OpenJSSE
import java.security.Security
/**
* Marks a test as Platform aware, before the test runs a consistent Platform will be

View File

@ -36,35 +36,5 @@ task japicmp(type: me.champeau.gradle.japicmp.JapicmpTask, dependsOn: 'jar') {
packageExcludes = [
'okhttp3.tls.internal',
]
methodExcludes = [
// Became 'final' in 4.0.0:
'okhttp3.tls.HandshakeCertificates#keyManager()',
'okhttp3.tls.HandshakeCertificates#sslContext()',
'okhttp3.tls.HandshakeCertificates#sslSocketFactory()',
'okhttp3.tls.HandshakeCertificates#trustManager()',
'okhttp3.tls.HandshakeCertificates$Builder#addPlatformTrustedCertificates()',
'okhttp3.tls.HandshakeCertificates$Builder#addTrustedCertificate(java.security.cert.X509Certificate)',
'okhttp3.tls.HandshakeCertificates$Builder#build()',
'okhttp3.tls.HandshakeCertificates$Builder#heldCertificate(okhttp3.tls.HeldCertificate, java.security.cert.X509Certificate\\[\\])',
'okhttp3.tls.HeldCertificate#certificate()',
'okhttp3.tls.HeldCertificate#certificatePem()',
'okhttp3.tls.HeldCertificate#keyPair()',
'okhttp3.tls.HeldCertificate#privateKeyPkcs1Pem()',
'okhttp3.tls.HeldCertificate#privateKeyPkcs8Pem()',
'okhttp3.tls.HeldCertificate$Builder#addSubjectAlternativeName(java.lang.String)',
'okhttp3.tls.HeldCertificate$Builder#build()',
'okhttp3.tls.HeldCertificate$Builder#certificateAuthority(int)',
'okhttp3.tls.HeldCertificate$Builder#commonName(java.lang.String)',
'okhttp3.tls.HeldCertificate$Builder#duration(long, java.util.concurrent.TimeUnit)',
'okhttp3.tls.HeldCertificate$Builder#ecdsa256()',
'okhttp3.tls.HeldCertificate$Builder#keyPair(java.security.KeyPair)',
'okhttp3.tls.HeldCertificate$Builder#keyPair(java.security.PublicKey, java.security.PrivateKey)',
'okhttp3.tls.HeldCertificate$Builder#organizationalUnit(java.lang.String)',
'okhttp3.tls.HeldCertificate$Builder#rsa2048()',
'okhttp3.tls.HeldCertificate$Builder#serialNumber(java.math.BigInteger)',
'okhttp3.tls.HeldCertificate$Builder#serialNumber(long)',
'okhttp3.tls.HeldCertificate$Builder#signedBy(okhttp3.tls.HeldCertificate)',
'okhttp3.tls.HeldCertificate$Builder#validityInterval(long, long)',
]
}
check.dependsOn(japicmp)

View File

@ -15,10 +15,6 @@
*/
package okhttp3.tls
import okhttp3.CertificatePinner
import okhttp3.internal.platform.Platform
import okhttp3.tls.internal.TlsUtil.newKeyManager
import okhttp3.tls.internal.TlsUtil.newTrustManager
import java.security.SecureRandom
import java.security.cert.X509Certificate
import java.util.Collections
@ -28,6 +24,10 @@ import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.TrustManager
import javax.net.ssl.X509KeyManager
import javax.net.ssl.X509TrustManager
import okhttp3.CertificatePinner
import okhttp3.internal.platform.Platform
import okhttp3.tls.internal.TlsUtil.newKeyManager
import okhttp3.tls.internal.TlsUtil.newTrustManager
/**
* Certificates to identify which peers to trust and also to earn the trust of those peers in kind.

View File

@ -15,19 +15,6 @@
*/
package okhttp3.tls
import okhttp3.internal.canParseAsIpAddress
import okio.Buffer
import okio.ByteString
import okio.ByteString.Companion.decodeBase64
import okio.ByteString.Companion.toByteString
import org.bouncycastle.asn1.ASN1Encodable
import org.bouncycastle.asn1.DERSequence
import org.bouncycastle.asn1.pkcs.PrivateKeyInfo
import org.bouncycastle.asn1.x509.BasicConstraints
import org.bouncycastle.asn1.x509.GeneralName
import org.bouncycastle.asn1.x509.X509Extensions
import org.bouncycastle.jce.provider.BouncyCastleProvider
import org.bouncycastle.x509.X509V3CertificateGenerator
import java.math.BigInteger
import java.security.GeneralSecurityException
import java.security.KeyFactory
@ -47,6 +34,19 @@ import java.util.Date
import java.util.UUID
import java.util.concurrent.TimeUnit
import javax.security.auth.x500.X500Principal
import okhttp3.internal.canParseAsIpAddress
import okio.Buffer
import okio.ByteString
import okio.ByteString.Companion.decodeBase64
import okio.ByteString.Companion.toByteString
import org.bouncycastle.asn1.ASN1Encodable
import org.bouncycastle.asn1.DERSequence
import org.bouncycastle.asn1.pkcs.PrivateKeyInfo
import org.bouncycastle.asn1.x509.BasicConstraints
import org.bouncycastle.asn1.x509.GeneralName
import org.bouncycastle.asn1.x509.X509Extensions
import org.bouncycastle.jce.provider.BouncyCastleProvider
import org.bouncycastle.x509.X509V3CertificateGenerator
/**
* A certificate and its private key. These are some properties of certificates that are used with

View File

@ -15,8 +15,6 @@
*/
package okhttp3.tls.internal
import okhttp3.tls.HandshakeCertificates
import okhttp3.tls.HeldCertificate
import java.io.InputStream
import java.net.InetAddress
import java.security.KeyStore
@ -26,6 +24,8 @@ import javax.net.ssl.KeyManagerFactory
import javax.net.ssl.TrustManagerFactory
import javax.net.ssl.X509KeyManager
import javax.net.ssl.X509TrustManager
import okhttp3.tls.HandshakeCertificates
import okhttp3.tls.HeldCertificate
object TlsUtil {
val password = "password".toCharArray()

View File

@ -15,15 +15,15 @@
*/
package okhttp3
import java.io.IOException
import java.net.CookieHandler
import java.net.HttpCookie
import java.util.Collections
import okhttp3.internal.cookieToString
import okhttp3.internal.delimiterOffset
import okhttp3.internal.platform.Platform
import okhttp3.internal.platform.Platform.Companion.WARN
import okhttp3.internal.trimSubstring
import java.io.IOException
import java.net.CookieHandler
import java.net.HttpCookie
import java.util.Collections
/** A cookie jar that delegates to a [java.net.CookieHandler]. */
class JavaNetCookieJar(private val cookieHandler: CookieHandler) : CookieJar {

View File

@ -64,6 +64,18 @@ task japicmp(type: me.champeau.gradle.japicmp.JapicmpTask, dependsOn: 'jar') {
includeSynthetic = true
packageExcludes = [
'okhttp3.internal',
'okhttp3.internal.annotations',
'okhttp3.internal.cache',
'okhttp3.internal.cache2',
'okhttp3.internal.connection',
'okhttp3.internal.http',
'okhttp3.internal.http2',
'okhttp3.internal.io',
'okhttp3.internal.platform',
'okhttp3.internal.proxy',
'okhttp3.internal.publicsuffix',
'okhttp3.internal.tls',
'okhttp3.internal.ws',
]
classExcludes = [
// Package-private in 3.x, internal in 4.0.0:
@ -71,303 +83,7 @@ task japicmp(type: me.champeau.gradle.japicmp.JapicmpTask, dependsOn: 'jar') {
'okhttp3.RealCall$AsyncCall',
]
methodExcludes = [
// Became 'final' in 4.0.0:
'okhttp3.Address#certificatePinner()',
'okhttp3.Address#connectionSpecs()',
'okhttp3.Address#dns()',
'okhttp3.Address#hostnameVerifier()',
'okhttp3.Address#protocols()',
'okhttp3.Address#proxy()',
'okhttp3.Address#proxyAuthenticator()',
'okhttp3.Address#proxySelector()',
'okhttp3.Address#socketFactory()',
'okhttp3.Address#sslSocketFactory()',
'okhttp3.Address#url()',
'okhttp3.Cache#delete()',
'okhttp3.Cache#directory()',
'okhttp3.Cache#evictAll()',
'okhttp3.Cache#hitCount()',
'okhttp3.Cache#initialize()',
'okhttp3.Cache#isClosed()',
'okhttp3.Cache#maxSize()',
'okhttp3.Cache#networkCount()',
'okhttp3.Cache#requestCount()',
'okhttp3.Cache#size()',
'okhttp3.Cache#urls()',
'okhttp3.Cache#writeAbortCount()',
'okhttp3.Cache#writeSuccessCount()',
'okhttp3.CacheControl#immutable()',
'okhttp3.CacheControl#isPrivate()',
'okhttp3.CacheControl#isPublic()',
'okhttp3.CacheControl#maxAgeSeconds()',
'okhttp3.CacheControl#maxStaleSeconds()',
'okhttp3.CacheControl#minFreshSeconds()',
'okhttp3.CacheControl#mustRevalidate()',
'okhttp3.CacheControl#noCache()',
'okhttp3.CacheControl#noStore()',
'okhttp3.CacheControl#noTransform()',
'okhttp3.CacheControl#onlyIfCached()',
'okhttp3.CacheControl#sMaxAgeSeconds()',
'okhttp3.CacheControl$Builder#build()',
'okhttp3.CacheControl$Builder#immutable()',
'okhttp3.CacheControl$Builder#maxAge(int, java.util.concurrent.TimeUnit)',
'okhttp3.CacheControl$Builder#maxStale(int, java.util.concurrent.TimeUnit)',
'okhttp3.CacheControl$Builder#minFresh(int, java.util.concurrent.TimeUnit)',
'okhttp3.CacheControl$Builder#noCache()',
'okhttp3.CacheControl$Builder#noStore()',
'okhttp3.CacheControl$Builder#noTransform()',
'okhttp3.CacheControl$Builder#onlyIfCached()',
'okhttp3.CertificatePinner#check(java.lang.String, java.security.cert.Certificate\\[\\])',
'okhttp3.CertificatePinner#check(java.lang.String, java.util.List)',
'okhttp3.CertificatePinner$Builder#add(java.lang.String, java.lang.String\\[\\])',
'okhttp3.CertificatePinner$Builder#build()',
'okhttp3.CertificatePinner$Pin#matches(java.lang.String)',
'okhttp3.Challenge#authParams()',
'okhttp3.Challenge#charset()',
'okhttp3.Challenge#realm()',
'okhttp3.Challenge#scheme()',
'okhttp3.Challenge#withCharset(java.nio.charset.Charset)',
'okhttp3.CipherSuite#javaName()',
'okhttp3.ConnectionPool#connectionCount()',
'okhttp3.ConnectionPool#evictAll()',
'okhttp3.ConnectionPool#idleConnectionCount()',
'okhttp3.ConnectionSpec#cipherSuites()',
'okhttp3.ConnectionSpec#isCompatible(javax.net.ssl.SSLSocket)',
'okhttp3.ConnectionSpec#isTls()',
'okhttp3.ConnectionSpec#supportsTlsExtensions()',
'okhttp3.ConnectionSpec#tlsVersions()',
'okhttp3.ConnectionSpec$Builder#allEnabledCipherSuites()',
'okhttp3.ConnectionSpec$Builder#allEnabledTlsVersions()',
'okhttp3.ConnectionSpec$Builder#build()',
'okhttp3.ConnectionSpec$Builder#cipherSuites(java.lang.String\\[\\])',
'okhttp3.ConnectionSpec$Builder#cipherSuites(okhttp3.CipherSuite\\[\\])',
'okhttp3.ConnectionSpec$Builder#supportsTlsExtensions(boolean)',
'okhttp3.ConnectionSpec$Builder#tlsVersions(java.lang.String\\[\\])',
'okhttp3.ConnectionSpec$Builder#tlsVersions(okhttp3.TlsVersion\\[\\])',
'okhttp3.Cookie#domain()',
'okhttp3.Cookie#expiresAt()',
'okhttp3.Cookie#hostOnly()',
'okhttp3.Cookie#httpOnly()',
'okhttp3.Cookie#matches(okhttp3.HttpUrl)',
'okhttp3.Cookie#name()',
'okhttp3.Cookie#path()',
'okhttp3.Cookie#persistent()',
'okhttp3.Cookie#secure()',
'okhttp3.Cookie#value()',
'okhttp3.Cookie$Builder#build()',
'okhttp3.Cookie$Builder#domain(java.lang.String)',
'okhttp3.Cookie$Builder#expiresAt(long)',
'okhttp3.Cookie$Builder#hostOnlyDomain(java.lang.String)',
'okhttp3.Cookie$Builder#httpOnly()',
'okhttp3.Cookie$Builder#name(java.lang.String)',
'okhttp3.Cookie$Builder#path(java.lang.String)',
'okhttp3.Cookie$Builder#secure()',
'okhttp3.Cookie$Builder#value(java.lang.String)',
'okhttp3.Dispatcher#cancelAll()',
'okhttp3.Dispatcher#executorService()',
'okhttp3.Dispatcher#getMaxRequests()',
'okhttp3.Dispatcher#getMaxRequestsPerHost()',
'okhttp3.Dispatcher#queuedCalls()',
'okhttp3.Dispatcher#queuedCallsCount()',
'okhttp3.Dispatcher#runningCalls()',
'okhttp3.Dispatcher#runningCallsCount()',
'okhttp3.Dispatcher#setIdleCallback(java.lang.Runnable)',
'okhttp3.Dispatcher#setMaxRequests(int)',
'okhttp3.Dispatcher#setMaxRequestsPerHost(int)',
'okhttp3.FormBody#encodedName(int)',
'okhttp3.FormBody#encodedValue(int)',
'okhttp3.FormBody#name(int)',
'okhttp3.FormBody#size()',
'okhttp3.FormBody#value(int)',
'okhttp3.FormBody$Builder#add(java.lang.String, java.lang.String)',
'okhttp3.FormBody$Builder#addEncoded(java.lang.String, java.lang.String)',
'okhttp3.FormBody$Builder#build()',
'okhttp3.Handshake#cipherSuite()',
'okhttp3.Handshake#localCertificates()',
'okhttp3.Handshake#localPrincipal()',
'okhttp3.Handshake#peerCertificates()',
'okhttp3.Handshake#peerPrincipal()',
'okhttp3.Handshake#tlsVersion()',
'okhttp3.Headers#byteCount()',
'okhttp3.Headers#get(java.lang.String)',
'okhttp3.Headers#getDate(java.lang.String)',
'okhttp3.Headers#getInstant(java.lang.String)',
'okhttp3.Headers#name(int)',
'okhttp3.Headers#names()',
'okhttp3.Headers#newBuilder()',
'okhttp3.Headers#size()',
'okhttp3.Headers#toMultimap()',
'okhttp3.Headers#value(int)',
'okhttp3.Headers#values(java.lang.String)',
'okhttp3.Headers$Builder#add(java.lang.String)',
'okhttp3.Headers$Builder#add(java.lang.String, java.lang.String)',
'okhttp3.Headers$Builder#add(java.lang.String, java.time.Instant)',
'okhttp3.Headers$Builder#add(java.lang.String, java.util.Date)',
'okhttp3.Headers$Builder#addAll(okhttp3.Headers)',
'okhttp3.Headers$Builder#addUnsafeNonAscii(java.lang.String, java.lang.String)',
'okhttp3.Headers$Builder#build()',
'okhttp3.Headers$Builder#get(java.lang.String)',
'okhttp3.Headers$Builder#removeAll(java.lang.String)',
'okhttp3.Headers$Builder#set(java.lang.String, java.lang.String)',
'okhttp3.Headers$Builder#set(java.lang.String, java.time.Instant)',
'okhttp3.Headers$Builder#set(java.lang.String, java.util.Date)',
'okhttp3.HttpUrl#encodedFragment()',
'okhttp3.HttpUrl#encodedPassword()',
'okhttp3.HttpUrl#encodedPath()',
'okhttp3.HttpUrl#encodedPathSegments()',
'okhttp3.HttpUrl#encodedQuery()',
'okhttp3.HttpUrl#encodedUsername()',
'okhttp3.HttpUrl#fragment()',
'okhttp3.HttpUrl#host()',
'okhttp3.HttpUrl#isHttps()',
'okhttp3.HttpUrl#newBuilder()',
'okhttp3.HttpUrl#newBuilder(java.lang.String)',
'okhttp3.HttpUrl#password()',
'okhttp3.HttpUrl#pathSegments()',
'okhttp3.HttpUrl#pathSize()',
'okhttp3.HttpUrl#port()',
'okhttp3.HttpUrl#query()',
'okhttp3.HttpUrl#queryParameter(java.lang.String)',
'okhttp3.HttpUrl#queryParameterName(int)',
'okhttp3.HttpUrl#queryParameterNames()',
'okhttp3.HttpUrl#queryParameterValue(int)',
'okhttp3.HttpUrl#queryParameterValues(java.lang.String)',
'okhttp3.HttpUrl#querySize()',
'okhttp3.HttpUrl#redact()',
'okhttp3.HttpUrl#resolve(java.lang.String)',
'okhttp3.HttpUrl#scheme()',
'okhttp3.HttpUrl#topPrivateDomain()',
'okhttp3.HttpUrl#uri()',
'okhttp3.HttpUrl#url()',
'okhttp3.HttpUrl#username()',
'okhttp3.HttpUrl$Builder#addEncodedPathSegment(java.lang.String)',
'okhttp3.HttpUrl$Builder#addEncodedPathSegments(java.lang.String)',
'okhttp3.HttpUrl$Builder#addEncodedQueryParameter(java.lang.String, java.lang.String)',
'okhttp3.HttpUrl$Builder#addPathSegment(java.lang.String)',
'okhttp3.HttpUrl$Builder#addPathSegments(java.lang.String)',
'okhttp3.HttpUrl$Builder#addQueryParameter(java.lang.String, java.lang.String)',
'okhttp3.HttpUrl$Builder#build()',
'okhttp3.HttpUrl$Builder#encodedFragment(java.lang.String)',
'okhttp3.HttpUrl$Builder#encodedPassword(java.lang.String)',
'okhttp3.HttpUrl$Builder#encodedPath(java.lang.String)',
'okhttp3.HttpUrl$Builder#encodedQuery(java.lang.String)',
'okhttp3.HttpUrl$Builder#encodedUsername(java.lang.String)',
'okhttp3.HttpUrl$Builder#fragment(java.lang.String)',
'okhttp3.HttpUrl$Builder#host(java.lang.String)',
'okhttp3.HttpUrl$Builder#password(java.lang.String)',
'okhttp3.HttpUrl$Builder#port(int)',
'okhttp3.HttpUrl$Builder#query(java.lang.String)',
'okhttp3.HttpUrl$Builder#removeAllEncodedQueryParameters(java.lang.String)',
'okhttp3.HttpUrl$Builder#removeAllQueryParameters(java.lang.String)',
'okhttp3.HttpUrl$Builder#removePathSegment(int)',
'okhttp3.HttpUrl$Builder#scheme(java.lang.String)',
'okhttp3.HttpUrl$Builder#setEncodedPathSegment(int, java.lang.String)',
'okhttp3.HttpUrl$Builder#setEncodedQueryParameter(java.lang.String, java.lang.String)',
'okhttp3.HttpUrl$Builder#setPathSegment(int, java.lang.String)',
'okhttp3.HttpUrl$Builder#setQueryParameter(java.lang.String, java.lang.String)',
'okhttp3.HttpUrl$Builder#username(java.lang.String)',
'okhttp3.MediaType#charset()',
'okhttp3.MediaType#charset(java.nio.charset.Charset)',
'okhttp3.MediaType#subtype()',
'okhttp3.MediaType#type()',
'okhttp3.MultipartBody#boundary()',
'okhttp3.MultipartBody#part(int)',
'okhttp3.MultipartBody#parts()',
'okhttp3.MultipartBody#size()',
'okhttp3.MultipartBody#type()',
'okhttp3.MultipartBody$Builder#addFormDataPart(java.lang.String, java.lang.String)',
'okhttp3.MultipartBody$Builder#addFormDataPart(java.lang.String, java.lang.String, okhttp3.RequestBody)',
'okhttp3.MultipartBody$Builder#addPart(okhttp3.Headers, okhttp3.RequestBody)',
'okhttp3.MultipartBody$Builder#addPart(okhttp3.MultipartBody$Part)',
'okhttp3.MultipartBody$Builder#addPart(okhttp3.RequestBody)',
'okhttp3.MultipartBody$Builder#build()',
'okhttp3.MultipartBody$Builder#setType(okhttp3.MediaType)',
'okhttp3.MultipartBody$Part#body()',
'okhttp3.MultipartBody$Part#headers()',
'okhttp3.OkHttpClient$Builder#addInterceptor(okhttp3.Interceptor)',
'okhttp3.OkHttpClient$Builder#addNetworkInterceptor(okhttp3.Interceptor)',
'okhttp3.OkHttpClient$Builder#authenticator(okhttp3.Authenticator)',
'okhttp3.OkHttpClient$Builder#build()',
'okhttp3.OkHttpClient$Builder#cache(okhttp3.Cache)',
'okhttp3.OkHttpClient$Builder#callTimeout(java.time.Duration)',
'okhttp3.OkHttpClient$Builder#callTimeout(long, java.util.concurrent.TimeUnit)',
'okhttp3.OkHttpClient$Builder#certificatePinner(okhttp3.CertificatePinner)',
'okhttp3.OkHttpClient$Builder#connectTimeout(java.time.Duration)',
'okhttp3.OkHttpClient$Builder#connectTimeout(long, java.util.concurrent.TimeUnit)',
'okhttp3.OkHttpClient$Builder#connectionPool(okhttp3.ConnectionPool)',
'okhttp3.OkHttpClient$Builder#connectionSpecs(java.util.List)',
'okhttp3.OkHttpClient$Builder#cookieJar(okhttp3.CookieJar)',
'okhttp3.OkHttpClient$Builder#dispatcher(okhttp3.Dispatcher)',
'okhttp3.OkHttpClient$Builder#dns(okhttp3.Dns)',
'okhttp3.OkHttpClient$Builder#eventListener(okhttp3.EventListener)',
'okhttp3.OkHttpClient$Builder#eventListenerFactory(okhttp3.EventListener$Factory)',
'okhttp3.OkHttpClient$Builder#followRedirects(boolean)',
'okhttp3.OkHttpClient$Builder#followSslRedirects(boolean)',
'okhttp3.OkHttpClient$Builder#hostnameVerifier(javax.net.ssl.HostnameVerifier)',
'okhttp3.OkHttpClient$Builder#interceptors()',
'okhttp3.OkHttpClient$Builder#networkInterceptors()',
'okhttp3.OkHttpClient$Builder#pingInterval(java.time.Duration)',
'okhttp3.OkHttpClient$Builder#pingInterval(long, java.util.concurrent.TimeUnit)',
'okhttp3.OkHttpClient$Builder#protocols(java.util.List)',
'okhttp3.OkHttpClient$Builder#proxy(java.net.Proxy)',
'okhttp3.OkHttpClient$Builder#proxyAuthenticator(okhttp3.Authenticator)',
'okhttp3.OkHttpClient$Builder#proxySelector(java.net.ProxySelector)',
'okhttp3.OkHttpClient$Builder#readTimeout(java.time.Duration)',
'okhttp3.OkHttpClient$Builder#readTimeout(long, java.util.concurrent.TimeUnit)',
'okhttp3.OkHttpClient$Builder#retryOnConnectionFailure(boolean)',
'okhttp3.OkHttpClient$Builder#socketFactory(javax.net.SocketFactory)',
'okhttp3.OkHttpClient$Builder#sslSocketFactory(javax.net.ssl.SSLSocketFactory)',
'okhttp3.OkHttpClient$Builder#sslSocketFactory(javax.net.ssl.SSLSocketFactory, javax.net.ssl.X509TrustManager)',
'okhttp3.OkHttpClient$Builder#writeTimeout(java.time.Duration)',
'okhttp3.OkHttpClient$Builder#writeTimeout(long, java.util.concurrent.TimeUnit)',
'okhttp3.RealCall#getResponseWithInterceptorChain()',
'okhttp3.RealCall#redactedUrl()',
'okhttp3.RealCall#toLoggableString()',
'okhttp3.RealCall$AsyncCall#callsPerHost()',
'okhttp3.RealCall$AsyncCall#executeOn(java.util.concurrent.ExecutorService)',
'okhttp3.RealCall$AsyncCall#get()',
'okhttp3.RealCall$AsyncCall#host()',
'okhttp3.RealCall$AsyncCall#request()',
'okhttp3.RealCall$AsyncCall#reuseCallsPerHostFrom(okhttp3.RealCall$AsyncCall)',
'okhttp3.Request#body()',
'okhttp3.Request#cacheControl()',
'okhttp3.Request#header(java.lang.String)',
'okhttp3.Request#headers()',
'okhttp3.Request#headers(java.lang.String)',
'okhttp3.Request#isHttps()',
'okhttp3.Request#method()',
'okhttp3.Request#newBuilder()',
'okhttp3.Request#tag()',
'okhttp3.Request#tag(java.lang.Class)',
'okhttp3.Request#url()',
'okhttp3.Response#body()',
'okhttp3.Response#cacheControl()',
'okhttp3.Response#cacheResponse()',
'okhttp3.Response#challenges()',
'okhttp3.Response#code()',
'okhttp3.Response#handshake()',
'okhttp3.Response#header(java.lang.String)',
'okhttp3.Response#header(java.lang.String, java.lang.String)',
'okhttp3.Response#headers()',
'okhttp3.Response#headers(java.lang.String)',
'okhttp3.Response#isRedirect()',
'okhttp3.Response#isSuccessful()',
'okhttp3.Response#message()',
'okhttp3.Response#networkResponse()',
'okhttp3.Response#newBuilder()',
'okhttp3.Response#peekBody(long)',
'okhttp3.Response#priorResponse()',
'okhttp3.Response#protocol()',
'okhttp3.Response#receivedResponseAtMillis()',
'okhttp3.Response#request()',
'okhttp3.Response#sentRequestAtMillis()',
'okhttp3.Response#trailers()',
'okhttp3.Route#address()',
'okhttp3.Route#proxy()',
'okhttp3.Route#requiresTunnel()',
'okhttp3.Route#socketAddress()',
'okhttp3.TlsVersion#javaName()',
// Real API change! Became 'final' despite a non-final enclosing class in 4.0.0:
// Became 'final' despite a non-final enclosing class in 4.0.0:
'okhttp3.OkHttpClient#authenticator()',
'okhttp3.OkHttpClient#cache()',
'okhttp3.OkHttpClient#callTimeoutMillis()',

View File

@ -15,13 +15,13 @@
*/
package okhttp3
import okhttp3.internal.toImmutableList
import java.net.Proxy
import java.net.ProxySelector
import java.util.Objects
import javax.net.SocketFactory
import javax.net.ssl.HostnameVerifier
import javax.net.ssl.SSLSocketFactory
import okhttp3.internal.toImmutableList
/**
* A specification for a connection to an origin server. For simple connections, this is the

View File

@ -15,6 +15,16 @@
*/
package okhttp3
import java.io.Closeable
import java.io.File
import java.io.Flushable
import java.io.IOException
import java.security.cert.Certificate
import java.security.cert.CertificateEncodingException
import java.security.cert.CertificateException
import java.security.cert.CertificateFactory
import java.util.NoSuchElementException
import java.util.TreeSet
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.internal.EMPTY_HEADERS
import okhttp3.internal.cache.CacheRequest
@ -38,16 +48,6 @@ import okio.ForwardingSource
import okio.Sink
import okio.Source
import okio.buffer
import java.io.Closeable
import java.io.File
import java.io.Flushable
import java.io.IOException
import java.security.cert.Certificate
import java.security.cert.CertificateEncodingException
import java.security.cert.CertificateException
import java.security.cert.CertificateFactory
import java.util.NoSuchElementException
import java.util.TreeSet
/**
* Caches HTTP and HTTPS responses to the filesystem so they may be reused, saving time and

View File

@ -15,9 +15,9 @@
*/
package okhttp3
import java.util.concurrent.TimeUnit
import okhttp3.internal.indexOfNonWhitespace
import okhttp3.internal.toNonNegativeInt
import java.util.concurrent.TimeUnit
/**
* A Cache-Control header with cache directives from a server or client. These directives set policy

View File

@ -15,8 +15,8 @@
*/
package okhttp3
import okio.Timeout
import java.io.IOException
import okio.Timeout
/**
* A call is a request that has been prepared for execution. A call can be canceled. As this object

View File

@ -15,14 +15,14 @@
*/
package okhttp3
import java.security.cert.Certificate
import java.security.cert.X509Certificate
import javax.net.ssl.SSLPeerUnverifiedException
import okhttp3.internal.tls.CertificateChainCleaner
import okhttp3.internal.toCanonicalHost
import okio.ByteString
import okio.ByteString.Companion.decodeBase64
import okio.ByteString.Companion.toByteString
import java.security.cert.Certificate
import java.security.cert.X509Certificate
import javax.net.ssl.SSLPeerUnverifiedException
/**
* Constrains which certificates are trusted. Pinning certificates defends against attacks on

View File

@ -16,9 +16,9 @@
*/
package okhttp3
import java.util.concurrent.TimeUnit
import okhttp3.internal.concurrent.TaskRunner
import okhttp3.internal.connection.RealConnectionPool
import java.util.concurrent.TimeUnit
/**
* Manages reuse of HTTP and HTTP/2 connections for reduced network latency. HTTP requests that

View File

@ -15,14 +15,14 @@
*/
package okhttp3
import java.util.Arrays
import java.util.Objects
import javax.net.ssl.SSLSocket
import okhttp3.ConnectionSpec.Builder
import okhttp3.internal.concat
import okhttp3.internal.hasIntersection
import okhttp3.internal.indexOf
import okhttp3.internal.intersect
import java.util.Arrays
import java.util.Objects
import javax.net.ssl.SSLSocket
/**
* Specifies configuration for the socket connection that HTTP traffic travels through. For `https:`

View File

@ -15,6 +15,12 @@
*/
package okhttp3
import java.util.Calendar
import java.util.Collections
import java.util.Date
import java.util.GregorianCalendar
import java.util.Locale
import java.util.regex.Pattern
import okhttp3.internal.UTC
import okhttp3.internal.canParseAsIpAddress
import okhttp3.internal.delimiterOffset
@ -25,12 +31,6 @@ import okhttp3.internal.publicsuffix.PublicSuffixDatabase
import okhttp3.internal.toCanonicalHost
import okhttp3.internal.trimSubstring
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
import java.util.Calendar
import java.util.Collections
import java.util.Date
import java.util.GregorianCalendar
import java.util.Locale
import java.util.regex.Pattern
/**
* An [RFC 6265](http://tools.ietf.org/html/rfc6265) Cookie.

View File

@ -15,9 +15,9 @@
*/
package okhttp3
import okio.ByteString.Companion.encode
import java.nio.charset.Charset
import java.nio.charset.StandardCharsets.ISO_8859_1
import okio.ByteString.Companion.encode
/** Factory for HTTP authorization credentials. */
object Credentials {

View File

@ -15,9 +15,6 @@
*/
package okhttp3
import okhttp3.RealCall.AsyncCall
import okhttp3.internal.assertThreadDoesntHoldLock
import okhttp3.internal.threadFactory
import java.util.ArrayDeque
import java.util.Collections
import java.util.Deque
@ -25,6 +22,9 @@ import java.util.concurrent.ExecutorService
import java.util.concurrent.SynchronousQueue
import java.util.concurrent.ThreadPoolExecutor
import java.util.concurrent.TimeUnit
import okhttp3.RealCall.AsyncCall
import okhttp3.internal.assertThreadDoesntHoldLock
import okhttp3.internal.threadFactory
/**
* Policy on when async requests are executed.

View File

@ -15,9 +15,9 @@
*/
package okhttp3
import okhttp3.Dns.Companion.SYSTEM
import java.net.InetAddress
import java.net.UnknownHostException
import okhttp3.Dns.Companion.SYSTEM
/**
* A domain name service that resolves IP addresses for host names. Most applications will use the

View File

@ -15,6 +15,8 @@
*/
package okhttp3
import java.io.IOException
import java.nio.charset.Charset
import okhttp3.HttpUrl.Companion.FORM_ENCODE_SET
import okhttp3.HttpUrl.Companion.canonicalize
import okhttp3.HttpUrl.Companion.percentDecode
@ -22,8 +24,6 @@ import okhttp3.MediaType.Companion.toMediaType
import okhttp3.internal.toImmutableList
import okio.Buffer
import okio.BufferedSink
import java.io.IOException
import java.nio.charset.Charset
class FormBody internal constructor(
encodedNames: List<String>,

View File

@ -15,14 +15,14 @@
*/
package okhttp3
import okhttp3.internal.immutableListOf
import okhttp3.internal.toImmutableList
import java.io.IOException
import java.security.Principal
import java.security.cert.Certificate
import java.security.cert.X509Certificate
import javax.net.ssl.SSLPeerUnverifiedException
import javax.net.ssl.SSLSession
import okhttp3.internal.immutableListOf
import okhttp3.internal.toImmutableList
/**
* A record of a TLS handshake. For HTTPS clients, the client is *local* and the remote server is

View File

@ -17,11 +17,6 @@
package okhttp3
import okhttp3.Headers.Builder
import okhttp3.internal.format
import okhttp3.internal.http.toHttpDateOrNull
import okhttp3.internal.http.toHttpDateString
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
import java.time.Instant
import java.util.ArrayList
import java.util.Collections
@ -29,6 +24,11 @@ import java.util.Date
import java.util.Locale
import java.util.TreeMap
import java.util.TreeSet
import okhttp3.Headers.Builder
import okhttp3.internal.format
import okhttp3.internal.http.toHttpDateOrNull
import okhttp3.internal.http.toHttpDateString
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
/**
* The header fields of a single HTTP message. Values are uninterpreted strings; use `Request` and

View File

@ -15,16 +15,6 @@
*/
package okhttp3
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import okhttp3.internal.canParseAsIpAddress
import okhttp3.internal.delimiterOffset
import okhttp3.internal.indexOfFirstNonAsciiWhitespace
import okhttp3.internal.indexOfLastNonAsciiWhitespace
import okhttp3.internal.parseHexDigit
import okhttp3.internal.publicsuffix.PublicSuffixDatabase
import okhttp3.internal.toCanonicalHost
import okio.Buffer
import java.net.InetAddress
import java.net.MalformedURLException
import java.net.URI
@ -35,6 +25,16 @@ import java.nio.charset.StandardCharsets.UTF_8
import java.util.ArrayList
import java.util.Collections
import java.util.LinkedHashSet
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import okhttp3.internal.canParseAsIpAddress
import okhttp3.internal.delimiterOffset
import okhttp3.internal.indexOfFirstNonAsciiWhitespace
import okhttp3.internal.indexOfLastNonAsciiWhitespace
import okhttp3.internal.parseHexDigit
import okhttp3.internal.publicsuffix.PublicSuffixDatabase
import okhttp3.internal.toCanonicalHost
import okio.Buffer
/**
* A uniform resource locator (URL) with a scheme of either `http` or `https`. Use this class to

View File

@ -15,14 +15,14 @@
*/
package okhttp3
import java.io.IOException
import java.util.UUID
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.internal.toImmutableList
import okio.Buffer
import okio.BufferedSink
import okio.ByteString
import okio.ByteString.Companion.encodeUtf8
import java.io.IOException
import java.util.UUID
/**
* An [RFC 2387][rfc_2387]-compliant request body.

View File

@ -15,6 +15,20 @@
*/
package okhttp3
import java.net.Proxy
import java.net.ProxySelector
import java.net.Socket
import java.security.GeneralSecurityException
import java.time.Duration
import java.util.Collections
import java.util.Random
import java.util.concurrent.ExecutorService
import java.util.concurrent.TimeUnit
import javax.net.SocketFactory
import javax.net.ssl.HostnameVerifier
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.TrustManager
import javax.net.ssl.X509TrustManager
import okhttp3.Protocol.HTTP_1_1
import okhttp3.Protocol.HTTP_2
import okhttp3.internal.asFactory
@ -30,20 +44,6 @@ import okhttp3.internal.ws.RealWebSocket
import okio.Sink
import okio.Source
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
import java.net.Proxy
import java.net.ProxySelector
import java.net.Socket
import java.security.GeneralSecurityException
import java.time.Duration
import java.util.Collections
import java.util.Random
import java.util.concurrent.ExecutorService
import java.util.concurrent.TimeUnit
import javax.net.SocketFactory
import javax.net.ssl.HostnameVerifier
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.TrustManager
import javax.net.ssl.X509TrustManager
/**
* Factory for [calls][Call], which can be used to send HTTP requests and read their responses.

View File

@ -15,6 +15,11 @@
*/
package okhttp3
import java.io.IOException
import java.io.InterruptedIOException
import java.util.concurrent.ExecutorService
import java.util.concurrent.RejectedExecutionException
import java.util.concurrent.atomic.AtomicInteger
import okhttp3.internal.assertThreadDoesntHoldLock
import okhttp3.internal.cache.CacheInterceptor
import okhttp3.internal.closeQuietly
@ -28,11 +33,6 @@ import okhttp3.internal.platform.Platform
import okhttp3.internal.platform.Platform.Companion.INFO
import okhttp3.internal.threadName
import okio.Timeout
import java.io.IOException
import java.io.InterruptedIOException
import java.util.concurrent.ExecutorService
import java.util.concurrent.RejectedExecutionException
import java.util.concurrent.atomic.AtomicInteger
internal class RealCall private constructor(
val client: OkHttpClient,

View File

@ -15,11 +15,11 @@
*/
package okhttp3
import java.net.URL
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.internal.EMPTY_REQUEST
import okhttp3.internal.http.HttpMethod
import okhttp3.internal.toImmutableMap
import java.net.URL
/**
* An HTTP request. Instances of this class are immutable if their [body] is null or itself

View File

@ -15,15 +15,15 @@
*/
package okhttp3
import java.io.File
import java.io.IOException
import java.nio.charset.Charset
import kotlin.text.Charsets.UTF_8
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.internal.checkOffsetAndCount
import okio.BufferedSink
import okio.ByteString
import okio.source
import java.io.File
import java.io.IOException
import java.nio.charset.Charset
import kotlin.text.Charsets.UTF_8
abstract class RequestBody {

View File

@ -15,12 +15,6 @@
*/
package okhttp3
import okhttp3.ResponseBody.Companion.asResponseBody
import okhttp3.internal.connection.Exchange
import okhttp3.internal.http.StatusLine.Companion.HTTP_PERM_REDIRECT
import okhttp3.internal.http.StatusLine.Companion.HTTP_TEMP_REDIRECT
import okhttp3.internal.http.parseChallenges
import okio.Buffer
import java.io.Closeable
import java.io.IOException
import java.net.HttpURLConnection.HTTP_MOVED_PERM
@ -29,6 +23,12 @@ import java.net.HttpURLConnection.HTTP_MULT_CHOICE
import java.net.HttpURLConnection.HTTP_PROXY_AUTH
import java.net.HttpURLConnection.HTTP_SEE_OTHER
import java.net.HttpURLConnection.HTTP_UNAUTHORIZED
import okhttp3.ResponseBody.Companion.asResponseBody
import okhttp3.internal.connection.Exchange
import okhttp3.internal.http.StatusLine.Companion.HTTP_PERM_REDIRECT
import okhttp3.internal.http.StatusLine.Companion.HTTP_TEMP_REDIRECT
import okhttp3.internal.http.parseChallenges
import okio.Buffer
/**
* An HTTP response. Instances of this class are not immutable: the response body is a one-shot

View File

@ -15,12 +15,6 @@
*/
package okhttp3
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.internal.closeQuietly
import okhttp3.internal.readBomAsCharset
import okio.Buffer
import okio.BufferedSource
import okio.ByteString
import java.io.Closeable
import java.io.IOException
import java.io.InputStream
@ -28,6 +22,12 @@ import java.io.InputStreamReader
import java.io.Reader
import java.nio.charset.Charset
import kotlin.text.Charsets.UTF_8
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.internal.closeQuietly
import okhttp3.internal.readBomAsCharset
import okio.Buffer
import okio.BufferedSource
import okio.ByteString
/**
* A one-shot stream from the origin server to the client application with the raw bytes of the

View File

@ -17,22 +17,6 @@
package okhttp3.internal
import okhttp3.Call
import okhttp3.EventListener
import okhttp3.Headers
import okhttp3.Headers.Companion.headersOf
import okhttp3.HttpUrl
import okhttp3.OkHttpClient
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.Response
import okhttp3.ResponseBody.Companion.toResponseBody
import okhttp3.internal.http2.Header
import okio.Buffer
import okio.BufferedSink
import okio.BufferedSource
import okio.ByteString.Companion.decodeHex
import okio.Options
import okio.Source
import java.io.Closeable
import java.io.IOException
import java.io.InterruptedIOException
@ -53,6 +37,22 @@ import java.util.concurrent.ThreadFactory
import java.util.concurrent.TimeUnit
import kotlin.text.Charsets.UTF_32BE
import kotlin.text.Charsets.UTF_32LE
import okhttp3.Call
import okhttp3.EventListener
import okhttp3.Headers
import okhttp3.Headers.Companion.headersOf
import okhttp3.HttpUrl
import okhttp3.OkHttpClient
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.Response
import okhttp3.ResponseBody.Companion.toResponseBody
import okhttp3.internal.http2.Header
import okio.Buffer
import okio.BufferedSink
import okio.BufferedSource
import okio.ByteString.Companion.decodeHex
import okio.Options
import okio.Source
@JvmField
val EMPTY_BYTE_ARRAY = ByteArray(0)

View File

@ -16,6 +16,10 @@
*/
package okhttp3.internal.cache
import java.io.IOException
import java.net.HttpURLConnection.HTTP_GATEWAY_TIMEOUT
import java.net.HttpURLConnection.HTTP_NOT_MODIFIED
import java.util.concurrent.TimeUnit.MILLISECONDS
import okhttp3.Cache
import okhttp3.Headers
import okhttp3.Interceptor
@ -32,10 +36,6 @@ import okio.Buffer
import okio.Source
import okio.Timeout
import okio.buffer
import java.io.IOException
import java.net.HttpURLConnection.HTTP_GATEWAY_TIMEOUT
import java.net.HttpURLConnection.HTTP_NOT_MODIFIED
import java.util.concurrent.TimeUnit.MILLISECONDS
/** Serves requests from the cache and writes responses to the cache. */
class CacheInterceptor(internal val cache: Cache?) : Interceptor {

View File

@ -15,11 +15,6 @@
*/
package okhttp3.internal.cache
import okhttp3.Request
import okhttp3.Response
import okhttp3.internal.http.StatusLine
import okhttp3.internal.http.toHttpDateOrNull
import okhttp3.internal.toNonNegativeInt
import java.net.HttpURLConnection.HTTP_BAD_METHOD
import java.net.HttpURLConnection.HTTP_GONE
import java.net.HttpURLConnection.HTTP_MOVED_PERM
@ -33,6 +28,11 @@ import java.net.HttpURLConnection.HTTP_OK
import java.net.HttpURLConnection.HTTP_REQ_TOO_LONG
import java.util.Date
import java.util.concurrent.TimeUnit.SECONDS
import okhttp3.Request
import okhttp3.Response
import okhttp3.internal.http.StatusLine
import okhttp3.internal.http.toHttpDateOrNull
import okhttp3.internal.toNonNegativeInt
/**
* Given a request and cached response, this figures out whether to use the network, the cache, or

View File

@ -15,6 +15,15 @@
*/
package okhttp3.internal.cache
import java.io.Closeable
import java.io.EOFException
import java.io.File
import java.io.FileNotFoundException
import java.io.Flushable
import java.io.IOException
import java.util.ArrayList
import java.util.LinkedHashMap
import java.util.NoSuchElementException
import okhttp3.internal.assertThreadHoldsLock
import okhttp3.internal.cache.DiskLruCache.Editor
import okhttp3.internal.closeQuietly
@ -28,15 +37,6 @@ import okio.Sink
import okio.Source
import okio.blackholeSink
import okio.buffer
import java.io.Closeable
import java.io.EOFException
import java.io.File
import java.io.FileNotFoundException
import java.io.Flushable
import java.io.IOException
import java.util.ArrayList
import java.util.LinkedHashMap
import java.util.NoSuchElementException
/**
* A cache that uses a bounded amount of space on a filesystem. Each cache entry has a string key

View File

@ -15,10 +15,10 @@
*/
package okhttp3.internal.cache
import java.io.IOException
import okio.Buffer
import okio.ForwardingSink
import okio.Sink
import java.io.IOException
/** A sink that never throws IOExceptions, even if the underlying sink does. */
internal open class FaultHidingSink(

View File

@ -15,9 +15,9 @@
*/
package okhttp3.internal.cache2
import okio.Buffer
import java.io.IOException
import java.nio.channels.FileChannel
import okio.Buffer
/**
* Read and write a target file. Unlike Okio's built-in `Okio.source(java.io.File file)` and `Okio.sink(java.io.File file)`

View File

@ -15,6 +15,9 @@
*/
package okhttp3.internal.cache2
import java.io.File
import java.io.IOException
import java.io.RandomAccessFile
import okhttp3.internal.closeQuietly
import okhttp3.internal.notifyAll
import okio.Buffer
@ -22,9 +25,6 @@ import okio.ByteString
import okio.ByteString.Companion.encodeUtf8
import okio.Source
import okio.Timeout
import java.io.File
import java.io.IOException
import java.io.RandomAccessFile
/**
* Replicates a single upstream source into multiple downstream sources. Each downstream source

View File

@ -15,9 +15,9 @@
*/
package okhttp3.internal.concurrent
import okhttp3.internal.assertThreadDoesntHoldLock
import java.util.concurrent.CountDownLatch
import java.util.concurrent.RejectedExecutionException
import okhttp3.internal.assertThreadDoesntHoldLock
/**
* A set of tasks that are executed in sequential order.

View File

@ -15,17 +15,17 @@
*/
package okhttp3.internal.concurrent
import java.util.concurrent.SynchronousQueue
import java.util.concurrent.ThreadFactory
import java.util.concurrent.ThreadPoolExecutor
import java.util.concurrent.TimeUnit
import java.util.logging.Logger
import okhttp3.internal.addIfAbsent
import okhttp3.internal.assertThreadDoesntHoldLock
import okhttp3.internal.assertThreadHoldsLock
import okhttp3.internal.concurrent.TaskRunner.Companion.INSTANCE
import okhttp3.internal.notify
import okhttp3.internal.threadFactory
import java.util.concurrent.SynchronousQueue
import java.util.concurrent.ThreadFactory
import java.util.concurrent.ThreadPoolExecutor
import java.util.concurrent.TimeUnit
import java.util.logging.Logger
/**
* A set of worker threads that are shared among a set of task queues.

View File

@ -16,10 +16,10 @@
*/
package okhttp3.internal.connection
import java.io.IOException
import okhttp3.Interceptor
import okhttp3.Response
import okhttp3.internal.http.RealInterceptorChain
import java.io.IOException
/** Opens a connection to the target server and proceeds to the next interceptor. */
object ConnectInterceptor : Interceptor {

View File

@ -15,7 +15,6 @@
*/
package okhttp3.internal.connection
import okhttp3.ConnectionSpec
import java.io.IOException
import java.io.InterruptedIOException
import java.net.ProtocolException
@ -25,6 +24,7 @@ import javax.net.ssl.SSLException
import javax.net.ssl.SSLHandshakeException
import javax.net.ssl.SSLPeerUnverifiedException
import javax.net.ssl.SSLSocket
import okhttp3.ConnectionSpec
/**
* Handles the connection spec fallback strategy: When a secure socket connection fails due to a

View File

@ -15,6 +15,9 @@
*/
package okhttp3.internal.connection
import java.io.IOException
import java.net.ProtocolException
import java.net.SocketException
import okhttp3.Call
import okhttp3.EventListener
import okhttp3.Headers
@ -30,9 +33,6 @@ import okio.ForwardingSource
import okio.Sink
import okio.Source
import okio.buffer
import java.io.IOException
import java.net.ProtocolException
import java.net.SocketException
/**
* Transmits a single HTTP request and a response pair. This layers connection management and events

View File

@ -15,6 +15,8 @@
*/
package okhttp3.internal.connection
import java.io.IOException
import java.net.Socket
import okhttp3.Address
import okhttp3.Call
import okhttp3.EventListener
@ -26,8 +28,6 @@ import okhttp3.internal.assertThreadHoldsLock
import okhttp3.internal.canReuseConnectionFor
import okhttp3.internal.closeQuietly
import okhttp3.internal.http.ExchangeCodec
import java.io.IOException
import java.net.Socket
/**
* Attempts to find the connections for a sequence of exchanges. This uses the following strategies:

View File

@ -16,6 +16,21 @@
*/
package okhttp3.internal.connection
import java.io.IOException
import java.lang.ref.Reference
import java.net.ConnectException
import java.net.HttpURLConnection.HTTP_OK
import java.net.HttpURLConnection.HTTP_PROXY_AUTH
import java.net.ProtocolException
import java.net.Proxy
import java.net.Socket
import java.net.SocketException
import java.net.SocketTimeoutException
import java.net.UnknownServiceException
import java.security.cert.X509Certificate
import java.util.concurrent.TimeUnit.MILLISECONDS
import javax.net.ssl.SSLPeerUnverifiedException
import javax.net.ssl.SSLSocket
import okhttp3.Address
import okhttp3.Call
import okhttp3.CertificatePinner
@ -54,21 +69,6 @@ import okio.BufferedSource
import okio.buffer
import okio.sink
import okio.source
import java.io.IOException
import java.lang.ref.Reference
import java.net.ConnectException
import java.net.HttpURLConnection.HTTP_OK
import java.net.HttpURLConnection.HTTP_PROXY_AUTH
import java.net.ProtocolException
import java.net.Proxy
import java.net.Socket
import java.net.SocketException
import java.net.SocketTimeoutException
import java.net.UnknownServiceException
import java.security.cert.X509Certificate
import java.util.concurrent.TimeUnit.MILLISECONDS
import javax.net.ssl.SSLPeerUnverifiedException
import javax.net.ssl.SSLSocket
class RealConnection(
val connectionPool: RealConnectionPool,

View File

@ -16,6 +16,10 @@
*/
package okhttp3.internal.connection
import java.io.IOException
import java.net.Proxy
import java.util.ArrayDeque
import java.util.concurrent.TimeUnit
import okhttp3.Address
import okhttp3.ConnectionPool
import okhttp3.Route
@ -26,10 +30,6 @@ import okhttp3.internal.concurrent.TaskQueue
import okhttp3.internal.concurrent.TaskRunner
import okhttp3.internal.connection.Transmitter.TransmitterReference
import okhttp3.internal.platform.Platform
import java.io.IOException
import java.net.Proxy
import java.util.ArrayDeque
import java.util.concurrent.TimeUnit
class RealConnectionPool(
taskRunner: TaskRunner,

View File

@ -15,6 +15,12 @@
*/
package okhttp3.internal.connection
import java.io.IOException
import java.net.InetSocketAddress
import java.net.Proxy
import java.net.SocketException
import java.net.UnknownHostException
import java.util.NoSuchElementException
import okhttp3.Address
import okhttp3.Call
import okhttp3.EventListener
@ -22,12 +28,6 @@ import okhttp3.HttpUrl
import okhttp3.Route
import okhttp3.internal.immutableListOf
import okhttp3.internal.toImmutableList
import java.io.IOException
import java.net.InetSocketAddress
import java.net.Proxy
import java.net.SocketException
import java.net.UnknownHostException
import java.util.NoSuchElementException
/**
* Selects routes to connect to an origin server. Each connection requires a choice of proxy server,

View File

@ -15,6 +15,13 @@
*/
package okhttp3.internal.connection
import java.io.IOException
import java.io.InterruptedIOException
import java.lang.ref.WeakReference
import java.net.Socket
import java.util.concurrent.TimeUnit.MILLISECONDS
import javax.net.ssl.HostnameVerifier
import javax.net.ssl.SSLSocketFactory
import okhttp3.Address
import okhttp3.Call
import okhttp3.CertificatePinner
@ -25,18 +32,11 @@ import okhttp3.Interceptor
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.internal.assertThreadHoldsLock
import okhttp3.internal.closeQuietly
import okhttp3.internal.canReuseConnectionFor
import okhttp3.internal.closeQuietly
import okhttp3.internal.platform.Platform
import okio.AsyncTimeout
import okio.Timeout
import java.io.IOException
import java.io.InterruptedIOException
import java.lang.ref.WeakReference
import java.net.Socket
import java.util.concurrent.TimeUnit.MILLISECONDS
import javax.net.ssl.HostnameVerifier
import javax.net.ssl.SSLSocketFactory
/**
* Bridge between OkHttp's application and network layers. This class exposes high-level application

View File

@ -15,11 +15,11 @@
*/
package okhttp3.internal
import okio.Buffer
import java.net.IDN
import java.net.InetAddress
import java.util.Arrays
import java.util.Locale
import okio.Buffer
/**
* If this is an IP address, this returns the IP address in canonical form.

View File

@ -21,10 +21,9 @@ import okhttp3.Cookie
import okhttp3.CookieJar
import okhttp3.Interceptor
import okhttp3.Response
import okhttp3.internal.toHostHeader
import okhttp3.internal.userAgent
import okio.GzipSource
import okhttp3.internal.toHostHeader
import okio.buffer
/**

View File

@ -15,12 +15,12 @@
*/
package okhttp3.internal.http
import java.io.IOException
import java.net.ProtocolException
import okhttp3.Interceptor
import okhttp3.Response
import okhttp3.internal.EMPTY_RESPONSE
import okio.buffer
import java.io.IOException
import java.net.ProtocolException
/** This is the last interceptor in the chain. It makes a network call to the server. */
class CallServerInterceptor(private val forWebSocket: Boolean) : Interceptor {

View File

@ -17,6 +17,10 @@
package okhttp3.internal.http
import java.io.EOFException
import java.net.HttpURLConnection.HTTP_NOT_MODIFIED
import java.net.HttpURLConnection.HTTP_NO_CONTENT
import java.util.Collections
import okhttp3.Challenge
import okhttp3.Cookie
import okhttp3.CookieJar
@ -29,10 +33,6 @@ import okhttp3.internal.platform.Platform
import okhttp3.internal.skipAll
import okio.Buffer
import okio.ByteString.Companion.encodeUtf8
import java.io.EOFException
import java.net.HttpURLConnection.HTTP_NOT_MODIFIED
import java.net.HttpURLConnection.HTTP_NO_CONTENT
import java.util.Collections
private val QUOTED_STRING_DELIMITERS = "\"\\".encodeUtf8()
private val TOKEN_DELIMITERS = "\t ,=".encodeUtf8()

View File

@ -15,6 +15,8 @@
*/
package okhttp3.internal.http
import java.io.IOException
import java.util.concurrent.TimeUnit
import okhttp3.Call
import okhttp3.Connection
import okhttp3.Interceptor
@ -23,8 +25,6 @@ import okhttp3.Response
import okhttp3.internal.checkDuration
import okhttp3.internal.connection.Exchange
import okhttp3.internal.connection.Transmitter
import java.io.IOException
import java.util.concurrent.TimeUnit
/**
* A concrete interceptor chain that carries the entire interceptor chain: all application

View File

@ -15,10 +15,10 @@
*/
package okhttp3.internal.http
import okhttp3.HttpUrl
import okhttp3.Request
import java.net.HttpURLConnection
import java.net.Proxy
import okhttp3.HttpUrl
import okhttp3.Request
object RequestLine {

View File

@ -15,18 +15,6 @@
*/
package okhttp3.internal.http
import okhttp3.Interceptor
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import okhttp3.Route
import okhttp3.internal.closeQuietly
import okhttp3.internal.connection.RouteException
import okhttp3.internal.connection.Transmitter
import okhttp3.internal.http.StatusLine.Companion.HTTP_PERM_REDIRECT
import okhttp3.internal.http.StatusLine.Companion.HTTP_TEMP_REDIRECT
import okhttp3.internal.http2.ConnectionShutdownException
import okhttp3.internal.canReuseConnectionFor
import java.io.FileNotFoundException
import java.io.IOException
import java.io.InterruptedIOException
@ -44,6 +32,18 @@ import java.net.SocketTimeoutException
import java.security.cert.CertificateException
import javax.net.ssl.SSLHandshakeException
import javax.net.ssl.SSLPeerUnverifiedException
import okhttp3.Interceptor
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import okhttp3.Route
import okhttp3.internal.canReuseConnectionFor
import okhttp3.internal.closeQuietly
import okhttp3.internal.connection.RouteException
import okhttp3.internal.connection.Transmitter
import okhttp3.internal.http.StatusLine.Companion.HTTP_PERM_REDIRECT
import okhttp3.internal.http.StatusLine.Companion.HTTP_TEMP_REDIRECT
import okhttp3.internal.http2.ConnectionShutdownException
/**
* This interceptor recovers from failures and follows redirects as necessary. It may throw an

View File

@ -15,10 +15,10 @@
*/
package okhttp3.internal.http
import okhttp3.Protocol
import okhttp3.Response
import java.io.IOException
import java.net.ProtocolException
import okhttp3.Protocol
import okhttp3.Response
/** An HTTP response status line like "HTTP/1.1 200 OK". */
class StatusLine(

View File

@ -15,12 +15,12 @@
*/
package okhttp3.internal.http
import okhttp3.internal.UTC
import java.text.DateFormat
import java.text.ParsePosition
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale
import okhttp3.internal.UTC
/** The last four-digit year: "Fri, 31 Dec 9999 23:59:59 GMT". */
internal const val MAX_DATE = 253402300799999L

View File

@ -15,6 +15,10 @@
*/
package okhttp3.internal.http1
import java.io.EOFException
import java.io.IOException
import java.net.ProtocolException
import java.util.concurrent.TimeUnit.MILLISECONDS
import okhttp3.Headers
import okhttp3.HttpUrl
import okhttp3.OkHttpClient
@ -39,10 +43,6 @@ import okio.ForwardingTimeout
import okio.Sink
import okio.Source
import okio.Timeout
import java.io.EOFException
import java.io.IOException
import java.net.ProtocolException
import java.util.concurrent.TimeUnit.MILLISECONDS
/**
* A socket connection that can be used to send HTTP/1.1 messages. This class strictly enforces the

View File

@ -15,6 +15,10 @@
*/
package okhttp3.internal.http2
import java.io.IOException
import java.util.Arrays
import java.util.Collections
import java.util.LinkedHashMap
import okhttp3.internal.and
import okhttp3.internal.http2.Header.Companion.RESPONSE_STATUS
import okhttp3.internal.http2.Header.Companion.TARGET_AUTHORITY
@ -26,10 +30,6 @@ import okio.BufferedSource
import okio.ByteString
import okio.Source
import okio.buffer
import java.io.IOException
import java.util.Arrays
import java.util.Collections
import java.util.LinkedHashMap
/**
* Read and write HPACK v10.

View File

@ -15,6 +15,11 @@
*/
package okhttp3.internal.http2
import java.io.Closeable
import java.io.IOException
import java.io.InterruptedIOException
import java.net.Socket
import java.util.concurrent.TimeUnit
import okhttp3.internal.EMPTY_BYTE_ARRAY
import okhttp3.internal.EMPTY_HEADERS
import okhttp3.internal.assertThreadDoesntHoldLock
@ -36,11 +41,6 @@ import okio.ByteString
import okio.buffer
import okio.sink
import okio.source
import java.io.Closeable
import java.io.IOException
import java.io.InterruptedIOException
import java.net.Socket
import java.util.concurrent.TimeUnit
/**
* A socket connection to a remote peer. A connection hosts streams which can send and receive

View File

@ -15,6 +15,11 @@
*/
package okhttp3.internal.http2
import java.io.IOException
import java.net.ProtocolException
import java.util.ArrayList
import java.util.Locale
import java.util.concurrent.TimeUnit
import okhttp3.Headers
import okhttp3.Interceptor
import okhttp3.OkHttpClient
@ -40,11 +45,6 @@ import okhttp3.internal.http2.Header.Companion.TARGET_SCHEME_UTF8
import okhttp3.internal.immutableListOf
import okio.Sink
import okio.Source
import java.io.IOException
import java.net.ProtocolException
import java.util.ArrayList
import java.util.Locale
import java.util.concurrent.TimeUnit
/** Encode requests and responses using HTTP/2 frames. */
class Http2ExchangeCodec(

View File

@ -15,8 +15,13 @@
*/
package okhttp3.internal.http2
import okhttp3.internal.format
import java.io.Closeable
import java.io.EOFException
import java.io.IOException
import java.util.logging.Level.FINE
import java.util.logging.Logger
import okhttp3.internal.and
import okhttp3.internal.format
import okhttp3.internal.http2.Http2.CONNECTION_PREFACE
import okhttp3.internal.http2.Http2.FLAG_ACK
import okhttp3.internal.http2.Http2.FLAG_COMPRESSED
@ -42,11 +47,6 @@ import okio.BufferedSource
import okio.ByteString
import okio.Source
import okio.Timeout
import java.io.Closeable
import java.io.EOFException
import java.io.IOException
import java.util.logging.Level.FINE
import java.util.logging.Logger
/**
* Reads HTTP/2 transport frames.

View File

@ -15,6 +15,11 @@
*/
package okhttp3.internal.http2
import java.io.EOFException
import java.io.IOException
import java.io.InterruptedIOException
import java.net.SocketTimeoutException
import java.util.ArrayDeque
import okhttp3.Headers
import okhttp3.internal.EMPTY_HEADERS
import okhttp3.internal.assertThreadDoesntHoldLock
@ -27,11 +32,6 @@ import okio.BufferedSource
import okio.Sink
import okio.Source
import okio.Timeout
import java.io.EOFException
import java.io.IOException
import java.io.InterruptedIOException
import java.net.SocketTimeoutException
import java.util.ArrayDeque
/** A logical bidirectional stream. */
@Suppress("NAME_SHADOWING")

View File

@ -15,6 +15,10 @@
*/
package okhttp3.internal.http2
import java.io.Closeable
import java.io.IOException
import java.util.logging.Level.FINE
import java.util.logging.Logger
import okhttp3.internal.format
import okhttp3.internal.http2.Http2.CONNECTION_PREFACE
import okhttp3.internal.http2.Http2.FLAG_ACK
@ -35,10 +39,6 @@ import okhttp3.internal.http2.Http2.frameLog
import okhttp3.internal.writeMedium
import okio.Buffer
import okio.BufferedSink
import java.io.Closeable
import java.io.IOException
import java.util.logging.Level.FINE
import java.util.logging.Logger
/** Writes HTTP/2 transport frames. */
@Suppress("NAME_SHADOWING")

View File

@ -15,11 +15,11 @@
*/
package okhttp3.internal.http2
import java.io.IOException
import okhttp3.internal.and
import okio.BufferedSink
import okio.BufferedSource
import okio.ByteString
import java.io.IOException
/**
* This class was originally composed from the following classes in

View File

@ -19,13 +19,13 @@
package okhttp3.internal
import javax.net.ssl.SSLSocket
import okhttp3.Cache
import okhttp3.ConnectionSpec
import okhttp3.Cookie
import okhttp3.Headers
import okhttp3.HttpUrl
import okhttp3.Request
import javax.net.ssl.SSLSocket
fun parseCookie(currentTimeMillis: Long, url: HttpUrl, setCookie: String): Cookie? =
Cookie.parse(currentTimeMillis, url, setCookie)

View File

@ -15,14 +15,14 @@
*/
package okhttp3.internal.io
import okio.Source
import okio.source
import okio.Sink
import okio.sink
import okio.appendingSink
import java.io.File
import java.io.FileNotFoundException
import java.io.IOException
import okio.Sink
import okio.Source
import okio.appendingSink
import okio.sink
import okio.source
/**
* Access to read and write files on a hierarchical data store. Most callers should use the

View File

@ -17,6 +17,9 @@ package okhttp3.internal.platform
import android.os.Build
import android.security.NetworkSecurityPolicy
import javax.net.ssl.SSLSocket
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.X509TrustManager
import okhttp3.Protocol
import okhttp3.internal.platform.AndroidPlatform.Companion.isAndroid
import okhttp3.internal.platform.android.Android10CertificateChainCleaner
@ -25,9 +28,6 @@ import okhttp3.internal.platform.android.ConscryptSocketAdapter
import okhttp3.internal.platform.android.DeferredSocketAdapter
import okhttp3.internal.platform.android.androidLog
import okhttp3.internal.tls.CertificateChainCleaner
import javax.net.ssl.SSLSocket
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.X509TrustManager
/** Android 29+. */
class Android10Platform : Platform() {

View File

@ -16,16 +16,6 @@
package okhttp3.internal.platform
import android.os.Build
import okhttp3.Protocol
import okhttp3.internal.platform.android.AndroidCertificateChainCleaner
import okhttp3.internal.platform.android.CloseGuard
import okhttp3.internal.platform.android.ConscryptSocketAdapter
import okhttp3.internal.platform.android.DeferredSocketAdapter
import okhttp3.internal.platform.android.StandardAndroidSocketAdapter
import okhttp3.internal.platform.android.androidLog
import okhttp3.internal.tls.BasicTrustRootIndex
import okhttp3.internal.tls.CertificateChainCleaner
import okhttp3.internal.tls.TrustRootIndex
import java.io.IOException
import java.lang.reflect.InvocationTargetException
import java.lang.reflect.Method
@ -36,6 +26,16 @@ import java.security.cert.X509Certificate
import javax.net.ssl.SSLSocket
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.X509TrustManager
import okhttp3.Protocol
import okhttp3.internal.platform.android.AndroidCertificateChainCleaner
import okhttp3.internal.platform.android.CloseGuard
import okhttp3.internal.platform.android.ConscryptSocketAdapter
import okhttp3.internal.platform.android.DeferredSocketAdapter
import okhttp3.internal.platform.android.StandardAndroidSocketAdapter
import okhttp3.internal.platform.android.androidLog
import okhttp3.internal.tls.BasicTrustRootIndex
import okhttp3.internal.tls.CertificateChainCleaner
import okhttp3.internal.tls.TrustRootIndex
/** Android 5+. */
class AndroidPlatform : Platform() {

View File

@ -15,14 +15,14 @@
*/
package okhttp3.internal.platform
import okhttp3.Protocol
import okhttp3.internal.readFieldOrNull
import org.conscrypt.Conscrypt
import java.security.Provider
import javax.net.ssl.SSLContext
import javax.net.ssl.SSLSocket
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.X509TrustManager
import okhttp3.Protocol
import okhttp3.internal.readFieldOrNull
import org.conscrypt.Conscrypt
/**
* Platform using Conscrypt (conscrypt.org) if installed as the first Security Provider.

View File

@ -15,12 +15,12 @@
*/
package okhttp3.internal.platform
import okhttp3.Protocol
import java.lang.reflect.InvocationHandler
import java.lang.reflect.InvocationTargetException
import java.lang.reflect.Method
import java.lang.reflect.Proxy
import javax.net.ssl.SSLSocket
import okhttp3.Protocol
/** OpenJDK 8 with `org.mortbay.jetty.alpn:alpn-boot` in the boot class path. */
class Jdk8WithJettyBootPlatform(

View File

@ -15,10 +15,10 @@
*/
package okhttp3.internal.platform
import okhttp3.Protocol
import javax.net.ssl.SSLSocket
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.X509TrustManager
import okhttp3.Protocol
/** OpenJDK 9+. */
open class Jdk9Platform : Platform() {

View File

@ -15,7 +15,6 @@
*/
package okhttp3.internal.platform
import okhttp3.Protocol
import java.security.KeyStore
import java.security.Provider
import javax.net.ssl.SSLContext
@ -23,6 +22,7 @@ import javax.net.ssl.SSLSocket
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.TrustManagerFactory
import javax.net.ssl.X509TrustManager
import okhttp3.Protocol
/**
* Platform using OpenJSSE (https://github.com/openjsse/openjsse) if installed as the first

View File

@ -16,14 +16,6 @@
*/
package okhttp3.internal.platform
import okhttp3.OkHttpClient
import okhttp3.Protocol
import okhttp3.internal.readFieldOrNull
import okhttp3.internal.tls.BasicCertificateChainCleaner
import okhttp3.internal.tls.BasicTrustRootIndex
import okhttp3.internal.tls.CertificateChainCleaner
import okhttp3.internal.tls.TrustRootIndex
import okio.Buffer
import java.io.IOException
import java.net.InetSocketAddress
import java.net.Socket
@ -36,6 +28,14 @@ import javax.net.ssl.SSLSocket
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.TrustManagerFactory
import javax.net.ssl.X509TrustManager
import okhttp3.OkHttpClient
import okhttp3.Protocol
import okhttp3.internal.readFieldOrNull
import okhttp3.internal.tls.BasicCertificateChainCleaner
import okhttp3.internal.tls.BasicTrustRootIndex
import okhttp3.internal.tls.CertificateChainCleaner
import okhttp3.internal.tls.TrustRootIndex
import okio.Buffer
/**
* Access to platform-specific features.

View File

@ -16,13 +16,13 @@
package okhttp3.internal.platform.android
import android.net.http.X509TrustManagerExtensions
import okhttp3.internal.tls.CertificateChainCleaner
import java.lang.IllegalArgumentException
import java.security.cert.Certificate
import java.security.cert.CertificateException
import java.security.cert.X509Certificate
import javax.net.ssl.SSLPeerUnverifiedException
import javax.net.ssl.X509TrustManager
import okhttp3.internal.tls.CertificateChainCleaner
/**
* Android Q+ implementation of CertificateChainCleaner using direct Android API calls.

View File

@ -17,12 +17,12 @@ package okhttp3.internal.platform.android
import android.net.SSLCertificateSocketFactory
import android.os.Build
import okhttp3.Protocol
import okhttp3.internal.platform.AndroidPlatform.Companion.isAndroid
import okhttp3.internal.platform.Platform
import javax.net.ssl.SSLSocket
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.X509TrustManager
import okhttp3.Protocol
import okhttp3.internal.platform.AndroidPlatform.Companion.isAndroid
import okhttp3.internal.platform.Platform
/**
* Simple non-reflection SocketAdapter for Android Q.

View File

@ -15,13 +15,13 @@
*/
package okhttp3.internal.platform.android
import okhttp3.internal.tls.CertificateChainCleaner
import java.lang.reflect.InvocationTargetException
import java.lang.reflect.Method
import java.security.cert.Certificate
import java.security.cert.X509Certificate
import javax.net.ssl.SSLPeerUnverifiedException
import javax.net.ssl.X509TrustManager
import okhttp3.internal.tls.CertificateChainCleaner
/**
* Legacy Android implementation of CertificateChainCleaner relying on reflection.

View File

@ -15,15 +15,15 @@
*/
package okhttp3.internal.platform.android
import okhttp3.Protocol
import okhttp3.internal.platform.AndroidPlatform
import okhttp3.internal.platform.Platform
import java.lang.reflect.InvocationTargetException
import java.lang.reflect.Method
import java.nio.charset.StandardCharsets
import javax.net.ssl.SSLSocket
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.X509TrustManager
import okhttp3.Protocol
import okhttp3.internal.platform.AndroidPlatform
import okhttp3.internal.platform.Platform
/**
* Modern reflection based SocketAdapter for Conscrypt class SSLSockets.

View File

@ -15,13 +15,13 @@
*/
package okhttp3.internal.platform.android
import javax.net.ssl.SSLSocket
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.X509TrustManager
import okhttp3.Protocol
import okhttp3.internal.platform.ConscryptPlatform
import okhttp3.internal.platform.Platform
import org.conscrypt.Conscrypt
import javax.net.ssl.SSLSocket
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.X509TrustManager
/**
* Simple non-reflection SocketAdapter for Conscrypt.

View File

@ -15,11 +15,11 @@
*/
package okhttp3.internal.platform.android
import okhttp3.Protocol
import okhttp3.internal.platform.Platform
import javax.net.ssl.SSLSocket
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.X509TrustManager
import okhttp3.Protocol
import okhttp3.internal.platform.Platform
/**
* Deferred implementation of SocketAdapter that can only work by observing the socket

Some files were not shown because too many files have changed in this diff Show More