IoServerAdapter class

ServerAdapter of the dart:io HttpServer of the Dart SDK (BuiltInServer.ioHttpServer), and of a CustomServer of any other server with the dart:io API (not native, no AdaptedServer): only the plain dart:io calls.

bind opens a dart:io server with the settings of AppConfig that dart:io has: tls, compress and idleTimeout. dart:io has no HTTP/2, so http2 stops the start. Dox still checks maxBodySize and maxMultipartSize when it reads a body. maxConnections, bodyTimeout, minBodyRate, minBodyRateGrace, compressLevel, maxConcurrentStreams, tlsHandshakesPerTick and fileThreads do nothing.

What dart:io can not do, so Dox does not do it on such a server:

  • maxMessageSize of a WebSocket: dart:io has no limit.
  • reloadCertificate(): a running dart:io server keeps its certificate. Restart the app.
  • Files: Dart reads them and sends the bytes.
  • Such a server of a CustomServer does not tell if it speaks HTTPS, so Dox treats it as plain HTTP (req.scheme() is http, except through a trusted proxy).
Inheritance
Implementers

Constructors

IoServerAdapter()
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
needsReusePort → bool
True when each isolate binds its own listener on the port, with SO_REUSEPORT. Windows has none: there one isolate serves. False: the isolates of the process share one listener.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addFile(HttpResponse res, String path, int start, int length) → Future<void>?
Sends length bytes of the file at path from start as the body of res. null when the server can not do it: Dart streams the file.
override
answerStarted(HttpResponse res) → bool
a closed dart:io response has sent its head too
override
bind(int port, Object? address, ServerSettings settings) → Future<HttpServer>
A server on port with settings.
override
checkTls(ServerTls tls) → void
Throws a TlsException when the files of tls are bad.
override
closeGracefully(HttpServer server) → Future<void>
The close() of dart:io does not wait for the open requests: it waits here, until no connection has a request. WebSockets get 1001.
override
end(HttpResponse res) → void
sends res with no Future; another response is closed
override
ensureAvailable() → void
Throws when the server can not run here, with the reason.
override
fixedHeaders(HttpHeaders headers) → bool
true when headers are request headers of the server: they can not change
override
grpcStream(HttpRequest req) → GrpcStream?
The gRPC call of req, a request of the server. null when the server has no gRPC (eg. no HTTP/2): dox_grpc answers 505.
inherited
headSent(HttpResponse res) → bool
dart:io does not tell, but its statusCode setter throws a StateError once the head is out. Only the error path asks.
override
heldBody(HttpRequest req) → Uint8List?
the whole body when the server holds it already, else null: it streams
override
isTls(HttpServer server) → bool
true when server speaks HTTPS
override
isWebSocketUpgrade(HttpRequest req) → bool
true when req asks for a WebSocket upgrade
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openFile(HttpRequest req, List<String> paths, String folder) → FutureOr<ServerFile?>
Opens the first of paths[1..] that is there, else paths[0]. null when paths[0] is not there (or no regular file), a FileSystemException when it can not be opened. Needs owns.
override
owns(HttpResponse res) → bool
True when res is a response of the server: it copies the body when it ends (see takeBody) and sends files itself (see openFile).
override
path(HttpRequest req) → String
The path of req, with no query. The same as req.uri.path, with no Uri made.
override
plainQuery(HttpRequest req) → String?
the query text of a plain target, else null: read uri.query
override
readBody(HttpRequest req, int max) → Future<Uint8List>?
The whole body of req when the server reads it with no Dart stream, else null: Dox reads the stream. For a body over max bytes, give null: Dox reads the stream and answers 413.
override
reloadCertificate(HttpServer server) → Future<void>
reads the certificate files of server again
override
scheme(HttpRequest req) → String?
https or http for a port that bind opened in this isolate, from the local port of the connection. null for a request of another server (eg. a CustomServer).
override
takeBody(HttpResponse res) → void
lets go of the body of res, after it ended. Needs owns.
override
tlsFiles(HttpServer server) → ServerTls?
the TLS files of server, else null
override
toString() → String
A string representation of this object.
inherited
trailers(HttpResponse res) → HttpHeaders?
The trailers of res: they go out after the body on HTTP/2, and are dropped on HTTP/1.1. null when the server sends no trailers.
inherited
upgradeWebSocket(HttpRequest req, String? protocol, int maxMessageSize) → Future<WebSocket>
accepts the WebSocket upgrade of req
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited