0

I am using the GsmSSLWebClient example which comes with the MKRGSM library. The original example works just fine, I get the arduino ascii logo. But when I change the URL the arduino doesn't get any answer:

//char server[] = "arduino.cc"; 
//char path[] = "/asciilogo.txt";
char server[] = "wepardi.fi"; 
char path[] = "/robots.txt";
Starting Arduino web client.
connecting...
connected
GET /robots.txt HTTP/1.1
Host: wepardi.fi
Connection: close
disconnecting.

From Firefox https://www.wepardi.fi/robots.txt is displayed correctly. I tried also some other sites, and from some of them I get the ascii file content correctly, and from some others not.

Something wrong with my settings?

Prints from debug mode:

connecting...

...

AT+USECMNG=0,0,"VeriSign_Class_3_Public_Primary_Certification_Authority_G5",1239
>
+USECMNG: 0,0,"VeriSign_Class_3_Public_Primary_Certification_Authority_G5","cb17e431673ee209fe455793f30afa1c"
OK
AT+USOCR=6
+USOCR: 0
OK
AT+USOSEC=0,1,0
OK
AT+USECPRF=0,0,1,4,"www.wepardi.fi"
OK
AT+USOCO=0,"www.wepardi.fi",443
ERROR
+UUSOCL: 0
AT+USOCL=0
ERROR
connected
GET /robots.txt HTTP/1.1
Host: www.wepardi.fi
Connection: close
disconnecting.

Command AT+USOCO=0,"www.wepardi.fi",443 fails

GsmWebClient (no SSL) example works fine with any hosts I have tried.

asked Jan 8, 2019 at 13:47
1
  • in browser you enter www.wepardi.fi and in arduino only wepardi.fi Commented Jan 8, 2019 at 14:36

2 Answers 2

1

I finally found a solution to this problem. Disabling certificate validation in MKRGSM library makes the SSL connection succeed also to this site. In MKRGSM/src/GSMClient.cpp I changed

// MODEM.sendf("AT+USECPRF=0,0,1,4,\"%s\"", _host);
 MODEM.sendf("AT+USECPRF=0");

to use modem factory settings. I still don't know what was the problem with the certificates. Thanks to everyone who tried to help with this.

answered Jan 11, 2019 at 8:25
0

The problem you have is that of redirection.

You connect to wepardi.fi and request the file /robots.txt from that host. It immediately tells you "Ok, but that file is actually on www.wepardi.fi/robots.txt. Go get it from there.

But it won't.

You have to go direct to the source.

Here's a trace:

GET /robots.txt HTTP/1.1
Host: wepardi.fi
Connection: close
HTTP/1.1 302 Found
Date: 2019年1月08日 14:26:51 GMT
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.0.32
Strict-Transport-Security: max-age=63072000; includeSubdomains;
X-Powered-By: PHP/7.0.32
Location: https://www.wepardi.fi/
Cache-Control: max-age=1296000
Expires: 2019年1月23日 14:26:51 GMT
Content-Length: 0
Connection: close
Content-Type: text/html; charset=UTF-8

And when you change to www.wepardi.fi:

GET /robots.txt HTTP/1.1
Host: www.wepardi.fi
Connection: close
HTTP/1.1 200 OK
Date: 2019年1月08日 14:27:49 GMT
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.0.32
Strict-Transport-Security: max-age=63072000; includeSubdomains;
X-Powered-By: PHP/7.0.32
X-Robots-Tag: noindex, follow
Link: <https://www.wepardi.fi/wp-json/>; rel="https://api.w.org/"
Cache-Control: max-age=300
Expires: 2019年1月08日 14:32:49 GMT
Content-Length: 67
Connection: close
Content-Type: text/plain; charset=utf-8
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php
read:errno=0
answered Jan 8, 2019 at 14:30
2
  • Thanks, but still I don't get the file content: Starting Arduino web client. connecting... connected GET /robots.txt HTTP/1.1 Host: www.wepardi.fi Connection: close disconnecting. Commented Jan 8, 2019 at 14:56
  • Can you get any sort of feedback to the request? Commented Jan 8, 2019 at 15:17

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.