-
Notifications
You must be signed in to change notification settings - Fork 2.1k
net/unicoap: Unified and Modular CoAP stack: Messaging and Minimal Server (pt 2) #21582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 7 commits
602b620
c078e80
92318c0
fde948c
dc75bc8
c0216cf
d579ab0
ae32c8f
ad8ebd6
755cdd8
98120ff
cc690df
5503d4f
4d00949
232a4e3
30a7f6e
8d3db35
6e3c37b
1d7061c
fd13630
d623b0a
f2208cb
e848212
cad01e2
3882e16
88e6d45
ad68328
8b9c225
eff8829
51d3a37
4345b6c
93d3379
6bb868c
5aafac3
ca60a48
fc4ee20
1861b3a
5e9bca9
8c69b0b
12987d0
9d2bbdd
339d9ad
3652c35
6a401f6
f0fe642
cc85bba
bff57dd
d4863b5
b8dca8f
1555fba
35787c4
5abe9e7
1c8483a
7223cd1
17a74e2
4334c7d
fc5ff18
44ea8d3
265f2cb
be62ad8
ab2a99d
4aab839
0ffd285
d391e27
9f99d5b
4b63e55
20dcf80
35bdd05
f1dd384
57123e1
438ad7f
2f0e872
9370c26
0c5ed49
6a8f77c
0cb5868
35a0100
15f49c4
78e3da3
277b634
7cd0ff7
c307339
eee23ef
a48ee62
cf5df59
95c0be4
dc7b68f
20cf4d7
a0eacaa
4b118b1
1b7984d
634a5d5
300f842
c7ad597
c8f4b65
0523502
af34573
28ec273
eedc942
cf3818c
fa1e31d
ec11bfb
dc097d0
47b3b00
e343b86
a166aa8
e7b4ef1
53c479e
a09f34a
d5578a3
01fe535
3f8c798
89580a5
7aa791e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| CONFIG_UNICOAP_DEBUG_LOGGING=y | ||
| CONFIG_UNICOAP_ASSIST=y | ||
| CONFIG_UNICOAP_DEBUG_LOGGING=n | ||
| CONFIG_UNICOAP_ASSIST=n | ||
| CONFIG_UNICOAP_CREATE_THREAD=y |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -863,28 +863,28 @@ ssize_t unicoap_options_get_next_query_by_name(unicoap_options_iterator_t* itera | |||||
| unicoap_option_number_t number, const char* name, | ||||||
| const char** value) | ||||||
| { | ||||||
| char* _name = NULL; | ||||||
| const char* component = NULL; | ||||||
| const uint8_t* _name = NULL; | ||||||
| const uint8_t* component = NULL; | ||||||
| ssize_t res = -1; | ||||||
| while ((res =unicoap_options_get_next_by_number(iterator, number, | ||||||
| (const uint8_t**)&component)) >= 0) { | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
or why would you still need this cast now that
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, I remember you saying you a doing this kind of casts in other places across unicoap, have you double-checked and changed? |
||||||
| assert(component); | ||||||
| _name = (char*)component; | ||||||
| _name = component; | ||||||
|
|
||||||
| while (res > 0 && *component != '=') { | ||||||
| component += 1; | ||||||
| res -= 1; | ||||||
| } | ||||||
|
|
||||||
| if (strncmp(name, _name, (uintptr_t)component - (uintptr_t)_name) != 0) { | ||||||
| if (strncmp(name, (char*)_name, (uintptr_t)component - (uintptr_t)_name) != 0) { | ||||||
| continue; | ||||||
| } | ||||||
|
|
||||||
| if (res > 0) { | ||||||
| assert(*component == '='); | ||||||
| component += 1; | ||||||
| res -= 1; | ||||||
| *value = component; | ||||||
| *value = (const char*)component; | ||||||
| } | ||||||
| else { | ||||||
| *value = NULL; | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -25,29 +25,70 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include "debug.h" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include "private.h" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** @brief Returns new length of path excluding trailing slashes */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| static inline size_t _trim_trailing_slashes(const char* path, size_t length) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (length > 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| size_t i = length - 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| while (i > 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (path[i] == '/') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| i -= 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return i + 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return length; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+31
to
+43
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
less indentation |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bool unicoap_resource_match_path_string(const unicoap_resource_t* resource, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
carl-tud marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const char* lhs_path, size_t lhs_length) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const char* lhs_path, size_t _lhs_length) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert(resource); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert(lhs_path); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* We are comparing the left-hand side (path from request) to the right-hand side (resource). */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is pretty bound to LHS = request path and RHS = resource definition path, why not reflecting that in the variable name instead of LHS and RHS? Would probably ease understanding. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| size_t rhs_length = strlen(resource->path); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert(rhs_length > 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| size_t lhs_length = _trim_trailing_slashes(lhs_path, _lhs_length); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (resource->flags & UNICOAP_RESOURCE_FLAG_MATCH_SUBTREE) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* The actual path (LHS) length may be longer. If it is shorter, bail out. */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (lhs_length < rhs_length) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* The actual path (LHS) is now either as long or longer. If it is longer, then we | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * expect a slash to indicate a subtree. Either the RHS path already ends with a slash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * or the LHS has a slash that succeeds the last RHS character. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+65
to
+66
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't get that part. Isn't LHS trimmed to have no slashes at the end? |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Examples: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * LHS: /a -> RHS ends in slash, every path that is longer than RHS is a subpath | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * RHS: / | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+70
to
+71
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
similar below |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * LHS: /a/a -> RHS ends in slash, every path that is longer than RHS is a subpath | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * RHS: /a/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+73
to
+74
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this basically the same case as the one above? |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * LHS: /a/a -> RHS does not end in slash, so we need to require one to indicate subpath | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * RHS: /a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (lhs_length > rhs_length && !(lhs_path[rhs_length] == '/' || resource->path[rhs_length - 1] == '/')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return strncmp(lhs_path, resource->path, rhs_length) == 0; /* RHS is null-terminated */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* The actual path (LHS) length must match. If it is unequal, bail out. */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (lhs_length != rhs_length) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return strncmp(lhs_path, resource->path, lhs_length) == 0; /* rhs is null-terminated */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return strncmp(lhs_path, resource->path, lhs_length) == 0; /* RHS is null-terminated */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bool unicoap_resource_match_path_options(const unicoap_resource_t* resource, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -63,38 +104,64 @@ bool unicoap_resource_match_path_options(const unicoap_resource_t* resource, | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| char* cursor = (char*)resource->path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const char* end = resource->path + strlen(resource->path); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
mguetschow marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* Skip multiple successive slashes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * https://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_266 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| while (*cursor == '/') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cursor += 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| char* start = cursor; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const char* component = NULL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* You might think, why not check cursor < end. To remove the need for end - 1 and bounds | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * checks, we use cursor <= end and treat that case as if the NULL-terminator were a slash. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * The slash/NULL-terminator signals to the loop that it is supposed to compare the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * sequence of characters it has read since the last slash to the current Uri-Path option. */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| while (cursor <= end) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* Found the end of a path component. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * That may either be a slash or the end of the string. */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ((*cursor == '/') || ((cursor != start) && (cursor == end))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const char* component; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| int res = -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ((res = unicoap_options_get_next_uri_path_component(&iterator, &component)) < 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* Cursor points to the element with the index one greater than the last character. */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| size_t size = (uintptr_t)cursor - (uintptr_t)start; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* Compare Uri-Path component with string path component. */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (((size_t)res != size) || (strncmp(start, component, size) != 0)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* Skip multiple successive slashes. */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| while (*cursor == '/') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cursor += 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| start = cursor; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* Skip over path component characters. */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cursor += 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (cursor != end + 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* If the resource's path is longer than the actual path, the paths definitely don't match. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * The end + 1 comparison is justified as we treat the NULL-terminator like a trailing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * slash. See above. */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (resource->flags & UNICOAP_RESOURCE_FLAG_MATCH_SUBTREE) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* There may be more Uri-Path options. But this is fine as subpaths are allowed. */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return cursor == (end + 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* Make sure we read all options, i.e., the actual path is not longer than the resource's. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return unicoap_options_get_next_uri_path_component(&iterator, &component) == -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -184,7 +251,6 @@ int unicoap_server_process_request(unicoap_packet_t* packet, const unicoap_resou | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert(packet); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assert(packet->remote); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| int res = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| unicoap_message_t* message = packet->message; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| unicoap_request_context_t context = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .resource = resource, ._packet = packet | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -197,15 +263,15 @@ int unicoap_server_process_request(unicoap_packet_t* packet, const unicoap_resou | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SERVER_DEBUG("invoking handler\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| res = resource->handler(message, &aux, &context, resource->handler_arg); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| res = resource->handler(packet->message, &aux, &context, resource->handler_arg); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (res > 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SERVER_DEBUG("sending response " UNICOAP_CODE_CLASS_DETAIL_FORMAT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| " from return value\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| unicoap_code_class((uint8_t)res), unicoap_code_detail((uint8_t)res)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (IS_ACTIVE(CONFIG_UNICOAP_PREVENT_OPTIONAL_RESPONSES)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (unicoap_response_is_optional(message->options, (unicoap_status_t)res)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (unicoap_response_is_optional(packet->message->options, (unicoap_status_t)res)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SERVER_DEBUG("response " UNICOAP_CODE_CLASS_DETAIL_FORMAT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| " is optional, not responding\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| unicoap_code_class((uint8_t)res), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -214,7 +280,7 @@ int unicoap_server_process_request(unicoap_packet_t* packet, const unicoap_resou | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| unicoap_response_init_empty(message, (unicoap_status_t)res); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| unicoap_response_init_empty(packet->message, (unicoap_status_t)res); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return unicoap_server_send_response_body(packet, resource); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else if (context._packet) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -229,8 +295,8 @@ int unicoap_server_process_request(unicoap_packet_t* packet, const unicoap_resou | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| FIXIT("set USEMODULE += unicoap_deferred_response and" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "call unicoap_defer_response") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FIXIT("ignore request by returning UNICOAP_IGNORING_REQUEST")); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| unicoap_response_init_string(message, UNICOAP_STATUS_INTERNAL_SERVER_ERROR, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "application"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| unicoap_response_init_string(packet->message, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| UNICOAP_STATUS_INTERNAL_SERVER_ERROR, "application"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| goto error; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.