summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2013-06-08 02:23:46 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2013-06-08 02:23:46 +0200
commit66e78c45b555d54324f05adf6d51cbfe42c51bd4 (patch)
treebe969f23a2756aa6d3b35b61d3e4eb659cb77f2c
parent68ec1eb2e96a92d0a814309d60856151eb0d1581 (diff)
downloadneard-66e78c45b555d54324f05adf6d51cbfe42c51bd4.tar.gz
neard-66e78c45b555d54324f05adf6d51cbfe42c51bd4.tar.bz2
neard-66e78c45b555d54324f05adf6d51cbfe42c51bd4.zip
snep: Fix fragmented GET
When receiving a CONTINUE while nfc_data_length is set to 0, it must be a CONTINUE for a fragmented GET. The headers are thus read in order to modify snep_data->request and then process the right request. This fixes the GET fragmented unit test.
-rw-r--r--src/snep.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/snep.c b/src/snep.c
index 1e62c00..6256702 100644
--- a/src/snep.c
+++ b/src/snep.c
@@ -566,6 +566,18 @@ near_bool_t near_snep_core_read(int client_fd,
return TRUE;
}
+ /*
+ * This is a fragmentation SNEP operation since we have pending
+ * frames. But the ndef length and the current data length are
+ * identical. So this is a CONTINUE for a fragmented GET, and
+ * we should just process a CONTINUE frame and send the fragments
+ * back to the client. This will be done from snep_core_process_request().
+ */
+ if (snep_data != NULL) {
+ snep_data->request = frame.request;
+ goto process_request;
+ }
+
/* This is a new request from the client */
snep_data = g_try_malloc0(sizeof(struct p2p_snep_data));
if (snep_data == NULL)