split proxy uri to multiple options when exceeding 270 bytes

This commit is contained in:
Olaf Bergmann committed 2012-07-04 15:58:21 +02:00
1 parent dc04333820
commit a3f8fdaa59
1 file changed
+13 -5
+13 -5
View File
@@ -634,12 +634,20 @@ cmdline_uri(char *arg) {
int res;
if (proxy.length) { /* create Proxy-Uri from argument */
size_t len = strlen(arg);
while (len > 270) {
coap_insert(&optlist,
new_option_node(COAP_OPTION_PROXY_URI,
270, (unsigned char *)arg),
order_opts);
len -= 270;
arg += 270;
}
coap_insert( &optlist,
new_option_node(COAP_OPTION_PROXY_URI,
strlen(arg), (unsigned char *)arg),
order_opts);
coap_insert(&optlist,
new_option_node(COAP_OPTION_PROXY_URI,
len, (unsigned char *)arg),
order_opts);
} else { /* split arg into Uri-* options */
coap_split_uri((unsigned char *)arg, strlen(arg), &uri );