mirror of https://github.com/adamdruppe/arsd.git
add requestContentType member
This commit is contained in:
parent
df008ed820
commit
d07483d544
17
cgi.d
17
cgi.d
|
@ -1151,6 +1151,7 @@ class Cgi {
|
|||
this.pathInfo = pathInfo;
|
||||
this.queryString = queryString;
|
||||
this.postBody = null;
|
||||
this.requestContentType = null;
|
||||
}
|
||||
|
||||
private {
|
||||
|
@ -1374,6 +1375,7 @@ class Cgi {
|
|||
files = keepLastOf(filesArray);
|
||||
post = keepLastOf(postArray);
|
||||
this.postBody = pps.postBody;
|
||||
this.requestContentType = contentType;
|
||||
cleanUpPostDataState();
|
||||
}
|
||||
|
||||
|
@ -2201,6 +2203,8 @@ class Cgi {
|
|||
files = keepLastOf(filesArray);
|
||||
post = keepLastOf(postArray);
|
||||
postBody = pps.postBody;
|
||||
this.requestContentType = contentType;
|
||||
|
||||
cleanUpPostDataState();
|
||||
}
|
||||
|
||||
|
@ -2874,6 +2878,14 @@ class Cgi {
|
|||
public immutable string postBody;
|
||||
alias postJson = postBody; // old name
|
||||
|
||||
/++
|
||||
The content type header of the request. The [postBody] member may hold the actual data (see [postBody] for details).
|
||||
|
||||
History:
|
||||
Added January 26, 2024 (dub v11.4)
|
||||
+/
|
||||
public immutable string requestContentType;
|
||||
|
||||
/* Internal state flags */
|
||||
private bool outputtedResponseData;
|
||||
private bool noCache = true;
|
||||
|
@ -3687,6 +3699,11 @@ mixin template CustomCgiDispatcherMain(CustomCgi, size_t maxContentLength, Prese
|
|||
activePresenter = presenter;
|
||||
scope(exit) activePresenter = null;
|
||||
|
||||
if(cgi.pathInfo.length == 0) {
|
||||
cgi.setResponseLocation(cgi.scriptName ~ "/");
|
||||
return;
|
||||
}
|
||||
|
||||
if(cgi.dispatcher!DispatcherArgs(presenter))
|
||||
return;
|
||||
|
||||
|
|
Loading…
Reference in New Issue