Skip to content

Commit ab2cc19

Browse files
Define method ChunkedStreaming to set chunkedResponse at procedure level
1 parent 8a9872d commit ab2cc19

File tree

2 files changed

+25
-28
lines changed

2 files changed

+25
-28
lines changed

dotnet/src/dotnetframework/GxClasses/Core/Web/GxHttpServer.cs

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ namespace GeneXus.Http.Server
1212
using System.Linq;
1313
using Microsoft.AspNetCore.Http.Features;
1414
using System.Text;
15-
using System.Threading.Tasks;
16-
using Microsoft.AspNetCore.Mvc.Formatters;
17-
using System.Net.Http;
18-
using Stubble.Core.Contexts;
19-
using System.Net.Mime;
20-
2115
#endif
2216

2317
public class GxHttpCookie
@@ -96,9 +90,6 @@ public class GxHttpResponse
9690
{
9791
HttpResponse _httpRes;
9892
IGxContext _context;
99-
#if !NETCORE
100-
bool _chunkedResponse;
101-
#endif
10293
public GxHttpResponse(IGxContext context)
10394
{
10495
_context = context;
@@ -139,12 +130,6 @@ public void AddString( string s)
139130
{
140131
if (Response != null)
141132
{
142-
#if !NETCORE
143-
if (_chunkedResponse)
144-
{
145-
Response.Buffer = false;
146-
}
147-
#endif
148133
Response.Write(s);
149134
}
150135
}
@@ -156,23 +141,14 @@ public void AddFile( string fileName)
156141
Response.WriteFile(fileName.Trim());
157142
}
158143
}
159-
public void AppendHeader( string name, string value)
144+
public void AppendHeader(string name, string value)
160145
{
161-
bool transferEncodingHeader = (name.Equals(HttpHeader.TRANSFER_ENCODING, StringComparison.OrdinalIgnoreCase) && value.Equals(HttpHeaderValue.TRANSFER_ENCODING_CHUNKED, StringComparison.OrdinalIgnoreCase));
162-
#if !NETCORE
163-
if (transferEncodingHeader)
164-
_chunkedResponse = true;
165-
#endif
166-
167146
if (string.Compare(name, "Content-Disposition", true) == 0)
168147
{
169148
value = GXUtil.EncodeContentDispositionHeader(value, _context.GetBrowserType());
170149
}
171-
if (!transferEncodingHeader)
172-
{
173-
if (_context != null)
174-
_context.SetHeader(name, value);
175-
}
150+
if (_context != null)
151+
_context.SetHeader(name, value);
176152
}
177153

178154
}

dotnet/src/dotnetframework/GxClasses/Model/GXWebProcedure.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ namespace GeneXus.Procedure
88
using System.Threading;
99
using GeneXus.Mime;
1010
using GeneXus.Utils;
11+
#if NETCORE
12+
using Microsoft.AspNetCore.Http;
13+
#else
14+
using System.Web;
15+
#endif
1116

1217
public class GXWebProcedure : GXHttpHandler
1318
{
@@ -35,6 +40,7 @@ public override void webExecute() { }
3540
public override void initialize() { }
3641
protected override void createObjects() { }
3742
public override void skipLines(long nToSkip) { }
43+
protected virtual bool ChunkedStreaming() { return false; }
3844

3945
public override void cleanup()
4046
{
@@ -43,7 +49,22 @@ public override void cleanup()
4349
context.DeleteReferer();
4450
}
4551
}
46-
52+
public GXWebProcedure()
53+
{
54+
#if !NETCORE
55+
if (ChunkedStreaming())
56+
{
57+
context.HttpContext.Response.Buffer = false;
58+
}
59+
#endif
60+
}
61+
protected override void SetCompression(HttpContext httpContext)
62+
{
63+
if (!ChunkedStreaming())
64+
{
65+
base.SetCompression(httpContext);
66+
}
67+
}
4768
public void setContextReportHandler()
4869
{
4970

0 commit comments

Comments
 (0)