Closed Johan-Henry closed 6 years ago
I solved the above with the cURL command: curl -k -v --key client_privkey.pem --cacert root_server_cert.pem --cert client_cert.pem -H 'Accept:' -X GET https://127.0.0.1:12437/coaps://[::1]:12436/resource
Hi @Johan-Henry, thanks for sharing your solution.
Unfortunately, when I tried it, I got this on the proxy:
Debug : [0] <0> 127.0.0.1 Received from HTTP client: GET /coaps://[::1]:12436/resource HTTP/1.1 Error : [0] <0> 127.0.0.1 Failed to convert HTTP message to CoAP message: Bad message Debug : [0] <0> 127.0.0.1 Sent to HTTP client: HTTP/1.1 400 Bad Request
Did you experience anything similar?
Thank you in advance
I don't know if there's a difference between our versions of curl
but I had to slightly modify http_msg.c
in order to remove the "extra" /
.
*** orig_http_msg.c 2017-09-12 09:23:23.341351000 +0200
--- http_msg.c 2017-09-12 09:22:38.685351000 +0200
*************** static ssize_t http_msg_parse_start(http
*** 272,277 ****
--- 272,283 ----
for (i = 0; i < HTTP_MSG_NUM_START; i++)
{
+ /* Remove unnecessary '/' */
+ if(*next == '/')
+ {
+ next++;
+ }
+
start = next;
if (i < HTTP_MSG_NUM_START - 1)
{
Hi, sorry for not getting back to you on your first question, but yes, I had to do the same modification. Quite a hack of a solution but it was sufficient for my testing.
Hi Joan, thank you very much for your comments. I would like to ask you a question. I have implemented FreCoAP on two PI cards of the latest model using the functions of test_CoAP_client and test_CoAP_client. I would like to know where I can change the size of the message that is sent from the client to the server. How could I also measure the transmission time: with a function to measure the execution time of the client and server codes? Thank you in advance
Good day
I have successfully implemented the HTTP/CoAP proxy application with the HTTP/TLS/IPv4 and CoAP/DTLS/IPv6 example as described in the README, however I would like to replace test_http_client with a standard cURL call. Will this be possible? I have made some progress and can successfully establish a https (tls) connection to the proxy from cURL by using the -k, --key, --cacert and --cert flags together with https://127.0.0.1:12437, however I am not sure where or how to specify the "POST coaps://[::1]:12436/resource" request string in cURL. Can you perhaps provide some guidence or an example?
Any help would be greatly appreciated. Regards