Skip to content

Commit

Permalink
Add HTTP protocol as a new parameter to test SSL report (#222)
Browse files Browse the repository at this point in the history
Co-authored-by: Marc Bernard <[email protected]>
  • Loading branch information
christianguenter2 and mbtools authored Apr 5, 2024
1 parent 8b86de2 commit 3b6e380
Showing 1 changed file with 42 additions and 9 deletions.
51 changes: 42 additions & 9 deletions src/.vuepress/public/assets/src/zabapgit_test_ssl.abap
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF BLOCK sc_serv WITH FRAME TITLE sc_titl2.
PARAMETERS:
p_url1 TYPE string LOWER CASE DEFAULT 'https://github.com' OBLIGATORY,
p_url2 TYPE string LOWER CASE DEFAULT 'https://api.github.com',
p_id TYPE strustssl-applic DEFAULT 'ANONYM' OBLIGATORY.
* api.github.com is used when pushing code back to github
p_url2 TYPE string LOWER CASE DEFAULT 'https://api.github.com',
p_id TYPE strustssl-applic DEFAULT 'ANONYM' OBLIGATORY,
p_http TYPE i DEFAULT if_http_request=>co_protocol_version_1_1 OBLIGATORY AS LISTBOX VISIBLE LENGTH 30.
SELECTION-SCREEN END OF BLOCK sc_serv.

SELECTION-SCREEN SKIP.
Expand Down Expand Up @@ -70,6 +71,9 @@ CLASS lcl_report DEFINITION.
RETURNING
VALUE(rv_url) TYPE string.


METHODS http_protocol_list_box.

PRIVATE SECTION.

TYPES:
Expand Down Expand Up @@ -111,12 +115,10 @@ CLASS lcl_report IMPLEMENTATION.
METHOD run.

DATA:
lv_code TYPE i,
lv_url TYPE string,
li_http_client TYPE REF TO if_http_client,
lv_error_message TYPE string,
lv_reason TYPE string,
lv_response TYPE string.
lv_code TYPE i,
li_http_client TYPE REF TO if_http_client,
lv_reason TYPE string,
lv_response TYPE string.

IF iv_url IS INITIAL.
RETURN.
Expand Down Expand Up @@ -148,6 +150,8 @@ CLASS lcl_report IMPLEMENTATION.
password = p_ppwd ).
ENDIF.

li_http_client->request->set_version( p_http ).

li_http_client->send( ).

li_http_client->receive(
Expand All @@ -159,7 +163,7 @@ CLASS lcl_report IMPLEMENTATION.

IF sy-subrc <> 0.
display_error( 'HTTP Client Receive' ).

li_http_client->get_last_error(
IMPORTING
message = lv_response ).
Expand Down Expand Up @@ -308,6 +312,32 @@ CLASS lcl_report IMPLEMENTATION.

ENDMETHOD.


METHOD http_protocol_list_box.

DATA:
lt_values TYPE vrm_values,
ls_value LIKE LINE OF lt_values.

ls_value-key = if_http_request=>co_protocol_version_1_0.
ls_value-text = 'HTTP/1.0'.
APPEND ls_value TO lt_values.

ls_value-key = if_http_request=>co_protocol_version_1_1.
ls_value-text = 'HTTP/1.1'.
APPEND ls_value TO lt_values.

CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'P_HTTP'
values = lt_values
EXCEPTIONS
id_illegavrm_id = 1
OTHERS = 2.
ASSERT sy-subrc = 0.

ENDMETHOD.

ENDCLASS.

DATA go_report TYPE REF TO lcl_report.
Expand All @@ -322,6 +352,7 @@ INITIALIZATION.
%_p_url1_%_app_%-text = 'URL (Read Access)'.
%_p_url2_%_app_%-text = 'URL (Write Access)'.
%_p_id_%_app_%-text = 'SSL Client Identity'.
%_p_http_%_app_%-text = 'HTTP protocol'.
sc_titl3 = 'Proxy Settings (Optional)'.
%_p_proxy_%_app_%-text = 'Hostname/IP'.
%_p_pport_%_app_%-text = 'Port'.
Expand All @@ -345,6 +376,8 @@ AT SELECTION-SCREEN OUTPUT.
ENDIF.
ENDLOOP.

go_report->http_protocol_list_box( ).

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_url1.
p_url1 = go_report->f4_url( ).

Expand Down

0 comments on commit 3b6e380

Please sign in to comment.