Skip to content

Commit b05c612

Browse files
gscatgscat
authored andcommitted
finalize cadente; prepare v1.6
1 parent 75a4eac commit b05c612

File tree

6 files changed

+43
-12
lines changed

6 files changed

+43
-12
lines changed

cadente/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ The current status of the implementation is:
5050
| Base HTTP/1.1 Reader | ✅ OK | |
5151
| HTTPS/SSL | ✅ OK | |
5252
| Chunked-transfers responses | ✅ OK | |
53-
| Chunked-transfers requests | ❌ Not implemented | |
53+
| Chunked-transfers requests | ✅ OK | |
5454
| Handle Expect-100 | ✅ OK | |
5555
| Compressed transfer encoding (gzip, brotli, etc) | ✅ OK/External | |
5656
| SSE/Response content streaming | ✅ OK/External | |

cadente/Sisk.Cadente.CoreEngine/Sisk.Cadente.CoreEngine.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@
4545

4646
<!-- version info -->
4747
<PropertyGroup>
48-
<AssemblyVersion>0.1.325</AssemblyVersion>
49-
<FileVersion>0.1.325</FileVersion>
50-
<Version>0.1.325-alpha7</Version>
48+
<AssemblyVersion>1.6.0</AssemblyVersion>
49+
<FileVersion>1.6.0</FileVersion>
50+
<Version>1.6.0-beta1</Version>
5151
</PropertyGroup>
5252

5353
<!-- licensing, readme, signing -->

cadente/Sisk.Cadente/HttpConnection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public HttpConnection ( HttpHostClient client, Stream connectionStream, HttpHost
3737
_endpoint = endpoint;
3838
}
3939

40-
public async Task<HttpConnectionState> HandleConnectionEvents () {
40+
public async Task<HttpConnectionState> HandleConnectionEventsAsync () {
4141
bool connectionCloseRequested = false;
4242

4343
while (_connectionStream.CanRead && !disposedValue) {

cadente/Sisk.Cadente/HttpHost.cs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
// File name: HttpHost.cs
88
// Repository: https://github.com/sisk-http/core
99

10+
using System.ComponentModel;
1011
using System.Net;
1112
using System.Net.Security;
1213
using System.Net.Sockets;
1314
using System.Runtime.CompilerServices;
15+
using System.Text;
1416

1517
namespace Sisk.Cadente;
1618

@@ -125,6 +127,32 @@ private async void ReceiveClient ( IAsyncResult result ) {
125127
await HandleTcpClient ( client );
126128
}
127129

130+
private byte[] GetBadRequestMessage ( string message ) {
131+
string content = $"""
132+
<HTML>
133+
<HEAD>
134+
<TITLE>400 - Bad Request</TITLE>
135+
</HEAD>
136+
<BODY>
137+
<H1>400 - Bad Request</H1>
138+
<P>{message}</P>
139+
<HR>
140+
<P><EM>Cadente</EM></P>
141+
</BODY>
142+
</HTML>
143+
""";
144+
145+
string html =
146+
$"HTTP/1.1 400 Bad Request\r\n" +
147+
$"Content-Type: text/html\r\n" +
148+
$"Content-Length: {content.Length}\r\n" +
149+
$"Connection: close\r\n" +
150+
$"\r\n" +
151+
content;
152+
153+
return Encoding.ASCII.GetBytes ( html );
154+
}
155+
128156
private async Task HandleTcpClient ( TcpClient client ) {
129157

130158
try {
@@ -166,12 +194,15 @@ await sslStream.AuthenticateAsServerAsync (
166194
hostClient.ClientCertificate = sslStream.RemoteCertificate;
167195
}
168196
catch (Exception) {
197+
198+
var message = GetBadRequestMessage ( "SSL/TLS Handshake failed." );
199+
await clientStream.WriteAsync ( message, 0, message.Length );
169200
return;
170201
}
171202
}
172203

173204
await Handler.OnClientConnectedAsync ( this, hostClient );
174-
await connection.HandleConnectionEvents ();
205+
await connection.HandleConnectionEventsAsync ();
175206
await Handler.OnClientDisconnectedAsync ( this, hostClient );
176207
}
177208
}

cadente/Sisk.Cadente/Sisk.Cadente.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@
4545

4646
<!-- version info -->
4747
<PropertyGroup>
48-
<AssemblyVersion>0.1.325</AssemblyVersion>
49-
<FileVersion>0.1.325</FileVersion>
50-
<Version>0.1.325-alpha7</Version>
48+
<AssemblyVersion>1.0</AssemblyVersion>
49+
<FileVersion>1.0</FileVersion>
50+
<Version>1.0-beta1</Version>
5151
</PropertyGroup>
5252

5353
<!-- licensing, readme, signing -->

src/Sisk.Core.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@
4747

4848
<!-- version info -->
4949
<PropertyGroup>
50-
<AssemblyVersion>1.5.2</AssemblyVersion>
51-
<FileVersion>1.5.2</FileVersion>
52-
<Version>1.5.2</Version>
50+
<AssemblyVersion>1.6.0</AssemblyVersion>
51+
<FileVersion>1.6.0</FileVersion>
52+
<Version>1.6.0-beta1</Version>
5353
</PropertyGroup>
5454

5555
<!-- licensing, readme, signing -->

0 commit comments

Comments
 (0)