浏览代码

Merge branch 'candidate-7.10.x' into candidate-7.12.x

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 4 年之前
父节点
当前提交
f14c027629
共有 2 个文件被更改,包括 22 次插入20 次删除
  1. 19 0
      .github/workflows/test-eclhelper.yml
  2. 3 20
      esp/bindings/http/client/httpclient.cpp

+ 19 - 0
.github/workflows/test-eclhelper.yml

@@ -0,0 +1,19 @@
+name: Check that eclhelper interface has not changed
+
+on:
+  pull_request:
+    branches:
+      - "master"
+      - "candidate-*"
+
+jobs:
+  build:
+    name: "Check eclhelper interface"
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+        with:
+          fetch-depth: 2
+      - name: Check eclhelper
+        run: git diff HEAD^ --exit-code -- rtl/include/eclhelper.hpp

+ 3 - 20
esp/bindings/http/client/httpclient.cpp

@@ -402,15 +402,8 @@ HttpClientErrCode CHttpClient::sendRequest(const char* method, const char* conte
     {
         StringBuffer uidpair;
         uidpair.append(m_userid.get()).append(":").append(m_password.get());
-        StringBuffer result;
-        JBASE64_Encode(uidpair.str(), uidpair.length(), result, false);
         StringBuffer authhdr("Basic ");
-
-        //Remove the \n from the end of the encoded string.
-        //Should it even be there??
-        result.setCharAt(result.length() - 1,0);
-
-        authhdr.append(result.str());
+        JBASE64_Encode(uidpair.str(), uidpair.length(), authhdr, false);
         httprequest->addHeader("Authorization", authhdr.str());
     }
     if(m_realm.length() > 0)
@@ -707,11 +700,8 @@ HttpClientErrCode CHttpClient::sendRequest(IProperties *headers, const char* met
     {
         StringBuffer uidpair;
         uidpair.append(m_userid.get()).append(":").append(m_password.get());
-        StringBuffer result;
-        JBASE64_Encode(uidpair.str(), uidpair.length(), result, false);
         StringBuffer authhdr("Basic ");
-
-        authhdr.append(result.str());
+        JBASE64_Encode(uidpair.str(), uidpair.length(), authhdr, false);
         httprequest->addHeader("Authorization", authhdr.str());
     }
     if(m_realm.length() > 0)
@@ -894,15 +884,8 @@ HttpClientErrCode CHttpClient::postRequest(ISoapMessage &req, ISoapMessage& resp
     {
         StringBuffer uidpair;
         uidpair.append(m_userid.get()).append(":").append(m_password.get());
-        StringBuffer result;
-        JBASE64_Encode(uidpair.str(), uidpair.length(), result, false);
         StringBuffer authhdr("Basic ");
-
-        //Remove the \n from the end of the encoded string.
-        //Should it even be there??
-        result.setCharAt(result.length() - 1,0);
-
-        authhdr.append(result.str());
+        JBASE64_Encode(uidpair.str(), uidpair.length(), authhdr, false);
         httprequest->addHeader("Authorization", authhdr.str());
         if(m_proxy.length())
             httprequest->addHeader("Proxy-Authorization", authhdr.str());