Change as do not set CONTENT_FORMAT OPT when server response without payload.
authorbg.chun <bg.chun@samsung.com>
Fri, 8 Jul 2016 01:55:19 +0000 (10:55 +0900)
committerJon A. Cruz <jon@joncruz.org>
Wed, 13 Jul 2016 19:43:42 +0000 (19:43 +0000)
On current impl server add CONTENT_FORMAT OPT when response to client, if CONTENT_FORMAT setted on client request.
even payload is not exist on server response.
So, change it as check payload is exist on response before put CONTENT_FORMAT.

Reported-by: byonggon chun
Change-Id: Iced9952adb55304440089c32d658359a67f1dcd5
Signed-off-by: bg.chun <bg.chun@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/9233
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Jaewook Jung <jw0213.jung@samsung.com>
Reviewed-by: Jaehong Jo <jaehong.jo@samsung.com>
Reviewed-by: Jon A. Cruz <jon@joncruz.org>
resource/csdk/stack/src/ocserverrequest.c

index 2b4d1b3..d46f889 100644 (file)
@@ -642,7 +642,11 @@ OCStackResult HandleSingleResponse(OCEntityHandlerResponse * ehResponse)
                     OICFree(responseInfo.info.options);
                     return result;
                 }
-                responseInfo.info.payloadFormat = CA_FORMAT_APPLICATION_CBOR;
+                //Add CONTENT_FORMAT OPT if payload exist
+                if (responseInfo.info.payloadSize > 0)
+                {
+                    responseInfo.info.payloadFormat = CA_FORMAT_APPLICATION_CBOR;
+                }
                 break;
             default:
                 responseInfo.result = CA_NOT_ACCEPTABLE;