meghs94 / tinyos-main

Automatically exported from code.google.com/p/tinyos-main
1 stars 0 forks source link

[patch] Coap response codes are incorrect #88

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use something other than TinyOS to talk CoAP to a TinyOS node (like a recent 
libcoap client, for example).
2. Note how the result codes aren't interpreted correctly.

What is the expected output? What do you see instead?

The CoAP implementations should inter-operate. They don't, due to an error in 
the way the response codes were calculate. A "40" was used where a "32" should 
have been used (see patch).

What version of the product are you using? On what operating system?

2.x trunk.

Please provide any additional information below.

Original issue reported on code.google.com by jmatts...@dius.com.au on 25 Nov 2011 at 2:36

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by sdh...@gmail.com on 25 Nov 2011 at 5:40

GoogleCodeExporter commented 8 years ago
The libcoap codes are according to coap-03. Olaf is working on an update to 
coap-08. At the moment we don't plan to include that for the release.

The patch has the following codes:

+#define COAP_RESPONSE_100       32   /* 100 Continue */
+#define COAP_RESPONSE_200       64   /* 200 OK */
+#define COAP_RESPONSE_201       65   /* 201 Created */
+#define COAP_RESPONSE_304      100   /* 304 Not Modified */
+#define COAP_RESPONSE_400      128   /* 400 Bad Request */
+#define COAP_RESPONSE_404      132   /* 404 Not Found */
+#define COAP_RESPONSE_405      133   /* 405 Method Not Allowed */
+#define COAP_RESPONSE_415      143   /* 415 Unsupported Media Type */
+#define COAP_RESPONSE_500      160   /* 500 Internal Server Error */
+#define COAP_RESPONSE_503      163   /* 503 Service Unavailable */
+#define COAP_RESPONSE_504      164   /* 504 Gateway Timeout */

which is different from what coap-08 specifies:

           +------+-------------------------------+-----------+
           | Code | Description                   | Reference |
           +------+-------------------------------+-----------+
           |   65 | 2.01 Created                  | [RFCXXXX] |
           |   66 | 2.02 Deleted                  | [RFCXXXX] |
           |   67 | 2.03 Valid                    | [RFCXXXX] |
           |   68 | 2.04 Changed                  | [RFCXXXX] |
           |   69 | 2.05 Content                  | [RFCXXXX] |
           |  128 | 4.00 Bad Request              | [RFCXXXX] |
           |  129 | 4.01 Unauthorized             | [RFCXXXX] |
           |  130 | 4.02 Bad Option               | [RFCXXXX] |
           |  131 | 4.03 Forbidden                | [RFCXXXX] |
           |  132 | 4.04 Not Found                | [RFCXXXX] |
           |  133 | 4.05 Method Not Allowed       | [RFCXXXX] |
           |  134 | 4.06 Not Acceptable           | [RFCXXXX] |
           |  140 | 4.12 Precondition Failed      | [RFCXXXX] |
           |  141 | 4.13 Request Entity Too Large | [RFCXXXX] |
           |  143 | 4.15 Unsupported Media Type   | [RFCXXXX] |
           |  160 | 5.00 Internal Server Error    | [RFCXXXX] |
           |  161 | 5.01 Not Implemented          | [RFCXXXX] |
           |  162 | 5.02 Bad Gateway              | [RFCXXXX] |
           |  163 | 5.03 Service Unavailable      | [RFCXXXX] |
           |  164 | 5.04 Gateway Timeout          | [RFCXXXX] |
           |  165 | 5.05 Proxying Not Supported   | [RFCXXXX] |
           +------+-------------------------------+-----------+

Original comment by marku...@gmail.com on 26 Nov 2011 at 3:29

GoogleCodeExporter commented 8 years ago
Even better - looking forward to seeing that update!

Original comment by jmatts...@dius.com.au on 27 Nov 2011 at 10:57