You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by "liqingwang (via GitHub)" <gi...@apache.org> on 2023/06/13 06:38:08 UTC

[GitHub] [dolphinscheduler] liqingwang opened a new issue, #14340: [Alert] [HTTP Plugin] Lose HTTP port

liqingwang opened a new issue, #14340:
URL: https://github.com/apache/dolphinscheduler/issues/14340

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### What happened
   
   When we config HTTP plugin with `GET` type and the URL contains a port like the below:
   ```
   @Test
       public void sendTest() {
           Map<String, String> paramsMap = new HashMap<>();
           paramsMap.put(HttpAlertConstants.NAME_URL, "https://www.baidu.com:443");
           paramsMap.put(HttpAlertConstants.NAME_REQUEST_TYPE, "GET");
           paramsMap.put(HttpAlertConstants.NAME_HEADER_PARAMS, "{\"Content-Type\":\"application/json\"}");
           paramsMap.put(HttpAlertConstants.NAME_BODY_PARAMS, "{\"number\":\"13457654323\"}");
           paramsMap.put(HttpAlertConstants.NAME_CONTENT_FIELD, "content");
           HttpSender httpSender = new HttpSender(paramsMap);
           AlertResult alertResult = httpSender.send("Fault tolerance warning");
           Assert.assertEquals("true", alertResult.getStatus());
       }
    ```
   
   We will see the URL built info losed port:
   
   ![image](https://github.com/apache/dolphinscheduler/assets/20885366/ff7d0248-6294-415c-8a02-6a8a2dd25661)
   
   
   ### What you expected to happen
   
   ![image](https://github.com/apache/dolphinscheduler/assets/20885366/d30395de-06e5-4890-8a66-d788dda31327)
   We need to use authority to replace the host to build URI
   
   ### How to reproduce
   
   `URI uri = new URI(unencodeUrl.getProtocol(), unencodeUrl.getHost(), unencodeUrl.getPath(), unencodeUrl.getQuery(), null);
   `
   
   Change to:
   
   `URI uri = new URI(unencodeUrl.getProtocol(), unencodeUrl.getAuthority(), unencodeUrl.getPath(), unencodeUrl.getQuery(), null);
   `
   
   And test again:
   ![image](https://github.com/apache/dolphinscheduler/assets/20885366/b0049d00-8072-4388-b3b6-069871c3c782)
   Works well
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   dev
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] zhongjiajie closed issue #14340: [Alert] [HTTP Plugin] Lose HTTP port

Posted by "zhongjiajie (via GitHub)" <gi...@apache.org>.
zhongjiajie closed issue #14340: [Alert] [HTTP Plugin] Lose HTTP port
URL: https://github.com/apache/dolphinscheduler/issues/14340


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org