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.

  • in browser you enter www.wepardi.fi and in arduino only wepardi.fi – Juraj Jan 8 at 14:36
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.

New contributor
Tiina is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
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: Tue, 08 Jan 2019 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: Wed, 23 Jan 2019 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: Tue, 08 Jan 2019 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: Tue, 08 Jan 2019 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
  • 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. – Tiina Jan 8 at 14:56
  • Can you get any sort of feedback to the request? – Majenko Jan 8 at 15:17

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.