Skip to main content

Hi all

I have some URLs that have special characters, but the server takes them without issue.


Example:

https://narobialimages.s3.eu-central-1.amazonaws.com/images/Light+version-Customer+Service_Retail_2019_15.jpg

My problem is when I try to get this URL from BASIC:

URL.CARACTERES='https://narobialimages.s3.eu-central-1.amazonaws.com/images/Light+version-Customer+Service_Retail_2019_15.jpg'
RESPUESTA=protocolLogging('/u2/quiter/POSVENTA5/&COMO&/HTTP_LOG_HECTOR_':TIME():'.log', 'ON', 27)
RESPUESTA=createSecurityContext(SECCONTEXT.HANDLE,'TLSv1:min')
RESPUESTA=addAuthenticationRule(SECCONTEXT.HANDLE, SSL_CLIENT, SSL_RULE_SERVER_NAME, SERVER.NAME)
RESPUESTA=addAuthenticationRule(SECCONTEXT.HANDLE,SSL_CLIENT,SSL_RULE_STRENGTH,'generous')
RESPUESTA=createSecureRequest(URL.SERVICIO,'GET',HTTP.HANDLE,SECCONTEXT.HANDLE)
RESPUESTA=submitRequest(HTTP.HANDLE,30000,'',CABECERA.RESPUESTA,DATOS.RESPUESTA,HTTP.STATUS)

The URL gets encoded:

10/22/2024 13:52:21 [ 11047 11046 ] createSecurityContext ... version=TLSv1:min
10/22/2024 13:52:21 [ 11047 11046 ] security context 0x19faea0 allocated
10/22/2024 13:52:21 [ 11047 11046 ] version 1 SCR created, SSL min_ver=3,map=60

10/22/2024 13:52:21 [ 11047 11046 ] addAuthenticationRule ... rule=ServerName,ruleString=narobialimages.s3.eu-central-1.amazonaws.com,serverorclient=2

10/22/2024 13:52:21 [ 11047 11046 ] addAuthenticationRule ... rule=VerificationStrength,ruleString=generous,serverorclient=2

10/22/2024 13:52:21 [ 11047 11046 ] createSecureRequest ... 18de8c0: URL=https://narobialimages.s3.eu-central-1.amazonaws.com/images/Light+version-Customer+Service_Retail_2019_15.jpg,method=GET
10/22/2024 13:52:21 [ 11047 11046 ] current Request date: Tue, 22 Oct 2024 11:52:21 GMT

10/22/2024 13:52:21 [ 11047 11046 ] submitRequest ... Var 18de8c0: host=narobialimages.s3.eu-central-1.amazonaws.com,timeout=30000
10/22/2024 13:52:21 [ 11047 11046 ] Assembled Request (body omitted,length=0):
GET /images/Light%2Bversion-Customer%2BService_Retail_2019_15.jpg HTTP/1.1
Date: Tue, 22 Oct 2024 11:52:21 GMT
Host: narobialimages.s3.eu-central-1.amazonaws.com
User-Agent: Rocket UniVerse 12.x

And I get a 403 error in my request.

Is there a way to tell Universe not to URL encode that parameter?

Hi all

I have some URLs that have special characters, but the server takes them without issue.


Example:

https://narobialimages.s3.eu-central-1.amazonaws.com/images/Light+version-Customer+Service_Retail_2019_15.jpg

My problem is when I try to get this URL from BASIC:

URL.CARACTERES='https://narobialimages.s3.eu-central-1.amazonaws.com/images/Light+version-Customer+Service_Retail_2019_15.jpg'
RESPUESTA=protocolLogging('/u2/quiter/POSVENTA5/&COMO&/HTTP_LOG_HECTOR_':TIME():'.log', 'ON', 27)
RESPUESTA=createSecurityContext(SECCONTEXT.HANDLE,'TLSv1:min')
RESPUESTA=addAuthenticationRule(SECCONTEXT.HANDLE, SSL_CLIENT, SSL_RULE_SERVER_NAME, SERVER.NAME)
RESPUESTA=addAuthenticationRule(SECCONTEXT.HANDLE,SSL_CLIENT,SSL_RULE_STRENGTH,'generous')
RESPUESTA=createSecureRequest(URL.SERVICIO,'GET',HTTP.HANDLE,SECCONTEXT.HANDLE)
RESPUESTA=submitRequest(HTTP.HANDLE,30000,'',CABECERA.RESPUESTA,DATOS.RESPUESTA,HTTP.STATUS)

The URL gets encoded:

10/22/2024 13:52:21 [ 11047 11046 ] createSecurityContext ... version=TLSv1:min
10/22/2024 13:52:21 [ 11047 11046 ] security context 0x19faea0 allocated
10/22/2024 13:52:21 [ 11047 11046 ] version 1 SCR created, SSL min_ver=3,map=60

10/22/2024 13:52:21 [ 11047 11046 ] addAuthenticationRule ... rule=ServerName,ruleString=narobialimages.s3.eu-central-1.amazonaws.com,serverorclient=2

10/22/2024 13:52:21 [ 11047 11046 ] addAuthenticationRule ... rule=VerificationStrength,ruleString=generous,serverorclient=2

10/22/2024 13:52:21 [ 11047 11046 ] createSecureRequest ... 18de8c0: URL=https://narobialimages.s3.eu-central-1.amazonaws.com/images/Light+version-Customer+Service_Retail_2019_15.jpg,method=GET
10/22/2024 13:52:21 [ 11047 11046 ] current Request date: Tue, 22 Oct 2024 11:52:21 GMT

10/22/2024 13:52:21 [ 11047 11046 ] submitRequest ... Var 18de8c0: host=narobialimages.s3.eu-central-1.amazonaws.com,timeout=30000
10/22/2024 13:52:21 [ 11047 11046 ] Assembled Request (body omitted,length=0):
GET /images/Light%2Bversion-Customer%2BService_Retail_2019_15.jpg HTTP/1.1
Date: Tue, 22 Oct 2024 11:52:21 GMT
Host: narobialimages.s3.eu-central-1.amazonaws.com
User-Agent: Rocket UniVerse 12.x

And I get a 403 error in my request.

Is there a way to tell Universe not to URL encode that parameter?

Hector,

As a thought - have you tried prior %-encoding to hex?)

Regards

JJ


Hi all

I have some URLs that have special characters, but the server takes them without issue.


Example:

https://narobialimages.s3.eu-central-1.amazonaws.com/images/Light+version-Customer+Service_Retail_2019_15.jpg

My problem is when I try to get this URL from BASIC:

URL.CARACTERES='https://narobialimages.s3.eu-central-1.amazonaws.com/images/Light+version-Customer+Service_Retail_2019_15.jpg'
RESPUESTA=protocolLogging('/u2/quiter/POSVENTA5/&COMO&/HTTP_LOG_HECTOR_':TIME():'.log', 'ON', 27)
RESPUESTA=createSecurityContext(SECCONTEXT.HANDLE,'TLSv1:min')
RESPUESTA=addAuthenticationRule(SECCONTEXT.HANDLE, SSL_CLIENT, SSL_RULE_SERVER_NAME, SERVER.NAME)
RESPUESTA=addAuthenticationRule(SECCONTEXT.HANDLE,SSL_CLIENT,SSL_RULE_STRENGTH,'generous')
RESPUESTA=createSecureRequest(URL.SERVICIO,'GET',HTTP.HANDLE,SECCONTEXT.HANDLE)
RESPUESTA=submitRequest(HTTP.HANDLE,30000,'',CABECERA.RESPUESTA,DATOS.RESPUESTA,HTTP.STATUS)

The URL gets encoded:

10/22/2024 13:52:21 [ 11047 11046 ] createSecurityContext ... version=TLSv1:min
10/22/2024 13:52:21 [ 11047 11046 ] security context 0x19faea0 allocated
10/22/2024 13:52:21 [ 11047 11046 ] version 1 SCR created, SSL min_ver=3,map=60

10/22/2024 13:52:21 [ 11047 11046 ] addAuthenticationRule ... rule=ServerName,ruleString=narobialimages.s3.eu-central-1.amazonaws.com,serverorclient=2

10/22/2024 13:52:21 [ 11047 11046 ] addAuthenticationRule ... rule=VerificationStrength,ruleString=generous,serverorclient=2

10/22/2024 13:52:21 [ 11047 11046 ] createSecureRequest ... 18de8c0: URL=https://narobialimages.s3.eu-central-1.amazonaws.com/images/Light+version-Customer+Service_Retail_2019_15.jpg,method=GET
10/22/2024 13:52:21 [ 11047 11046 ] current Request date: Tue, 22 Oct 2024 11:52:21 GMT

10/22/2024 13:52:21 [ 11047 11046 ] submitRequest ... Var 18de8c0: host=narobialimages.s3.eu-central-1.amazonaws.com,timeout=30000
10/22/2024 13:52:21 [ 11047 11046 ] Assembled Request (body omitted,length=0):
GET /images/Light%2Bversion-Customer%2BService_Retail_2019_15.jpg HTTP/1.1
Date: Tue, 22 Oct 2024 11:52:21 GMT
Host: narobialimages.s3.eu-central-1.amazonaws.com
User-Agent: Rocket UniVerse 12.x

And I get a 403 error in my request.

Is there a way to tell Universe not to URL encode that parameter?

Hector,

Can you provide a code sample?

Are you encoding with the URLENCODE algorithim?

https://docs.rocketsoftware.com/search?labelkey=universe_12.2.1&q=How%20do%20you%20encode%20a%20url%3F


Hi all

I have some URLs that have special characters, but the server takes them without issue.


Example:

https://narobialimages.s3.eu-central-1.amazonaws.com/images/Light+version-Customer+Service_Retail_2019_15.jpg

My problem is when I try to get this URL from BASIC:

URL.CARACTERES='https://narobialimages.s3.eu-central-1.amazonaws.com/images/Light+version-Customer+Service_Retail_2019_15.jpg'
RESPUESTA=protocolLogging('/u2/quiter/POSVENTA5/&COMO&/HTTP_LOG_HECTOR_':TIME():'.log', 'ON', 27)
RESPUESTA=createSecurityContext(SECCONTEXT.HANDLE,'TLSv1:min')
RESPUESTA=addAuthenticationRule(SECCONTEXT.HANDLE, SSL_CLIENT, SSL_RULE_SERVER_NAME, SERVER.NAME)
RESPUESTA=addAuthenticationRule(SECCONTEXT.HANDLE,SSL_CLIENT,SSL_RULE_STRENGTH,'generous')
RESPUESTA=createSecureRequest(URL.SERVICIO,'GET',HTTP.HANDLE,SECCONTEXT.HANDLE)
RESPUESTA=submitRequest(HTTP.HANDLE,30000,'',CABECERA.RESPUESTA,DATOS.RESPUESTA,HTTP.STATUS)

The URL gets encoded:

10/22/2024 13:52:21 [ 11047 11046 ] createSecurityContext ... version=TLSv1:min
10/22/2024 13:52:21 [ 11047 11046 ] security context 0x19faea0 allocated
10/22/2024 13:52:21 [ 11047 11046 ] version 1 SCR created, SSL min_ver=3,map=60

10/22/2024 13:52:21 [ 11047 11046 ] addAuthenticationRule ... rule=ServerName,ruleString=narobialimages.s3.eu-central-1.amazonaws.com,serverorclient=2

10/22/2024 13:52:21 [ 11047 11046 ] addAuthenticationRule ... rule=VerificationStrength,ruleString=generous,serverorclient=2

10/22/2024 13:52:21 [ 11047 11046 ] createSecureRequest ... 18de8c0: URL=https://narobialimages.s3.eu-central-1.amazonaws.com/images/Light+version-Customer+Service_Retail_2019_15.jpg,method=GET
10/22/2024 13:52:21 [ 11047 11046 ] current Request date: Tue, 22 Oct 2024 11:52:21 GMT

10/22/2024 13:52:21 [ 11047 11046 ] submitRequest ... Var 18de8c0: host=narobialimages.s3.eu-central-1.amazonaws.com,timeout=30000
10/22/2024 13:52:21 [ 11047 11046 ] Assembled Request (body omitted,length=0):
GET /images/Light%2Bversion-Customer%2BService_Retail_2019_15.jpg HTTP/1.1
Date: Tue, 22 Oct 2024 11:52:21 GMT
Host: narobialimages.s3.eu-central-1.amazonaws.com
User-Agent: Rocket UniVerse 12.x

And I get a 403 error in my request.

Is there a way to tell Universe not to URL encode that parameter?

Hi, Mike

The BASIC code is this:

URL.CARACTERES='https://narobialimages.s3.eu-central-1.amazonaws.com/images/Light+version-Customer+Service_Retail_2019_15.jpg'
RESPUESTA=protocolLogging('/u2/quiter/POSVENTA5/&COMO&/HTTP_LOG_HECTOR_':TIME():'.log', 'ON', 27)
RESPUESTA=createSecurityContext(SECCONTEXT.HANDLE,'TLSv1:min')
RESPUESTA=addAuthenticationRule(SECCONTEXT.HANDLE, SSL_CLIENT, SSL_RULE_SERVER_NAME, SERVER.NAME)
RESPUESTA=addAuthenticationRule(SECCONTEXT.HANDLE,SSL_CLIENT,SSL_RULE_STRENGTH,'generous')
RESPUESTA=createSecureRequest(URL.SERVICIO,'GET',HTTP.HANDLE,SECCONTEXT.HANDLE)
RESPUESTA=submitRequest(HTTP.HANDLE,30000,'',CABECERA.RESPUESTA,DATOS.RESPUESTA,HTTP.STATUS)

The URL has characters like '+', that are valid. I want submitRequest to take the URL as-is, and not to process it in any manner, because it will result in a bad URL.


Hi all

I have some URLs that have special characters, but the server takes them without issue.


Example:

https://narobialimages.s3.eu-central-1.amazonaws.com/images/Light+version-Customer+Service_Retail_2019_15.jpg

My problem is when I try to get this URL from BASIC:

URL.CARACTERES='https://narobialimages.s3.eu-central-1.amazonaws.com/images/Light+version-Customer+Service_Retail_2019_15.jpg'
RESPUESTA=protocolLogging('/u2/quiter/POSVENTA5/&COMO&/HTTP_LOG_HECTOR_':TIME():'.log', 'ON', 27)
RESPUESTA=createSecurityContext(SECCONTEXT.HANDLE,'TLSv1:min')
RESPUESTA=addAuthenticationRule(SECCONTEXT.HANDLE, SSL_CLIENT, SSL_RULE_SERVER_NAME, SERVER.NAME)
RESPUESTA=addAuthenticationRule(SECCONTEXT.HANDLE,SSL_CLIENT,SSL_RULE_STRENGTH,'generous')
RESPUESTA=createSecureRequest(URL.SERVICIO,'GET',HTTP.HANDLE,SECCONTEXT.HANDLE)
RESPUESTA=submitRequest(HTTP.HANDLE,30000,'',CABECERA.RESPUESTA,DATOS.RESPUESTA,HTTP.STATUS)

The URL gets encoded:

10/22/2024 13:52:21 [ 11047 11046 ] createSecurityContext ... version=TLSv1:min
10/22/2024 13:52:21 [ 11047 11046 ] security context 0x19faea0 allocated
10/22/2024 13:52:21 [ 11047 11046 ] version 1 SCR created, SSL min_ver=3,map=60

10/22/2024 13:52:21 [ 11047 11046 ] addAuthenticationRule ... rule=ServerName,ruleString=narobialimages.s3.eu-central-1.amazonaws.com,serverorclient=2

10/22/2024 13:52:21 [ 11047 11046 ] addAuthenticationRule ... rule=VerificationStrength,ruleString=generous,serverorclient=2

10/22/2024 13:52:21 [ 11047 11046 ] createSecureRequest ... 18de8c0: URL=https://narobialimages.s3.eu-central-1.amazonaws.com/images/Light+version-Customer+Service_Retail_2019_15.jpg,method=GET
10/22/2024 13:52:21 [ 11047 11046 ] current Request date: Tue, 22 Oct 2024 11:52:21 GMT

10/22/2024 13:52:21 [ 11047 11046 ] submitRequest ... Var 18de8c0: host=narobialimages.s3.eu-central-1.amazonaws.com,timeout=30000
10/22/2024 13:52:21 [ 11047 11046 ] Assembled Request (body omitted,length=0):
GET /images/Light%2Bversion-Customer%2BService_Retail_2019_15.jpg HTTP/1.1
Date: Tue, 22 Oct 2024 11:52:21 GMT
Host: narobialimages.s3.eu-central-1.amazonaws.com
User-Agent: Rocket UniVerse 12.x

And I get a 403 error in my request.

Is there a way to tell Universe not to URL encode that parameter?

Hector,

There is the following note in the documentation for createSecureRequest

"Note: If URL does include a searchpart, it must be in its encoded format (space is converted into +, and other non-alphanumeric characters are converted into %HH format. See addRequestParameter function for more details). However, host and path are allowed to have these “unsafe” characters. UniVerse BASIC will encode them before communicating with the web server."

Try decoding the string prior to calling the createSecureRequest.

I believe the issue you are running into is that the '+' since that is a valid encoding.  If the jpg file name does in fact have a '+', it should be fine, but if the '+' is represents a space, you may want to changing it to the space in the URL before the createSecureRequest.

Note that the ENCODE function can be used to do this.

To show the issue with the '+', please see the following:

>CT BP ENCODETEST

     ENCODETEST
0001 CLEAR
0002 A = 'https://narobialimages.s3.eu-central-1.amazonaws.com/images/Light+ver
     sion-Customer+Service_Retail_2019_15.jpg'
0003 A = 'One+Space'
0004 CRT "The original URL:  ":A
0005 M = ENCODE('URLENCODE', 2, A, 1, B, 1)
0006 CRT "The URL Decoded:   ":B
0007 M = ENCODE('URLENCODE', 1, B, 1, C, 1)
0008 CRT "Encoding again:    ":C
0009 CRT
0010 CRT
0011 M = ENCODE('URLENCODE', 1, A, 1, D, 1)
0012 CRT "Encoding A:        ":D
0013 END
0014
0015
>RUN BP ENCODETEST
The original URL:  One+Space
The URL Decoded:   One Space
Encoding again:    One+Space


Encoding A:        One%2BSpace

"What may be happening here is that the URLDecode is turning the %2b into a +, which is being interpreted as a space character in the URL. I was able to overcome a similar problem by first urldecoding the string, then using a replace function to replace spaces in the decoded string with + characters, and then decrypting the "fixed" string."