61
This commit is contained in:
parent
6da3be08fd
commit
4b4149dea9
5 changed files with 13 additions and 9 deletions
|
@ -1,6 +1,6 @@
|
||||||
# angel_framework
|
# angel_framework
|
||||||
|
|
||||||
[![pub 1.0.0-dev.60](https://img.shields.io/badge/pub-1.0.0--dev.60-red.svg)](https://pub.dartlang.org/packages/angel_framework)
|
[![pub 1.0.0-dev.61](https://img.shields.io/badge/pub-1.0.0--dev.61-red.svg)](https://pub.dartlang.org/packages/angel_framework)
|
||||||
[![build status](https://travis-ci.org/angel-dart/framework.svg)](https://travis-ci.org/angel-dart/framework)
|
[![build status](https://travis-ci.org/angel-dart/framework.svg)](https://travis-ci.org/angel-dart/framework)
|
||||||
|
|
||||||
Core libraries for the Angel Framework.
|
Core libraries for the Angel Framework.
|
||||||
|
|
|
@ -4,7 +4,7 @@ import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:angel_route/src/extensible.dart';
|
import 'package:angel_route/src/extensible.dart';
|
||||||
import 'package:body_parser/body_parser.dart';
|
import 'package:body_parser/body_parser.dart';
|
||||||
import 'angel_base.dart';
|
import 'server.dart' show Angel;
|
||||||
|
|
||||||
/// A convenience wrapper around an incoming HTTP request.
|
/// A convenience wrapper around an incoming HTTP request.
|
||||||
class RequestContext extends Extensible {
|
class RequestContext extends Extensible {
|
||||||
|
@ -17,7 +17,7 @@ class RequestContext extends Extensible {
|
||||||
final Map serviceParams = {};
|
final Map serviceParams = {};
|
||||||
|
|
||||||
/// The [Angel] instance that is responding to this request.
|
/// The [Angel] instance that is responding to this request.
|
||||||
AngelBase app;
|
Angel app;
|
||||||
|
|
||||||
/// Any cookies sent with this request.
|
/// Any cookies sent with this request.
|
||||||
List<Cookie> get cookies => io.cookies;
|
List<Cookie> get cookies => io.cookies;
|
||||||
|
@ -82,7 +82,7 @@ class RequestContext extends Extensible {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Magically transforms an [HttpRequest] into a [RequestContext].
|
/// Magically transforms an [HttpRequest] into a [RequestContext].
|
||||||
static Future<RequestContext> from(HttpRequest request, AngelBase app) async {
|
static Future<RequestContext> from(HttpRequest request, Angel app) async {
|
||||||
RequestContext ctx = new RequestContext();
|
RequestContext ctx = new RequestContext();
|
||||||
|
|
||||||
ctx.app = app;
|
ctx.app = app;
|
||||||
|
|
|
@ -7,7 +7,7 @@ import 'package:angel_route/angel_route.dart';
|
||||||
import 'package:json_god/json_god.dart' as god;
|
import 'package:json_god/json_god.dart' as god;
|
||||||
import 'package:mime/mime.dart';
|
import 'package:mime/mime.dart';
|
||||||
import '../extensible.dart';
|
import '../extensible.dart';
|
||||||
import 'angel_base.dart';
|
import 'server.dart' show Angel;
|
||||||
import 'controller.dart';
|
import 'controller.dart';
|
||||||
|
|
||||||
final RegExp _contentType =
|
final RegExp _contentType =
|
||||||
|
@ -23,7 +23,7 @@ class ResponseContext extends Extensible {
|
||||||
bool _isOpen = true;
|
bool _isOpen = true;
|
||||||
|
|
||||||
/// The [Angel] instance that is sending a response.
|
/// The [Angel] instance that is sending a response.
|
||||||
AngelBase app;
|
Angel app;
|
||||||
|
|
||||||
/// Is `Transfer-Encoding` chunked?
|
/// Is `Transfer-Encoding` chunked?
|
||||||
bool chunked;
|
bool chunked;
|
||||||
|
|
|
@ -121,7 +121,11 @@ class Angel extends AngelBase {
|
||||||
Future<HttpServer> startServer([InternetAddress address, int port]) async {
|
Future<HttpServer> startServer([InternetAddress address, int port]) async {
|
||||||
var host = address ?? InternetAddress.LOOPBACK_IP_V4;
|
var host = address ?? InternetAddress.LOOPBACK_IP_V4;
|
||||||
this.httpServer = await _serverGenerator(host, port ?? 0);
|
this.httpServer = await _serverGenerator(host, port ?? 0);
|
||||||
await Future.wait(justBeforeStart.map(configure));
|
|
||||||
|
for (var configurer in justBeforeStart) {
|
||||||
|
await configure(configurer);
|
||||||
|
}
|
||||||
|
|
||||||
preprocessRoutes();
|
preprocessRoutes();
|
||||||
return httpServer..listen(handleRequest);
|
return httpServer..listen(handleRequest);
|
||||||
}
|
}
|
||||||
|
@ -480,7 +484,7 @@ class Angel extends AngelBase {
|
||||||
Platform.script.resolve(certificateChainPath).toFilePath();
|
Platform.script.resolve(certificateChainPath).toFilePath();
|
||||||
var serverKey = Platform.script.resolve(serverKeyPath).toFilePath();
|
var serverKey = Platform.script.resolve(serverKeyPath).toFilePath();
|
||||||
var serverContext = new SecurityContext();
|
var serverContext = new SecurityContext();
|
||||||
serverContext.useCertificateChain(certificateChain);
|
serverContext.useCertificateChain(certificateChain, password: password);
|
||||||
serverContext.usePrivateKey(serverKey, password: password);
|
serverContext.usePrivateKey(serverKey, password: password);
|
||||||
|
|
||||||
return new Angel.fromSecurityContext(serverContext);
|
return new Angel.fromSecurityContext(serverContext);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: angel_framework
|
name: angel_framework
|
||||||
version: 1.0.0-dev.60
|
version: 1.0.0-dev.61
|
||||||
description: Core libraries for the Angel framework.
|
description: Core libraries for the Angel framework.
|
||||||
author: Tobe O <thosakwe@gmail.com>
|
author: Tobe O <thosakwe@gmail.com>
|
||||||
homepage: https://github.com/angel-dart/angel_framework
|
homepage: https://github.com/angel-dart/angel_framework
|
||||||
|
|
Loading…
Reference in a new issue