Skip to content

Commit 561e070

Browse files
committed
Merge remote-tracking branch 'origin/candidate-9.10.x' into candidate-9.12.x
Signed-off-by: Gavin Halliday <[email protected]>
2 parents 215960b + 098aba1 commit 561e070

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+2312
-6326
lines changed

.github/workflows/test-smoke-gh_runner.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ jobs:
7777
sudo apt-get install -y gdb
7878
echo 'core_%e.%p' | sudo tee /proc/sys/kernel/core_pattern
7979
80+
# Install, configure and start TinyProxy
81+
sudo apt-get install -y tinyproxy
82+
echo "Port 8888" > tinyproxy.conf
83+
echo "Timeout 600" >> tinyproxy.conf
84+
tinyproxy -c tinyproxy.conf
85+
pgrep tinyproxy
86+
8087
- name: Install Package
8188
shell: "bash"
8289
run: |

common/thorhelper/roxiehelper.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,6 @@ bool CSafeSocket::readBlocktms(StringBuffer &ret, unsigned timeoutms, HttpHelper
15371537
bool sockClosed = false;
15381538
if (pHttpHelper && pHttpHelper->isHttp())
15391539
{
1540-
#define MAX_HTTP_HEADERSIZE 16000 //arbitrary per line limit, most web servers are lower, but REST queries can be complex..
15411540
char header[MAX_HTTP_HEADERSIZE + 1]; // allow room for \0
15421541
CTimeMon tm(timeoutms);
15431542
unsigned totalRead = 0;
@@ -1585,6 +1584,8 @@ bool CSafeSocket::readBlocktms(StringBuffer &ret, unsigned timeoutms, HttpHelper
15851584
}
15861585
break;
15871586
}
1587+
if (totalRead >= MAX_HTTP_HEADERSIZE)
1588+
throw makeStringException(THORHELPER_DATA_ERROR, "Badly formed HTTP header");
15881589
}
15891590

15901591
if (tm.timedout(&remaining))

common/thorhelper/thorhelper.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
#define THORMASTERLOGSEARCHSTR "thormaster."
3333
#define THORSLAVELOGSEARCHSTR "thorslave."
3434

