mirror of
https://github.com/abapGit/abapGit.git
synced 2025-04-30 11:46:38 +08:00
Merge pull request #1419 from larshp/issue_1418
docs: update SSL test program
This commit is contained in:
commit
4974e0c8d8
|
@ -11,21 +11,34 @@ REPORT zabapgit_test_ssl.
|
|||
|
||||
* See https://github.com/larshp/abapGit/
|
||||
|
||||
PARAMETERS: p_url TYPE swc_value DEFAULT 'https://github.com',
|
||||
p_proxy TYPE string,
|
||||
p_pxport TYPE string.
|
||||
PARAMETERS: p_url1 TYPE swc_value DEFAULT 'https://github.com',
|
||||
p_url2 TYPE swc_value DEFAULT 'https://api.github.com'.
|
||||
* api.github.com is used when pushing code back to github
|
||||
|
||||
SELECTION-SCREEN BEGIN OF BLOCK proxy WITH FRAME.
|
||||
* proxy settings, fill if your system is behind a proxy
|
||||
PARAMETERS: p_proxy TYPE string,
|
||||
p_pxport TYPE string,
|
||||
p_puser TYPE string,
|
||||
p_ppwd TYPE string.
|
||||
SELECTION-SCREEN END OF BLOCK proxy.
|
||||
|
||||
START-OF-SELECTION.
|
||||
PERFORM run.
|
||||
PERFORM run USING p_url1.
|
||||
PERFORM run USING p_url2.
|
||||
|
||||
FORM run.
|
||||
FORM run USING iv_url TYPE swc_value.
|
||||
|
||||
DATA: lv_code TYPE i,
|
||||
lv_url TYPE string,
|
||||
li_client TYPE REF TO if_http_client,
|
||||
lv_error_message TYPE string.
|
||||
|
||||
lv_url = p_url.
|
||||
IF iv_url IS INITIAL.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
lv_url = iv_url.
|
||||
cl_http_client=>create_by_url(
|
||||
EXPORTING
|
||||
url = lv_url
|
||||
|
@ -35,11 +48,12 @@ FORM run.
|
|||
IMPORTING
|
||||
client = li_client ).
|
||||
|
||||
* enter username and password for proxy authentication if needed
|
||||
* li_client->authenticate(
|
||||
* proxy_authentication = abap_true
|
||||
* username = ''
|
||||
* password = '' ).
|
||||
IF NOT p_puser IS INITIAL.
|
||||
li_client->authenticate(
|
||||
proxy_authentication = abap_true
|
||||
username = p_puser
|
||||
password = p_ppwd ).
|
||||
ENDIF.
|
||||
|
||||
li_client->send( ).
|
||||
li_client->receive(
|
||||
|
@ -62,10 +76,10 @@ FORM run.
|
|||
* if SSL Handshake fails, make sure to also check https://launchpad.support.sap.com/#/notes/510007
|
||||
|
||||
li_client->response->get_status(
|
||||
IMPORTING
|
||||
code = lv_code ).
|
||||
IMPORTING
|
||||
code = lv_code ).
|
||||
IF lv_code = 200.
|
||||
WRITE: / 'Success, it works'.
|
||||
WRITE: / lv_url, ': ok'.
|
||||
ELSE.
|
||||
WRITE: / 'Error', lv_code.
|
||||
ENDIF.
|
||||
|
|
|
@ -60,7 +60,7 @@ ENDCLASS.
|
|||
|
||||
|
||||
|
||||
CLASS zcl_abapgit_2fa_github_auth IMPLEMENTATION.
|
||||
CLASS ZCL_ABAPGIT_2FA_GITHUB_AUTH IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD constructor.
|
||||
|
@ -336,6 +336,8 @@ CLASS zcl_abapgit_2fa_github_auth IMPLEMENTATION.
|
|||
|
||||
li_client->receive( EXCEPTIONS OTHERS = 1 ).
|
||||
IF sy-subrc <> 0.
|
||||
* if the code fails here with a SSL error, make sure STRUST is setup to
|
||||
* work with https://api.github.com
|
||||
raise_comm_error_from_sy( ).
|
||||
ENDIF.
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user