-
Notifications
You must be signed in to change notification settings - Fork 9.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a socket abstraction #8410
base: master
Are you sure you want to change the base?
Add a socket abstraction #8410
Changes from 1 commit
c6bc4ac
9dd5a2f
ffdb6f0
db0cd0c
7526606
ef360f4
4b84b8f
d1f862e
37f5924
7266ab7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,7 +107,7 @@ public final class mockwebserver3/MockWebServer : java/io/Closeable { | |
public final fun getProtocolNegotiationEnabled ()Z | ||
public final fun getProtocols ()Ljava/util/List; | ||
public final fun getRequestCount ()I | ||
public final fun getServerSocketFactory ()Ljavax/net/ServerSocketFactory; | ||
public final fun getServerSocketFactory ()Lokhttp3/internal/socket/OkioServerSocketFactory; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do we feel about breaking changes to MockWebServer public methods? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changing this new mockwebserver seems fine, we should avoid changes to okhttp3/mockwebserver/* in the deprecated package. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But I guess these APIs in the non deprecated API become experimental APIs, is that ok? |
||
public final fun getStarted ()Z | ||
public final fun noClientAuth ()V | ||
public final fun requestClientAuth ()V | ||
|
@@ -116,7 +116,7 @@ public final class mockwebserver3/MockWebServer : java/io/Closeable { | |
public final fun setDispatcher (Lmockwebserver3/Dispatcher;)V | ||
public final fun setProtocolNegotiationEnabled (Z)V | ||
public final fun setProtocols (Ljava/util/List;)V | ||
public final fun setServerSocketFactory (Ljavax/net/ServerSocketFactory;)V | ||
public final fun setServerSocketFactory (Lokhttp3/internal/socket/OkioServerSocketFactory;)V | ||
public final fun setStarted (Z)V | ||
public final fun shutdown ()V | ||
public final fun start ()V | ||
|
@@ -159,8 +159,8 @@ public final class mockwebserver3/QueueDispatcher$Companion { | |
} | ||
|
||
public final class mockwebserver3/RecordedRequest { | ||
public fun <init> (Ljava/lang/String;Lokhttp3/Headers;Ljava/util/List;JLokio/Buffer;ILjava/net/Socket;Ljava/io/IOException;)V | ||
public synthetic fun <init> (Ljava/lang/String;Lokhttp3/Headers;Ljava/util/List;JLokio/Buffer;ILjava/net/Socket;Ljava/io/IOException;ILkotlin/jvm/internal/DefaultConstructorMarker;)V | ||
public fun <init> (Ljava/lang/String;Lokhttp3/Headers;Ljava/util/List;JLokio/Buffer;ILokhttp3/internal/socket/OkioSocket;Ljava/io/IOException;)V | ||
public synthetic fun <init> (Ljava/lang/String;Lokhttp3/Headers;Ljava/util/List;JLokio/Buffer;ILokhttp3/internal/socket/OkioSocket;Ljava/io/IOException;ILkotlin/jvm/internal/DefaultConstructorMarker;)V | ||
public final fun getBody ()Lokio/Buffer; | ||
public final fun getBodySize ()J | ||
public final fun getChunkSizes ()Ljava/util/List; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -409,6 +409,7 @@ public final class okhttp3/ConnectionSpec { | |
public fun equals (Ljava/lang/Object;)Z | ||
public fun hashCode ()I | ||
public final fun isCompatible (Ljavax/net/ssl/SSLSocket;)Z | ||
public final fun isCompatible (Lokhttp3/internal/socket/OkioSslSocket;)Z | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: I tossed a |
||
public final fun isTls ()Z | ||
public final fun supportsTlsExtensions ()Z | ||
public final fun tlsVersions ()Ljava/util/List; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2014 Square, Inc. | ||
* Copyright (C) 2024 Square, Inc. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. deliberate? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, that's weird. I set up automatic file headers in IJ, it must have decided to update some existing files sometimes... 🤔 Anyway, will revert |
||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
|
@@ -168,10 +168,22 @@ class ConnectionSpec internal constructor( | |
* For protocols, at least one of the [required protocols][tlsVersions] must match the socket's | ||
* enabled protocols. | ||
*/ | ||
@ExperimentalOkHttpApi | ||
fun isCompatible(socket: OkioSslSocket): Boolean { | ||
return isCompatible((socket as RealOkioSslSocket).delegate) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. worth a TODO? feels like something we may want supported in the API in future. |
||
} | ||
|
||
/** | ||
* Returns `true` if the socket, as currently configured, supports this connection spec. In | ||
* order for a socket to be compatible the enabled cipher suites and protocols must intersect. | ||
* | ||
* For cipher suites, at least one of the [required cipher suites][cipherSuites] must match the | ||
* socket's enabled cipher suites. If there are no required cipher suites the socket must have at | ||
* least one cipher suite enabled. | ||
* | ||
* For protocols, at least one of the [required protocols][tlsVersions] must match the socket's | ||
* enabled protocols. | ||
*/ | ||
fun isCompatible(socket: SSLSocket): Boolean { | ||
if (!isTls) { | ||
return false | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we hide this in this deprecated API, keep it still in terms of javax.net?