p-hatan/ mirror

pub repository

mirror.p-hatan.ir

http_multi_server

2.2.0

A dart:io HttpServer wrapper that handles requests from multiple servers.

Download archive

Readme

An implementation of dart:io's HttpServer that wraps multiple servers and forwards methods to all of them. It's useful for serving the same application on multiple network interfaces while still having a unified way of controlling the servers. In particular, it supports serving on both the IPv4 and IPv6 loopback addresses using HttpMultiServer.loopback.

import 'package:http_multi_server/http_multi_server.dart';
import 'package:shelf/shelf.dart' as shelf;
import 'package:shelf/shelf_io.dart' as shelf_io;

void main() async {
  // Both http://127.0.0.1:8080 and http://[::1]:8080 will be bound to the same
  // server.
  var server = await HttpMultiServer.loopback(8080);
  shelf_io.serveRequests(server, (request) {
    return shelf.Response.ok("Hello, world!");
  });
}
Changelog

2.2.0

  • Preparation for HttpHeaders change. Update signature of MultiHeaders.add() and MultiHeaders.set() to match new signature of HttpHeaders. The parameter is not yet forwarded and will not behave as expected.

2.1.0

  • Add HttpMultiServer.bind static which centralizes logic around common local serving scenarios - handling a more flexible 'localhost' and listening on 'any' hostname.
  • Update SDK constraints to >=2.1.0 <3.0.0.

2.0.6

  • If there is a problem starting a loopback Ipv6 server, don't keep the Ipv4 server open when throwing the exception.

2.0.5

  • Update SDK constraints to >=2.0.0-dev <3.0.0.

2.0.4

  • Declare support for async 2.0.0.

2.0.3

  • Fix HttpMultiServer.loopback() and .loopbackSecure() for environments that don't support IPv4.

2.0.2

  • Fix a dependency that was incorrectly marked as dev-only.

2.0.1

  • Fix most strong mode errors and warnings.

2.0.0

  • Breaking: Change the signature of HttpMultiServer.loopbackSecure() to match the new Dart 1.13 HttpServer.bindSecure() signature. This removes the certificateName named parameter and adds the required context parameter and the named v6Only and shared parameters.

  • Added v6Only and shared parameters to HttpMultiServer.loopback() to match HttpServer.bind().

1.3.2

  • Eventually stop retrying port allocation if it fails repeatedly.

  • Properly detect socket errors caused by already-in-use addresses.

1.3.1

  • loopback() and loopbackSecure() recover gracefully if an ephemeral port is requested and the located port isn't available on both IPv4 and IPv6.

1.3.0

  • Add support for HttpServer.autoCompress.

1.2.0

  • Add support for HttpServer.defaultResponseHeaders.clear.

  • Fix HttpServer.defaultResponseHeaders.remove and .removeAll.

1.1.0

  • Add support for HttpServer.defaultResponseHeaders.

1.0.2

1.0.1

  • Ignore errors from one of the servers if others are still bound. In particular, this works around issue 19815 on some Windows machines where IPv6 failure isn't discovered until we try to connect to the socket.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add http_multi_server
pubspec.yaml
name: http_multi_server
version: 2.2.0

description: >-
  A dart:io HttpServer wrapper that handles requests from multiple servers.
homepage: https://github.com/dart-lang/http_multi_server

environment:
  sdk: '>=2.1.1 <3.0.0'

dependencies:
  async: '>=1.2.0 <3.0.0'

dev_dependencies:
  http: ^0.12.0
  pedantic: ^1.8.0
  test: ^1.5.2

Version history

VersionPublishedArchiveSHA-256
1.0.02014-06-05T00:44:24.680320ZDownloadac3d3489be922a8d3a6eb35ae340d1dc33edd2ade69f388467cb5c128de3e523
1.0.12014-07-24T01:43:07.790940ZDownload1d51e9872300c66a26555484478feda13953e22f3a909aa1646e8fa346205d3f
1.1.02014-08-14T00:43:40.284200ZDownload49147538e5688a0188ba32b70032ca5ce8a0a302dcc118025327da9b9c589e86
1.2.02014-08-14T01:26:35.333710ZDownloadac5729842d1f11529870e20f91cc3ae099218fd4055d488cc193c0b58a5dd990
1.3.02014-09-23T22:01:46.893480ZDownloadda5739ebfd9db3382d06601507609f106c708868ab719218945bb93ecc3fe9e9
1.3.0+12014-09-24T00:52:03.619630ZDownloadbb0e759c3d7950a2cd0f1fd3a3630ca43635e042f7945c02c2fe0c9f80560bf5
1.3.12015-03-09T22:04:43.456140ZDownload7e95c8f788b19cddf79f155f9e6c1685cc23bcb30cb1fbc88dc02fcff1bc135b
1.3.22015-03-10T19:44:35.246270ZDownload62ec3e225b64802412663f13c675b6d1f5eb8f00237b46ddc1bbaec42fc9eafe
2.0.02015-12-09T00:53:17.827ZDownloadf41a6974ed4ed129fdca3a5aac3a3814be0576007bbdc6824c533c58206de5b8
2.0.12016-04-01T00:12:55.220ZDownload3205a77bebf411a548e07569ceff405b9b325a1546140a9cfa88aa8e482e4e89
2.0.22016-06-20T21:21:15.866ZDownload968271c0859af1af6782e4a94370fc6f0659fffcc66a728fcc7ae18ad5a95f92
2.0.32016-10-25T21:14:44.078ZDownload3f68607027cce2bc531ae66b0bbdae89aea82361f4f2fcaa42fb5f9644ce0113
2.0.42017-09-22T20:43:30.021279ZDownload4e6f3886e05c853583c0d38d229f4a93fe7a444628d50bce409a242956003108
2.0.52018-06-01T17:15:04.474545ZDownload795abe4073b3dd82761d09d81e465a8cc2abd7299a223e8fd0ef8a3fbb20505e
2.0.62019-04-25T19:45:26.888914ZDownloadf9a41fada88ed9535007c3d2419996a6ccf0fdfc5a560f93ace69ad476e2a662
2.1.02019-06-04T21:51:46.615623ZDownloade4eb93a4ad33e86d52e097c07a023c3091cad5d097ba01627450701ae64d6252
2.2.02020-01-31T18:53:02.040410ZDownload90daef58b775dc37bc409f4053763503f6544f6af7c910d2c2a7f1946554e5e5
3.0.02021-02-25T22:09:37.000463ZDownloadac10cae1b9a06fb638a92a72b00570bac856f524f7ee0d9a13eaed4960c7fd43
3.0.12021-04-12T22:47:58.077126ZDownloadbfb651625e251a88804ad6d596af01ea903544757906addcb2dcdf088b5ea185
3.2.02022-02-10T20:10:12.621393ZDownloadab298ef2b2acd283bd36837df7801dcf6e6b925f8da6e09efb81111230aa9037
3.2.12022-06-15T20:51:11.594942ZDownload97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b
3.2.22024-12-17T12:50:20.600442ZDownloadaa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8
3.2.32026-10-21T00:13:10.434498ZDownload361668bdd71f0ae2dc6d17b75a593520f3c414af6534f9eed1aa72049dd71d18

Dependencies

async "\u003e=1.2.0 \u003c3.0.0"