35+
#define MAX_HTTP_HEADERSIZE 16000 //arbitrary per line limit, most web servers are lower, but REST queries can be complex..
36+
3537
interface IXmlToRawTransformer : extends IInterface
3638
{
3739
virtual IDataVal & transform(IDataVal & result, size32_t len, const void * text, bool isDataset) = 0;

common/thorhelper/thorsoapcall.cpp

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1992,6 +1992,8 @@ class CWSCAsyncFor : implements IWSCAsyncFor, public CInterface, public CAsyncFo
19921992
void createHttpRequest(StringBuffer &request, const Url &url, const IProperties * traceHeaders)
19931993
{
19941994
// Create the HTTP POST request
1995+
// NOTE: if using an http proxy and method is not https then path should be prepended with url host:port
1996+
// but this would break regression tests that use esp as a proxy
19951997
if (master->wscType == STsoap)
19961998
request.clear().append("POST ").append(url.path).append(" HTTP/1.1\r\n");
19971999
else
@@ -2517,6 +2519,10 @@ class CWSCAsyncFor : implements IWSCAsyncFor, public CInterface, public CAsyncFo
25172519
checkTimeLimitExceeded(&remainingMS);
25182520
Url &connUrl = master->proxyUrlArray.empty() ? url : master->proxyUrlArray.item(0);
25192521

2522+
bool useProxy = false;
2523+
if (!master->proxyUrlArray.empty())
2524+
useProxy = true;
2525+
25202526
CCycleTimer dnsTimer;
25212527

25222528
// TODO: for DNS, do we use timeoutMS or remainingMS or remainingMS / maxRetries+1 or ?
@@ -2554,7 +2560,54 @@ class CWSCAsyncFor : implements IWSCAsyncFor, public CInterface, public CAsyncFo
25542560
if (proto == PersistentProtocol::ProtoTLS)
25552561
{
25562562
#ifdef _USE_OPENSSL
2557-
Owned<ISecureSocket> ssock = master->createSecureSocket(socket.getClear(), connUrl.host);
2563+
if (useProxy && strieq(connUrl.method.str(), "http"))
2564+
{
2565+
StringBuffer urlHost;
2566+
if (streq(url.host.str(), "."))
2567+
urlHost.append(GetCachedHostName());
2568+
else
2569+
urlHost.append(url.host.str());
2570+
StringBuffer proxyText;
2571+
proxyText.appendf("CONNECT %s:%d HTTP/1.1\r\n", urlHost.str(), url.port);
2572+
proxyText.append("Proxy-Connection: Keep-Alive\r\n\r\n");
2573+
socket->write(proxyText.str(),proxyText.length());
2574+
2575+
checkTimeLimitExceeded(&remainingMS);
2576+
unsigned proxyTimeout = MIN(remainingMS, master->timeoutMS);
2577+
char proxyResponse[MAX_HTTP_HEADERSIZE + 1];
2578+
unsigned proxyRemaining = proxyTimeout;
2579+
CTimeMon tm(proxyTimeout);
2580+
unsigned totalRead = 0;
2581+
unsigned bytesRead = 0;
2582+
bool sockClosed = false;
2583+
while (!sockClosed && !tm.timedout(&proxyRemaining))
2584+
{
2585+
unsigned maxPoss = MAX_HTTP_HEADERSIZE - totalRead;
2586+
sockClosed = readtmsAllowClose(socket, &proxyResponse[totalRead], 1, maxPoss, bytesRead, proxyRemaining);
2587+
totalRead += bytesRead;
2588+
proxyResponse[totalRead] = 0;
2589+
2590+
if (strstr(proxyResponse, "\r\n\r\n"))
2591+
break;
2592+
if (totalRead >= MAX_HTTP_HEADERSIZE)
2593+
break;
2594+
}
2595+
2596+
if (tm.timedout(&proxyRemaining))
2597+
throw makeStringException(-1, "Timed out waiting for proxy response");
2598+
2599+
bool proxyTunnelOK = false;
2600+
const char *okResp = strstr(proxyResponse, "HTTP/");
2601+
if (okResp)
2602+
{
2603+
if (strstr(okResp, " 200 "))
2604+
proxyTunnelOK = true;
2605+
}
2606+
if (!proxyTunnelOK)
2607+
throw makeStringException(-1, "Invalid response from proxy");
2608+
}
2609+
2610+
Owned<ISecureSocket> ssock = master->createSecureSocket(socket.getClear(), url.host);
25582611
if (ssock)
25592612
{
25602613
checkTimeLimitExceeded(&remainingMS);

common/workunit/workunit.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6157,6 +6157,11 @@ class CDaliWorkUnitFactory : public CWorkUnitFactory, implements IDaliClientShut
61576157
query.append('"').append(value).append("\"]");
61586158
};
61596159

6160+
static void appendMinCostToQueryString(StringBuffer& query, WUSortField filter, const char* value)
6161+
{
6162+
query.append('[').append(queryFilterXPath(filter)).append(">=\"").append(money2cost_type(atof(value))).append("\"]");
6163+
};
6164+
61606165
IConstWorkUnitIterator* getWorkUnitsSorted( WUSortField sortorder, // field to sort by (and flags for desc sort etc)
61616166
WUSortField *filters, // NULL or list of fields to filter on (terminated by WUSFterm)
61626167
const void *filterbuf, // (appended) string values for filters
@@ -6369,6 +6374,10 @@ class CDaliWorkUnitFactory : public CWorkUnitFactory, implements IDaliClientShut
63696374
else
63706375
query.append("[@protected!=\"1\"]"); //The @protected is set to '0' or not set.
63716376
}
6377+
else if (subfmt==WUSFcostcompile || subfmt==WUSFcostexecute || subfmt==WUSFcostfileaccess )
6378+
{
6379+
appendMinCostToQueryString(query, (WUSortField)subfmt, fv);
6380+
}
63726381
else if (!*fv)
63736382
{
63746383
unknownAttributes.append(getEnumText(subfmt,workunitSortFields));

common/workunit/workunit.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,4 +1855,14 @@ class WORKUNIT_API WuidPattern
18551855
inline operator StringBuffer& () { return pattern; }
18561856
};
18571857

1858+
inline cost_type getGuillotineCost(IConstWorkUnit *wu)
1859+
{
1860+
cost_type wuMaxCost = money2cost_type(wu->getDebugValueReal("maxCost", 0));
1861+
cost_type guillotineCost = wuMaxCost ? wuMaxCost : money2cost_type(getConfigReal("cost/@limit"));
1862+
cost_type hardCostLimit = money2cost_type(getConfigReal("cost/@hardlimit"));
1863+
if (hardCostLimit && ((guillotineCost == 0) || (guillotineCost > hardCostLimit)))
1864+
guillotineCost = hardCostLimit;
1865+
return guillotineCost;
1866+
}
1867+
18581868
#endif

dali/base/dadfs.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5100,9 +5100,10 @@ protected: friend class CDistributedFilePart;
51005100
double sizeGB = getDiskSize(true, false) / ((double)1024 * 1024 * 1024);
51015101
const IPropertyTree *attrs = root->queryPropTree("Attr");
51025102

5103+
//This array must still exist when getReadCost() etc. is called, otherwise cluster will have been freed.
5104+
StringArray clusterNames;
51035105
if (isEmptyString(cluster))
51045106
{
5105-
StringArray clusterNames;
51065107
unsigned countClusters = getClusterNames(clusterNames);
51075108
for (unsigned i = 0; i < countClusters; i++)
51085109
atRestCost += calcFileAtRestCost(clusterNames[i], sizeGB, fileAgeDays);

dali/base/dasds.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2796,7 +2796,7 @@ class CServerRemoteTree : public CRemoteTreeBase
27962796
if (SDSManager->ignoreExternals) return COMPRESS_METHOD_NONE;
27972797
if (!hasProp(EXT_ATTR))
27982798
return COMPRESS_METHOD_NONE;
2799-
return (CompressionMethod)getPropInt(COMPRESS_ATTR, COMPRESS_METHOD_LZW);
2799+
return (CompressionMethod)getPropInt(COMPRESS_ATTR, COMPRESS_METHOD_LZW_LITTLE_ENDIAN);
28002800
}
28012801

28022802
bool getProp(const char *xpath, StringBuffer &ret) const override

dockerfiles/platform-core-ubuntu-20.04.dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ RUN curl -LO https://packagecloud.io/github/git-lfs/packages/ubuntu/jammy/git-lf
6868

6969
# Set the locale
7070
RUN locale-gen en_US.UTF-8
71-
ENV LANG en_US.UTF-8
72-
ENV LANGUAGE en_US:en
73-
ENV LC_ALL en_US.UTF-8
71+
ENV LANG=en_US.UTF-8
72+
ENV LANGUAGE=en_US:en
73+
ENV LC_ALL=en_US.UTF-8
7474

7575
RUN groupadd -g 10001 hpcc
7676
RUN useradd -s /bin/bash -m -r -N -c "hpcc runtime User" -u 10000 -g hpcc hpcc

dockerfiles/platform-core-ubuntu-22.04/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ RUN curl -LO https://packagecloud.io/github/git-lfs/packages/ubuntu/jammy/git-lf
6868

6969
# Set the locale
7070
RUN locale-gen en_US.UTF-8
71-
ENV LANG en_US.UTF-8
72-
ENV LANGUAGE en_US:en
73-
ENV LC_ALL en_US.UTF-8
71+
ENV LANG=en_US.UTF-8
72+
ENV LANGUAGE=en_US:en
73+
ENV LC_ALL=en_US.UTF-8
7474

7575
RUN groupadd -g 10001 hpcc
7676
RUN useradd -s /bin/bash -m -r -N -c "hpcc runtime User" -u 10000 -g hpcc hpcc

0 commit comments

Comments
 (0)