mirror of https://github.com/adamdruppe/arsd.git
new????
This commit is contained in:
parent
80815cd04e
commit
033d88dfa6
8
http2.d
8
http2.d
|
@ -535,16 +535,20 @@ class HttpRequest {
|
||||||
|
|
||||||
switch(name) {
|
switch(name) {
|
||||||
case "Connection":
|
case "Connection":
|
||||||
|
case "connection":
|
||||||
if(value == "close")
|
if(value == "close")
|
||||||
closeSocketWhenComplete = true;
|
closeSocketWhenComplete = true;
|
||||||
break;
|
break;
|
||||||
case "Content-Type":
|
case "Content-Type":
|
||||||
|
case "content-type":
|
||||||
responseData.contentType = value;
|
responseData.contentType = value;
|
||||||
break;
|
break;
|
||||||
case "Content-Length":
|
case "Content-Length":
|
||||||
|
case "content-length":
|
||||||
bodyReadingState.contentLengthRemaining = to!int(value);
|
bodyReadingState.contentLengthRemaining = to!int(value);
|
||||||
break;
|
break;
|
||||||
case "Transfer-Encoding":
|
case "Transfer-Encoding":
|
||||||
|
case "transfer-encoding":
|
||||||
// note that if it is gzipped, it zips first, then chunks the compressed stream.
|
// note that if it is gzipped, it zips first, then chunks the compressed stream.
|
||||||
// so we should always dechunk first, then feed into the decompressor
|
// so we should always dechunk first, then feed into the decompressor
|
||||||
if(value.strip == "chunked")
|
if(value.strip == "chunked")
|
||||||
|
@ -552,6 +556,7 @@ class HttpRequest {
|
||||||
else throw new Exception("Unknown Transfer-Encoding: " ~ value);
|
else throw new Exception("Unknown Transfer-Encoding: " ~ value);
|
||||||
break;
|
break;
|
||||||
case "Content-Encoding":
|
case "Content-Encoding":
|
||||||
|
case "content-encoding":
|
||||||
if(value == "gzip") {
|
if(value == "gzip") {
|
||||||
bodyReadingState.isGzipped = true;
|
bodyReadingState.isGzipped = true;
|
||||||
uncompress = new UnCompress();
|
uncompress = new UnCompress();
|
||||||
|
@ -561,6 +566,7 @@ class HttpRequest {
|
||||||
} else throw new Exception("Unknown Content-Encoding: " ~ value);
|
} else throw new Exception("Unknown Content-Encoding: " ~ value);
|
||||||
break;
|
break;
|
||||||
case "Set-Cookie":
|
case "Set-Cookie":
|
||||||
|
case "set-cookie":
|
||||||
// FIXME handle
|
// FIXME handle
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -713,7 +719,7 @@ class HttpRequest {
|
||||||
// responseData.content ~= cast(ubyte[]) uncompress.uncompress(data);
|
// responseData.content ~= cast(ubyte[]) uncompress.uncompress(data);
|
||||||
//else
|
//else
|
||||||
responseData.content ~= data;
|
responseData.content ~= data;
|
||||||
assert(data.length <= bodyReadingState.contentLengthRemaining);
|
assert(data.length <= bodyReadingState.contentLengthRemaining, format("%d <= %d\n%s", data.length, bodyReadingState.contentLengthRemaining, cast(string)data));
|
||||||
bodyReadingState.contentLengthRemaining -= data.length;
|
bodyReadingState.contentLengthRemaining -= data.length;
|
||||||
if(bodyReadingState.contentLengthRemaining == 0) {
|
if(bodyReadingState.contentLengthRemaining == 0) {
|
||||||
if(bodyReadingState.isGzipped || bodyReadingState.isDeflated) {
|
if(bodyReadingState.isGzipped || bodyReadingState.isDeflated) {
|
||||||
|
|
|
@ -168,7 +168,7 @@ version(linux) {
|
||||||
js_event event;
|
js_event event;
|
||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
int r = read(fd, &event, event.sizeof);
|
auto r = read(fd, &event, event.sizeof);
|
||||||
if(r == -1) {
|
if(r == -1) {
|
||||||
import core.stdc.errno;
|
import core.stdc.errno;
|
||||||
if(errno == EAGAIN || errno == EWOULDBLOCK)
|
if(errno == EAGAIN || errno == EWOULDBLOCK)
|
||||||
|
@ -177,7 +177,7 @@ version(linux) {
|
||||||
}
|
}
|
||||||
assert(r == event.sizeof);
|
assert(r == event.sizeof);
|
||||||
|
|
||||||
int player = -1;
|
ptrdiff_t player = -1;
|
||||||
foreach(i, f; joystickFds)
|
foreach(i, f; joystickFds)
|
||||||
if(f == fd) {
|
if(f == fd) {
|
||||||
player = i;
|
player = i;
|
||||||
|
@ -306,7 +306,7 @@ int enableJoystickInput(
|
||||||
return 4;
|
return 4;
|
||||||
} else static assert(0, "Unsupported OS");
|
} else static assert(0, "Unsupported OS");
|
||||||
|
|
||||||
return 0;
|
// return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void closeJoysticks() {
|
void closeJoysticks() {
|
||||||
|
|
|
@ -8773,7 +8773,9 @@ enum _NET_WM_STATE_TOGGLE = 2;
|
||||||
/// X-specific
|
/// X-specific
|
||||||
void demandAttention(SimpleWindow window, bool needs = true) {
|
void demandAttention(SimpleWindow window, bool needs = true) {
|
||||||
auto display = XDisplayConnection.get();
|
auto display = XDisplayConnection.get();
|
||||||
auto atom = GetAtom!"_NET_WM_STATE_DEMANDS_ATTENTION"(display);
|
auto atom = XInternAtom(display, "_NET_WM_STATE_DEMANDS_ATTENTION", true);
|
||||||
|
if(atom == None)
|
||||||
|
return; // non-failure error
|
||||||
//auto atom2 = GetAtom!"_NET_WM_STATE_SHADED"(display);
|
//auto atom2 = GetAtom!"_NET_WM_STATE_SHADED"(display);
|
||||||
|
|
||||||
XClientMessageEvent xclient;
|
XClientMessageEvent xclient;
|
||||||
|
|
26
sslsocket.d
26
sslsocket.d
|
@ -14,6 +14,7 @@
|
||||||
btw, interesting:
|
btw, interesting:
|
||||||
http://msdn.microsoft.com/en-us/library/windows/desktop/aa364510%28v=vs.85%29.aspx
|
http://msdn.microsoft.com/en-us/library/windows/desktop/aa364510%28v=vs.85%29.aspx
|
||||||
*/
|
*/
|
||||||
|
module sslsocket;
|
||||||
|
|
||||||
|
|
||||||
public import std.socket;
|
public import std.socket;
|
||||||
|
@ -82,6 +83,10 @@ version(use_openssl) {
|
||||||
SSL_set_fd(ssl, this.handle);
|
SSL_set_fd(ssl, this.handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool dataPending() {
|
||||||
|
return SSL_pending(ssl) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
@trusted
|
@trusted
|
||||||
override void connect(Address to) {
|
override void connect(Address to) {
|
||||||
super.connect(to);
|
super.connect(to);
|
||||||
|
@ -96,14 +101,31 @@ version(use_openssl) {
|
||||||
|
|
||||||
@trusted
|
@trusted
|
||||||
override ptrdiff_t send(const(void)[] buf, SocketFlags flags) {
|
override ptrdiff_t send(const(void)[] buf, SocketFlags flags) {
|
||||||
return SSL_write(ssl, buf.ptr, cast(uint) buf.length);
|
auto retval = SSL_write(ssl, buf.ptr, cast(uint) buf.length);
|
||||||
|
if(retval == -1) {
|
||||||
|
ERR_print_errors_fp(stderr);
|
||||||
|
int i;
|
||||||
|
printf("wtf\n");
|
||||||
|
scanf("%d\n", i);
|
||||||
|
throw new Exception("ssl send");
|
||||||
|
}
|
||||||
|
return retval;
|
||||||
|
|
||||||
}
|
}
|
||||||
override ptrdiff_t send(const(void)[] buf) {
|
override ptrdiff_t send(const(void)[] buf) {
|
||||||
return send(buf, SocketFlags.NONE);
|
return send(buf, SocketFlags.NONE);
|
||||||
}
|
}
|
||||||
@trusted
|
@trusted
|
||||||
override ptrdiff_t receive(void[] buf, SocketFlags flags) {
|
override ptrdiff_t receive(void[] buf, SocketFlags flags) {
|
||||||
return SSL_read(ssl, buf.ptr, cast(int)buf.length);
|
auto retval = SSL_read(ssl, buf.ptr, cast(int)buf.length);
|
||||||
|
if(retval == -1) {
|
||||||
|
ERR_print_errors_fp(stderr);
|
||||||
|
int i;
|
||||||
|
printf("wtf\n");
|
||||||
|
scanf("%d\n", i);
|
||||||
|
throw new Exception("ssl send");
|
||||||
|
}
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
override ptrdiff_t receive(void[] buf) {
|
override ptrdiff_t receive(void[] buf) {
|
||||||
return receive(buf, SocketFlags.NONE);
|
return receive(buf, SocketFlags.NONE);
|
||||||
|
|
Loading…
Reference in New Issue