@@ -352,22 +352,18 @@ WEBCFG_STATUS parseMultipartDocument(void *config_data, char *ct , size_t data_s
352352 }
353353 if (0 == memcmp (ptr_lb , line_boundary , strlen (line_boundary )))
354354 {
355- ptr_lb = ptr_lb + (strlen (line_boundary ));
355+ ptr_lb = ptr_lb + (strlen (line_boundary ))- 1 ;
356356 num_of_parts = 1 ;
357357 while (0 != num_of_parts % 2 )
358358 {
359- ptr_lb = memchr (ptr_lb , '\n' , data_size - (ptr_lb - str_body ));
360- // printf("printing newline: %ld\n",ptr_lb-str_body);
361359 ptr_lb1 = memchr (ptr_lb + 1 , '\n' , data_size - (ptr_lb - str_body ));
362- // printf("printing newline2: %ld\n",ptr_lb1-str_body);
363360 if (0 != memcmp (ptr_lb1 - 1 , "\r" ,1 )){
364361 ptr_lb1 = memchr (ptr_lb1 + 1 , '\n' , data_size - (ptr_lb - str_body ));
365362 }
366363 index2 = ptr_lb1 - str_body ;
367364 index1 = ptr_lb - str_body ;
368365 parse_multipart (str_body + index1 + 1 ,index2 - index1 - 2 , & mp -> entries [count ]);
369366 ptr_lb ++ ;
370-
371367 if (0 == memcmp (ptr_lb , last_line_boundary , strlen (last_line_boundary )))
372368 {
373369 WebcfgDebug ("last line boundary inside \n" );
@@ -379,7 +375,8 @@ WEBCFG_STATUS parseMultipartDocument(void *config_data, char *ct , size_t data_s
379375 num_of_parts ++ ;
380376 count ++ ;
381377 }
382- }
378+ ptr_lb = memchr (ptr_lb , '\n' , data_size - (ptr_lb - str_body ));
379+ }
383380 }
384381 else
385382 {
@@ -397,7 +394,7 @@ WEBCFG_STATUS parseMultipartDocument(void *config_data, char *ct , size_t data_s
397394 }
398395 else
399396 {
400- WebcfgError ("processMsgpackSubdoc failed\n" );
397+ WebcfgError ("processMsgpackSubdoc failed,as all the docs are not applied \n" );
401398 }
402399 return WEBCFG_FAILURE ;
403400 }
@@ -482,7 +479,7 @@ WEBCFG_STATUS processMsgpackSubdoc(multipart_t *mp, char *transaction_id)
482479 reqParam [i ].type = pm -> entries [i ].type ;
483480 }
484481 }
485- WebcfgInfo ("Request:> param[%d].name = %s\n" ,i ,reqParam [i ].name );
482+ WebcfgInfo ("Request:> param[%d].name = %s, type = %d \n" ,i ,reqParam [i ].name , reqParam [ i ]. type );
486483 WebcfgDebug ("Request:> param[%d].value = %s\n" ,i ,reqParam [i ].value );
487484 WebcfgDebug ("Request:> param[%d].type = %d\n" ,i ,reqParam [i ].type );
488485 }
@@ -617,7 +614,7 @@ WEBCFG_STATUS processMsgpackSubdoc(multipart_t *mp, char *transaction_id)
617614 j -- ;
618615 temp1 = temp1 -> next ;
619616 }
620- WebcfgInfo ("addNewDocEntry\n" );
617+ WebcfgDebug ("addNewDocEntry\n" );
621618 addNewDocEntry (get_successDocCount ());
622619 }
623620
@@ -1243,8 +1240,18 @@ void multipart_destroy( multipart_t *m )
12431240
12441241void parse_multipart (char * ptr , int no_of_bytes , multipartdocs_t * m )
12451242{
1243+ char * Content_type = NULL ;
12461244 /*for storing respective values */
1247- if (0 == strncasecmp (ptr ,"Namespace" ,strlen ("Namespace" )))
1245+ if (0 == strncmp (ptr ,"Content-type: " ,strlen ("Content-type" )))
1246+ {
1247+ Content_type = strndup (ptr + (strlen ("Content-type: " )),no_of_bytes - ((strlen ("Content-type: " ))));
1248+ if (strncmp (Content_type , "application/msgpack" ,strlen ("application/msgpack" )) != 0 )
1249+ {
1250+ WebcfgError ("Content-type not msgpack: %s" , Content_type );
1251+ }
1252+ WEBCFG_FREE (Content_type );
1253+ }
1254+ else if (0 == strncasecmp (ptr ,"Namespace" ,strlen ("Namespace" )))
12481255 {
12491256 m -> name_space = strndup (ptr + (strlen ("Namespace: " )),no_of_bytes - ((strlen ("Namespace: " ))));
12501257 }
0 commit comments