Skip to content

Commit

Permalink
coap_uri.c: Fix support for app doing CoAP <> HTTP mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdeep1 committed May 14, 2024
1 parent e521eab commit b4a011a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions examples/coap-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,9 @@ hnd_proxy_uri(coap_resource_t *resource COAP_UNUSED,
if (uri.scheme == COAP_URI_SCHEME_COAP ||
uri.scheme == COAP_URI_SCHEME_COAPS ||
uri.scheme == COAP_URI_SCHEME_COAP_TCP ||
uri.scheme == COAP_URI_SCHEME_COAPS_TCP) {
uri.scheme == COAP_URI_SCHEME_COAPS_TCP ||
uri.scheme == COAP_URI_SCHEME_COAP_WS ||
uri.scheme == COAP_URI_SCHEME_COAPS_WS) {
coap_pdu_code_t req_code = coap_pdu_get_code(request);
coap_pdu_type_t req_type = coap_pdu_get_type(request);

Expand Down Expand Up @@ -1167,7 +1169,7 @@ hnd_proxy_uri(coap_resource_t *resource COAP_UNUSED,
goto cleanup;
} else {
/* TODO http & https */
coap_log_err("Proxy-Uri scheme %d unknown\n", uri.scheme);
coap_log_err("Proxy-Uri scheme %d not currently supported\n", uri.scheme);
}
cleanup:
coap_delete_string(uri_path);
Expand Down
4 changes: 3 additions & 1 deletion src/coap_uri.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ coap_split_uri_sub(const uint8_t *str_var,
}
break;
case COAP_URI_SCHEME_COAPS_TCP:
if (!coap_tcp_is_supported()) {
if (!coap_tls_is_supported()) {
coap_log_err("coaps+tcp URI scheme not supported in this version of libcoap\n");
return -1;
}
Expand All @@ -151,6 +151,8 @@ coap_split_uri_sub(const uint8_t *str_var,
break;
case COAP_URI_SCHEME_HTTP:
case COAP_URI_SCHEME_HTTPS:
/* Not proxy, caught above. For proxy, assume app is doing CoAP <> HTTP mapping. */
break;
case COAP_URI_SCHEME_LAST:
default:
coap_log_warn("Unsupported URI type %d\n", uri->scheme);
Expand Down

0 comments on commit b4a011a

Please sign in to comment.