Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,10 @@ public override string ToString()
#if NETCORE
return _httpReq.GetRawBodyString();
#else
return (new StreamReader(_httpReq.InputStream)).ReadToEnd();
using (StreamReader reader = new StreamReader(_httpReq.InputStream))
{
return reader.ReadToEnd();
}
#endif
}
public void ToFile(string FileName)
Expand Down
7 changes: 6 additions & 1 deletion dotnet/src/dotnetframework/GxClasses/Middleware/GXHttp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,12 @@ public virtual void webAjaxEvent()
if (context.IsMultipartRequest)
jsonRequest = cgiGet(GX_AJAX_MULTIPART_ID);
else
jsonRequest = (new StreamReader(localHttpContext.Request.GetInputStream())).ReadToEnd();
{
using (StreamReader reader = new StreamReader(localHttpContext.Request.GetInputStream()))
{
jsonRequest = reader.ReadToEnd();
}
}
string jsonResponse = dynAjaxEvent.Invoke(jsonRequest, this);


Expand Down
16 changes: 10 additions & 6 deletions dotnet/src/dotnetframework/GxClasses/Middleware/GXHttpServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,15 @@ public override void webExecute()
{
HttpRequest req = context.HttpContext.Request;
string gxobj = GetNextPar().ToLower();
string jsonStr = (new StreamReader(req.GetInputStream())).ReadToEnd();
GxSimpleCollection<JArray> parmsColl = new GxSimpleCollection<JArray>();
if (!string.IsNullOrEmpty(jsonStr))

using (StreamReader stream = new StreamReader(req.GetInputStream()))
{
parmsColl.FromJSonString(jsonStr);
string jsonStr = stream.ReadToEnd();
if (!string.IsNullOrEmpty(jsonStr))
{
parmsColl.FromJSonString(jsonStr);
}
}
#if NETCORE

Expand Down Expand Up @@ -286,8 +290,8 @@ public override void webExecute()
{
localHttpContext.Response.ContentType = MediaTypesNames.TextPlain;
var r = new List<UploadFile>();
var fileCount = localHttpContext.Request.GetFileCount();
for (var i = 0; i < fileCount; i++)
int fileCount = localHttpContext.Request.GetFileCount();
for (int i = 0; i < fileCount; i++)
{
string fileGuid = GxUploadHelper.GetUploadFileGuid();
string fileToken = GxUploadHelper.GetUploadFileId(fileGuid);
Expand Down Expand Up @@ -321,7 +325,7 @@ public override void webExecute()
GxUploadHelper.CacheUploadFile(fileGuid, Path.GetFileName(fName), ext, gxFile, context);
}
UploadFilesResult result = new UploadFilesResult() { files = r };
var jsonObj = JSONHelper.Serialize(result);
string jsonObj = JSONHelper.Serialize(result);
localHttpContext.Response.Write(jsonObj);
}
else
Expand Down