NIO+Multithreaded TCPSocket listener, very low cpu utilisation
kdevel
kdevel at vogtner.de
Tue Nov 14 21:02:10 UTC 2017
On Tuesday, 14 November 2017 at 19:57:54 UTC, ade90036 wrote:
> socket.send("HTTP/1.1 200 OK
> Server:
> dland:v2.076.1
> Date: Tue, 11
> Nov 2017 15:56:02 GMT
> Content-Type:
> text/plain; charset=UTF-8
> Content-Length:
> 32
>
>
> <html><head></head><body>Hello World!</body></html>");
> }
Some cosmetic changes: It is possible, that your HTTP client gets
confused by the data sent?
```
socket.send("HTTP/1.1 200 OK
Server: dland:v2.076.1
Date: Tue, 11 Nov 2017 15:56:02 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 51
<html><head></head><body>Hello World!</body></html>".to_retlf);
string to_retlf (string s)
{
import std.algorithm;
import std.string;
return s
.lineSplitter
.map!(a => chomp (a))
.join ("\r\n");
}
```
The Content-Length given is too short. The Content-Type also was
wrong.
More information about the Digitalmars-d-learn
mailing list