mirror of https://github.com/adamdruppe/arsd.git
64 bit etc
This commit is contained in:
parent
556a288b8c
commit
c91583cc85
36
cgi.d
36
cgi.d
|
@ -1660,7 +1660,7 @@ mixin template GenericMain(alias fun, T...) {
|
||||||
mixin CustomCgiMain!(Cgi, fun, T);
|
mixin CustomCgiMain!(Cgi, fun, T);
|
||||||
}
|
}
|
||||||
|
|
||||||
string simpleHtmlEncode(string s) {
|
private string simpleHtmlEncode(string s) {
|
||||||
return s.replace("&", "&").replace("<", "<").replace(">", ">").replace("\n", "<br />\n");
|
return s.replace("&", "&").replace("<", "<").replace(">", ">").replace("\n", "<br />\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1693,7 +1693,7 @@ bool handleException(Cgi cgi, Throwable t) {
|
||||||
|
|
||||||
if(cgi.outputtedResponseData) {
|
if(cgi.outputtedResponseData) {
|
||||||
// the headers are sent, but the channel is open... since it closes if all was sent, we can append an error message here.
|
// the headers are sent, but the channel is open... since it closes if all was sent, we can append an error message here.
|
||||||
return false; // but I don't want to, since I don't know what condition the output is in; I don't want to inject something.
|
return false; // but I don't want to, since I don't know what condition the output is in; I don't want to inject something (nor check the content-type for that matter. So we say it was not a clean handling.
|
||||||
} else {
|
} else {
|
||||||
// no headers are sent, we can send a full blown error and recover
|
// no headers are sent, we can send a full blown error and recover
|
||||||
cgi.setCache(false);
|
cgi.setCache(false);
|
||||||
|
@ -1895,7 +1895,7 @@ mixin template CustomCgiMain(CustomCgi, alias fun, T...) if(is(CustomCgi : Cgi))
|
||||||
cgi = new CustomCgi(5_000_000, fcgienv, &getFcgiChunk, &writeFcgi, &flushFcgi);
|
cgi = new CustomCgi(5_000_000, fcgienv, &getFcgiChunk, &writeFcgi, &flushFcgi);
|
||||||
} catch(Throwable t) {
|
} catch(Throwable t) {
|
||||||
FCGX_PutStr(cast(ubyte*) t.msg.ptr, t.msg.length, error);
|
FCGX_PutStr(cast(ubyte*) t.msg.ptr, t.msg.length, error);
|
||||||
writeFcgi(plainHttpError(true, "400 Bad Request", t));
|
writeFcgi(cast(const(ubyte)[]) plainHttpError(true, "400 Bad Request", t));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
assert(cgi !is null);
|
assert(cgi !is null);
|
||||||
|
@ -1929,8 +1929,8 @@ mixin template CustomCgiMain(CustomCgi, alias fun, T...) if(is(CustomCgi : Cgi))
|
||||||
try {
|
try {
|
||||||
fun(cgi);
|
fun(cgi);
|
||||||
cgi.close();
|
cgi.close();
|
||||||
} catch (Throwable c) {
|
} catch (Throwable t) {
|
||||||
stderr.writeln(c.msg);
|
stderr.writeln(t.msg);
|
||||||
if(!handleException(cgi, t))
|
if(!handleException(cgi, t))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2014,6 +2014,12 @@ void hackAroundLinkerError() {
|
||||||
|
|
||||||
version(fastcgi) {
|
version(fastcgi) {
|
||||||
pragma(lib, "fcgi");
|
pragma(lib, "fcgi");
|
||||||
|
|
||||||
|
static if(size_t.sizeof == 8) // 64 bit
|
||||||
|
alias long c_int;
|
||||||
|
else
|
||||||
|
alias int c_int;
|
||||||
|
|
||||||
extern(C) {
|
extern(C) {
|
||||||
|
|
||||||
struct FCGX_Stream {
|
struct FCGX_Stream {
|
||||||
|
@ -2021,22 +2027,22 @@ version(fastcgi) {
|
||||||
ubyte* wrNext;
|
ubyte* wrNext;
|
||||||
ubyte* stop;
|
ubyte* stop;
|
||||||
ubyte* stopUnget;
|
ubyte* stopUnget;
|
||||||
int isReader;
|
c_int isReader;
|
||||||
int isClosed;
|
c_int isClosed;
|
||||||
int wasFCloseCalled;
|
c_int wasFCloseCalled;
|
||||||
int FCGI_errno;
|
c_int FCGI_errno;
|
||||||
void* function(FCGX_Stream* stream) fillBuffProc;
|
void* function(FCGX_Stream* stream) fillBuffProc;
|
||||||
void* function(FCGX_Stream* stream, int doClose) emptyBuffProc;
|
void* function(FCGX_Stream* stream, c_int doClose) emptyBuffProc;
|
||||||
void* data;
|
void* data;
|
||||||
}
|
}
|
||||||
|
|
||||||
alias char** FCGX_ParamArray;
|
alias char** FCGX_ParamArray;
|
||||||
|
|
||||||
int FCGX_Accept(FCGX_Stream** stdin, FCGX_Stream** stdout, FCGX_Stream** stderr, FCGX_ParamArray* envp);
|
c_int FCGX_Accept(FCGX_Stream** stdin, FCGX_Stream** stdout, FCGX_Stream** stderr, FCGX_ParamArray* envp);
|
||||||
int FCGX_GetChar(FCGX_Stream* stream);
|
c_int FCGX_GetChar(FCGX_Stream* stream);
|
||||||
int FCGX_PutStr(const ubyte* str, int n, FCGX_Stream* stream);
|
c_int FCGX_PutStr(const ubyte* str, c_int n, FCGX_Stream* stream);
|
||||||
int FCGX_HasSeenEOF(FCGX_Stream* stream);
|
c_int FCGX_HasSeenEOF(FCGX_Stream* stream);
|
||||||
int FCGX_FFlush(FCGX_Stream *stream);
|
c_int FCGX_FFlush(FCGX_Stream *stream);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue