2 * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 #include "download-agent-http-msg-handler.h"
22 #include "download-agent-debug.h"
23 #include "download-agent-encoding.h"
25 // '.' and ';' are request from Vodafone
26 #define IS_TERMINATING_CHAR(c) ( ((c) == ';') || ((c) == '\0') || ((c) == 0x0d) || ((c) == 0x0a) || ((c) == 0x20) )
27 #define IS_TERMINATING_CHAR_EX(c) ( ((c) == '"') || ((c) == ';') || ((c) == '\0') || ((c) == 0x0d) || ((c) == 0x0a) || ((c) == 0x20) )
28 #define IS_URI_TERMINATING_CHAR(c) ( ((c) == '\0') || ((c) == 0x0d) || ((c) == 0x0a) || ((c) == 0x20) )
32 WITHOUT_PARSING_OPTION
35 static da_ret_t __http_header_add_field(http_header_t **head,
36 const char *field, const char *value, enum parsing_type type);
37 static void __http_header_destroy_all_field(http_header_t **head);
38 static da_bool_t __get_http_header_for_field(
39 http_msg_response_t *http_msg_response, const char *in_field,
40 http_header_t **out_header);
41 static void __exchange_header_value(http_header_t *header,
42 const char *in_raw_value);
43 static http_header_options_t *__create_http_header_option(const char *field,
45 static void __http_header_destroy_all_option(http_header_options_t **head);
46 static da_bool_t __get_http_header_option_for_field(
47 http_header_options_t *header_option, const char *in_field,
49 static http_header_options_t *__parsing_N_create_option_str(char *org_str);
50 static http_header_options_t *__parsing_options(char *org_str);
51 static void __parsing_raw_value(http_header_t *http_header);
53 da_ret_t http_msg_request_create(http_msg_request_t **http_msg_request)
55 http_msg_request_t *temp_http_msg_request = NULL;
59 temp_http_msg_request = (http_msg_request_t *)calloc(1,
60 sizeof(http_msg_request_t));
61 if (!temp_http_msg_request) {
62 *http_msg_request = NULL;
63 DA_LOGE("DA_ERR_FAIL_TO_MEMALLOC");
64 return DA_ERR_FAIL_TO_MEMALLOC;
67 temp_http_msg_request->http_method = NULL;
68 temp_http_msg_request->url = NULL;
69 temp_http_msg_request->head = NULL;
70 temp_http_msg_request->http_body = NULL;
72 *http_msg_request = temp_http_msg_request;
73 DA_LOGV( "http_msg_request: %x", (unsigned int)(*http_msg_request));
78 void http_msg_request_destroy(http_msg_request_t **http_msg_request)
80 http_msg_request_t *temp_http_msg_request = *http_msg_request;
84 if (temp_http_msg_request) {
85 if (temp_http_msg_request->http_method) {
86 free(temp_http_msg_request->http_method);
87 temp_http_msg_request->http_method = NULL;
89 if (temp_http_msg_request->url) {
90 free(temp_http_msg_request->url);
91 temp_http_msg_request->url = NULL;
93 if (temp_http_msg_request->http_body) {
94 free(temp_http_msg_request->http_body);
95 temp_http_msg_request->http_body = NULL;
97 __http_header_destroy_all_field(&(temp_http_msg_request->head));
98 free(*http_msg_request);
99 *http_msg_request = NULL;
103 da_ret_t http_msg_request_set_url(http_msg_request_t *http_msg_request,
108 if (!http_msg_request) {
109 DA_LOGE("http_msg_request is NULL; DA_ERR_INVALID_ARGUMENT");
110 return DA_ERR_INVALID_ARGUMENT;
114 DA_LOGE("url is NULL; DA_ERR_INVALID_ARGUMENT");
115 return DA_ERR_INVALID_URL;
118 http_msg_request->url = strdup(url);
119 DA_SECURE_LOGI("http url[%s]", http_msg_request->url);
123 da_ret_t http_msg_request_get_url(http_msg_request_t *http_msg_request,
128 if (!http_msg_request) {
129 DA_LOGE("http_msg_request is NULL; DA_ERR_INVALID_ARGUMENT");
130 return DA_ERR_INVALID_ARGUMENT;
133 if (http_msg_request->url) {
134 *url = http_msg_request->url;
138 return DA_ERR_INVALID_ARGUMENT;
142 da_ret_t http_msg_request_add_field(http_msg_request_t *http_msg_request,
143 const char *field, const char *value)
147 if (!http_msg_request) {
148 DA_LOGE("Check NULL! : http_msg_request");
149 return DA_ERR_INVALID_ARGUMENT;
152 return __http_header_add_field(&(http_msg_request->head), field, value, WITHOUT_PARSING_OPTION);
155 da_ret_t http_msg_response_create(http_msg_response_t **http_msg_response)
157 http_msg_response_t *temp_http_msg_response = NULL;
161 temp_http_msg_response = (http_msg_response_t *)calloc(1,
162 sizeof(http_msg_response_t));
163 if (!temp_http_msg_response) {
164 DA_LOGE("DA_ERR_FAIL_TO_MEMALLOC");
165 return DA_ERR_FAIL_TO_MEMALLOC;
167 temp_http_msg_response->status_code = 0;
168 temp_http_msg_response->head = NULL;
169 *http_msg_response = temp_http_msg_response;
174 void http_msg_response_destroy(http_msg_response_t **http_msg_response)
176 http_msg_response_t *temp_http_msg_response = *http_msg_response;
179 if (temp_http_msg_response) {
180 __http_header_destroy_all_field(&(temp_http_msg_response->head));
181 free(*http_msg_response);
182 *http_msg_response = DA_NULL;
186 da_ret_t http_msg_response_add_field(http_msg_response_t *http_msg_response,
187 const char *field, const char *value)
191 if (!http_msg_response) {
192 DA_LOGE("DA_ERR_INVALID_ARGUMENT");
193 return DA_ERR_INVALID_ARGUMENT;
195 return __http_header_add_field(&(http_msg_response->head), field, value, WITH_PARSING_OPTION);
198 da_ret_t __http_header_add_field(http_header_t **head,
199 const char *field, const char *value, enum parsing_type type)
201 http_header_t *pre = NULL;
202 http_header_t *cur = NULL;
204 //DA_SECURE_LOGD("[%s][%s]", field, value);
209 /* Replace default value with user wanted value
210 * Remove the value which is stored before and add a new value.
212 if (cur->field && cur->raw_value &&
213 strncasecmp(cur->field, field, strlen(field)) == 0) {
214 DA_SECURE_LOGD("Remove value for replacement [%s][%s]", cur->field, cur->raw_value);
219 if (cur->raw_value) {
220 free(cur->raw_value);
221 cur->raw_value= NULL;
227 cur = (http_header_t *)calloc(1, sizeof(http_header_t));
229 cur->field = strdup(field);
230 cur->raw_value = strdup(value);
234 if (type == WITHOUT_PARSING_OPTION) {
235 cur->value = strdup(value);
238 __parsing_raw_value(cur);
246 DA_LOGE("DA_ERR_FAIL_TO_MEMALLOC");
247 return DA_ERR_FAIL_TO_MEMALLOC;
253 void __http_header_destroy_all_field(http_header_t **head)
255 http_header_t *pre = NULL;
256 http_header_t *cur = NULL;
263 cur->field = DA_NULL;
267 cur->value = DA_NULL;
269 if (cur->raw_value) {
270 free(cur->raw_value);
271 cur->raw_value = DA_NULL;
273 __http_header_destroy_all_option(&(cur->options));
275 cur->options = DA_NULL;
283 http_header_options_t *__create_http_header_option(const char *field,
286 http_header_options_t *option = NULL;
288 option = (http_header_options_t *)calloc(1,
289 sizeof(http_header_options_t));
292 option->field = strdup(field);
294 option->value = strdup(value);
300 void __http_header_destroy_all_option(http_header_options_t **head)
302 http_header_options_t *pre = NULL;
303 http_header_options_t *cur = NULL;
311 DA_SECURE_LOGD("field= %s", cur->field);
313 cur->field = DA_NULL;
317 cur->value = DA_NULL;
326 da_ret_t http_msg_request_get_iter(http_msg_request_t *http_msg_request,
327 http_msg_iter_t *http_msg_iter)
331 if (!http_msg_request) {
332 DA_LOGE("DA_ERR_INVALID_ARGUMENT");
333 return DA_ERR_INVALID_ARGUMENT;
336 *http_msg_iter = http_msg_request->head;
341 da_ret_t http_msg_response_get_iter(http_msg_response_t *http_msg_response,
342 http_msg_iter_t *http_msg_iter)
344 if (!http_msg_response) {
345 DA_LOGE("DA_ERR_INVALID_ARGUMENT");
346 return DA_ERR_INVALID_ARGUMENT;
349 *http_msg_iter = http_msg_response->head;
353 da_bool_t http_msg_get_field_with_iter(http_msg_iter_t *http_msg_iter,
354 char **out_field, char **out_value)
356 http_header_t *cur = *http_msg_iter;
359 *out_field = cur->field;
360 *out_value = cur->value;
361 *http_msg_iter = cur->next;
368 da_bool_t http_msg_get_header_with_iter(http_msg_iter_t *http_msg_iter,
369 char **out_field, http_header_t **out_header)
371 http_header_t *cur = *http_msg_iter;
374 *out_field = cur->field;
376 *http_msg_iter = cur->next;
383 http_header_options_t *__parsing_N_create_option_str(char *org_str)
385 char *option_field = NULL;
386 char *option_value = NULL;
387 int option_field_len = 0;
388 int option_value_len = 0;
389 char *org_pos = NULL;
391 char *working_str = NULL;
392 char *working_pos = NULL;
393 char *working_pos_field_start = NULL;
394 char *working_pos_value_start = NULL;
395 da_bool_t is_inside_quotation = DA_FALSE;
396 da_bool_t is_working_for_field = DA_TRUE;
398 http_header_options_t *option = NULL;
405 org_str_len = strlen(org_str);
406 if (org_str_len <= 0)
409 working_str = (char *)calloc(1, org_str_len + 1);
414 working_pos_field_start = working_pos = working_str;
416 for (i = 0; i < org_str_len; i++) {
418 is_inside_quotation = !is_inside_quotation;
419 if (is_inside_quotation) {
420 // Leave anything including blank if it is inside of double quotation mark.
421 *working_pos = *org_pos;
422 is_working_for_field ? option_field_len++
423 : option_value_len++;
427 if (*org_pos == ' ') {
429 } else if (*org_pos == '=') {
430 if (is_working_for_field) {
431 is_working_for_field = DA_FALSE;
432 working_pos_value_start = working_pos;
436 *working_pos = *org_pos;
437 is_working_for_field ? option_field_len++
438 : option_value_len++;
445 if (option_field_len > 0 && working_pos_field_start) {
446 option_field = (char *)calloc(1, option_field_len + 1);
448 strncpy(option_field, working_pos_field_start,
451 if (option_value_len > 0 && working_pos_value_start) {
452 option_value = (char *)calloc(1, option_value_len + 1);
454 strncpy(option_value, working_pos_value_start,
459 working_pos = working_str = NULL;
462 DA_SECURE_LOGD("option_field = [%s], option_value = [%s]",
463 option_field, option_value);
465 if (option_field || option_value) {
466 option = __create_http_header_option(
467 option_field, option_value);
480 http_header_options_t *__parsing_options(char *org_str)
482 da_ret_t ret = DA_RESULT_OK;
483 http_header_options_t *head = NULL;
484 http_header_options_t *pre = NULL;
485 http_header_options_t *cur = NULL;
487 int wanted_str_len = 0;
488 char *wanted_str = NULL;
489 char *wanted_str_start = NULL;
490 char *wanted_str_end = NULL;
491 char *cur_pos = NULL;
498 /* Do Not use strtok(). It's not thread safe. */
499 // DA_SECURE_LOGD("org_str = %s", org_str);
504 wanted_str_start = cur_pos;
505 wanted_str_end = strchr(cur_pos, ';');
506 if (wanted_str_end) {
507 cur_pos = wanted_str_end + 1;
509 wanted_str_end = org_str + strlen(org_str);
512 wanted_str_len = wanted_str_end - wanted_str_start;
513 wanted_str = (char *)calloc(1, wanted_str_len + 1);
515 DA_LOGE("DA_ERR_FAIL_TO_MEMALLOC");
516 ret = DA_ERR_FAIL_TO_MEMALLOC;
519 strncpy(wanted_str, wanted_str_start, wanted_str_len);
521 // DA_SECURE_LOGD("wanted_str = [%s]", wanted_str);
522 cur = __parsing_N_create_option_str(wanted_str);
535 if (ret != DA_RESULT_OK)
536 __http_header_destroy_all_option(&head);
540 void __parsing_raw_value(http_header_t *http_header_field)
542 char *raw_value = NULL;
543 char *option_str_start = NULL;
544 char *trimed_value = NULL;
545 int trimed_value_len = 0;
546 char *trimed_value_start = NULL;
547 char *trimed_value_end = NULL;
549 raw_value = http_header_field->raw_value;
550 // DA_SECURE_LOGD("raw_value = [%s]", raw_value);
555 trimed_value_start = raw_value;
556 trimed_value_end = strchr(raw_value, ';');
557 if (!trimed_value_end) {
559 http_header_field->value = strdup(raw_value);
560 http_header_field->options = NULL;
566 trimed_value_len = trimed_value_end - trimed_value_start;
567 trimed_value = (char *)calloc(1, trimed_value_len + 1);
569 DA_LOGE("DA_ERR_FAIL_TO_MEMALLOC");
572 strncpy(trimed_value, trimed_value_start, trimed_value_len);
573 http_header_field->value = trimed_value;
575 // for option parsing
576 option_str_start = trimed_value_end + 1;
577 http_header_field->options = __parsing_options(option_str_start);
580 http_header_options_t *cur = NULL;
581 cur = http_header_field->options;
583 // DA_SECURE_LOGD("field = [%s], value = [%s]", cur->field, cur->value);
588 da_bool_t __get_http_header_option_for_field(
589 http_header_options_t *header_option, const char *in_field,
592 http_header_options_t *cur = NULL;
596 if (!header_option) {
597 DA_LOGE("input header_option is NULL.");
604 if (!strncasecmp(cur->field, in_field, strlen(cur->field)) &&
606 DA_SECURE_LOGD("[%s][%s]", cur->field, cur->value);
607 *out_value = cur->value;
617 da_bool_t __get_http_header_for_field(http_msg_response_t *http_msg_response,
618 const char *in_field, http_header_t **out_header)
620 http_msg_iter_t http_msg_iter;
621 http_header_t *header = NULL;
626 http_msg_response_get_iter(http_msg_response, &http_msg_iter);
627 while (http_msg_get_header_with_iter(&http_msg_iter, &field, &header)) {
628 if (field && header && !strncasecmp(field, in_field, strlen(field))) {
629 //DA_SECURE_LOGD("[%s][%s]", field, header->value);
630 *out_header = header;
638 da_bool_t __get_http_req_header_for_field(http_msg_request_t *http_msg_request,
639 const char *in_field, http_header_t **out_header)
641 http_msg_iter_t http_msg_iter;
642 http_header_t *header = NULL;
647 http_msg_request_get_iter(http_msg_request, &http_msg_iter);
648 while (http_msg_get_header_with_iter(&http_msg_iter, &field, &header)) {
649 if (field && header && !strncasecmp(field, in_field, strlen(field))) {
650 //DA_SECURE_LOGD("[%s][%s]", field, header->value);
651 *out_header = header;
659 void __exchange_header_value(http_header_t *header, const char *in_raw_value)
663 if (!header || !in_raw_value)
666 __http_header_destroy_all_option(&(header->options));
670 header->value = DA_NULL;
672 if (header->raw_value)
673 free(header->raw_value);
674 header->raw_value = strdup(in_raw_value);
676 __parsing_raw_value(header);
679 da_bool_t http_msg_response_get_content_type(
680 http_msg_response_t *http_msg_response, char **out_type)
682 da_bool_t b_ret = DA_FALSE;
683 http_header_t *header = NULL;
687 b_ret = __get_http_header_for_field(http_msg_response,
688 HTTP_FIELD_CONTENT_TYPE, &header);
690 DA_LOGV("no Content-Type");
694 *out_type = strdup(header->value);
699 void http_msg_response_set_content_type(http_msg_response_t *http_msg_response,
702 da_bool_t b_ret = DA_FALSE;
703 http_header_t *header = NULL;
707 if (!http_msg_response || !in_type)
710 b_ret = __get_http_header_for_field(http_msg_response,
711 HTTP_FIELD_CONTENT_TYPE, &header);
713 if (header->raw_value && (!strncmp(header->raw_value, in_type,
714 strlen(header->raw_value))))
717 DA_SECURE_LOGD("exchange Content-Type to [%s] from [%s]", in_type, header->value);
718 __exchange_header_value(header, in_type);
720 __http_header_add_field(&(http_msg_response->head),
721 HTTP_FIELD_CONTENT_TYPE, in_type, WITH_PARSING_OPTION);
725 da_bool_t http_msg_response_get_content_length(
726 http_msg_response_t *http_msg_response, da_size_t *out_length)
728 da_bool_t b_ret = DA_FALSE;
729 http_header_t *header = NULL;
733 b_ret = __get_http_header_for_field(http_msg_response,
734 HTTP_FIELD_CONTENT_LENGTH, &header);
736 DA_LOGV( "no Content-Length");
741 *out_length = atoll(header->value);
746 da_bool_t http_msg_response_get_content_disposition(
747 http_msg_response_t *http_msg_response, char **out_disposition,
748 char **out_file_name)
750 da_bool_t b_ret = DA_FALSE;
751 http_header_t *header = NULL;
752 char *file_name = NULL;
753 char *wanted_str = NULL;
754 char *wanted_str_start = NULL;
755 char *wanted_str_end = NULL;
756 char *decoded_str = NULL;
757 int wanted_str_len = 0;
761 b_ret = __get_http_header_for_field(http_msg_response,
762 HTTP_FIELD_CONTENT_DISPOSITION, &header);
764 DA_LOGV( "no Content-Disposition");
768 *out_disposition = strdup(header->value);
772 b_ret = __get_http_header_option_for_field(header->options, "filename",
775 DA_LOGV( "no option");
779 // eliminate double quotation mark if it exists on derived value
780 wanted_str_start = strchr(file_name, '"');
781 if (!wanted_str_start) {
782 *out_file_name = strdup(file_name);
785 // DA_SECURE_LOGD("wanted_str_start = [%s]", wanted_str_start);
787 wanted_str_end = strchr(wanted_str_start, '"');
788 if (wanted_str_end) {
789 wanted_str_len = wanted_str_end - wanted_str_start;
790 wanted_str = (char*)calloc(1, wanted_str_len + 1);
792 DA_LOGE("DA_ERR_FAIL_TO_MEMALLOC");
795 strncpy(wanted_str, wanted_str_start, wanted_str_len);
797 b_ret = is_base64_encoded_word(wanted_str);
799 DA_LOGV("It's base64 encoded-word string");
800 if (DA_RESULT_OK == decode_base64_encoded_str(
801 wanted_str, &decoded_str)) {
802 DA_SECURE_LOGD("base64 decoded str = [%s]", decoded_str);
804 wanted_str = decoded_str;
807 DA_LOGV("Fail to base64 decode. Just use un-decoded string.");
810 DA_LOGV("It's NOT base64 encoded-word string");
812 decode_url_encoded_str(wanted_str, &decoded_str);
813 /* If it is url encoded string */
815 DA_SECURE_LOGD("Url decoded str = [%s]", decoded_str);
817 wanted_str = decoded_str;
820 *out_file_name = wanted_str;
821 DA_SECURE_LOGI("out_file_name = [%s]", *out_file_name);
824 DA_LOGE("Not matched \" !");
830 da_bool_t http_msg_response_get_ETag(http_msg_response_t *http_msg_response,
833 da_bool_t b_ret = DA_FALSE;
834 http_header_t *header = NULL;
838 b_ret = __get_http_header_for_field(http_msg_response, HTTP_FIELD_ETAG,
845 *out_value = strdup(header->value);
851 da_bool_t http_msg_response_get_RAF_mode(http_msg_response_t *http_msg_response,
854 da_bool_t b_ret = DA_FALSE;
855 http_header_t *header = NULL;
859 b_ret = __get_http_header_for_field(http_msg_response, HTTP_FIELD_RAF_MODE,
862 DA_LOGV( "no RAF mode");
866 *out_value = strdup(header->value);
872 da_bool_t http_msg_response_get_date(http_msg_response_t *http_msg_response,
875 da_bool_t b_ret = DA_FALSE;
876 http_header_t *header = NULL;
880 b_ret = __get_http_header_for_field(http_msg_response,
881 HTTP_FIELD_DATA, &header);
887 *out_value = strdup(header->value);
892 da_bool_t http_msg_response_get_location(http_msg_response_t *http_msg_response,
895 da_bool_t b_ret = DA_FALSE;
896 http_header_t *header = NULL;
900 b_ret = __get_http_header_for_field(http_msg_response,
901 HTTP_FIELD_LOCATION, &header);
903 DA_LOGV( "no Location");
907 *out_value = strdup(header->value);
912 char *__stristr(const char *long_str, const char *find_str)
917 char *ret_ptr = NULL;
918 char *org_ptr = NULL;
919 char *look_ptr = NULL;
921 if (long_str == NULL || find_str == NULL) {
922 DA_LOGE("INVALID ARGUMENT");
926 length_long = strlen(long_str);
927 length_find = strlen(find_str);
929 org_ptr = (char*)calloc(1, length_long + 1);
931 if (org_ptr == NULL) {
932 DA_LOGE("INVALID ARGUMENT");
936 look_ptr = (char*)calloc(1, length_find + 1);
938 if (look_ptr == NULL) {
939 DA_LOGE("INVALID ARGUMENT");
944 while (i < length_long) {
945 if (isalpha(long_str[i]) != 0) {
946 if (isupper(long_str[i]) != 0) {
947 org_ptr[i] = long_str[i];
949 org_ptr[i] = toupper(long_str[i]);
952 org_ptr[i] = long_str[i];
959 while (i < length_find) {
960 if (isalpha(find_str[i]) != 0) {
961 if (isupper(find_str[i]) != 0) {
962 look_ptr[i] = find_str[i];
964 look_ptr[i] = toupper(find_str[i]);
967 look_ptr[i] = find_str[i];
972 ret_ptr = strstr(org_ptr, look_ptr);
979 i = ret_ptr - org_ptr;
985 return (char*)(long_str + i);
988 /* This is not used. But it can be needed if there is no http header parser at http library.*/
989 da_bool_t extract_attribute_from_header(
991 const char *szFindStr,
994 char *pValuePos = NULL;
998 int need_to_end_quataion_mark = 0;
1000 if (szHeadStr == DA_NULL || szFindStr == DA_NULL) {
1001 DA_LOGE("INVALID ARGUMENT");
1004 if (strlen(szHeadStr) <= 0 || strlen(szFindStr) <= 0) {
1005 DA_LOGE("INVALID ARGUMENT");;
1009 if (ppRtnValue == NULL) {
1013 pValuePos = __stristr(szHeadStr, (char*)szFindStr);
1014 if (pValuePos == NULL) {
1019 index = strlen(szFindStr);
1021 while (pValuePos[index] != ':' && pValuePos[index] != '=') {
1024 if (pValuePos[index] == '\0') {
1032 while (pValuePos[index] == ' ') {
1036 /* jump quatation mark */
1037 while (pValuePos[index] == '"') {
1038 need_to_end_quataion_mark = 1;
1044 /* Find the end of data. */
1045 if (0 == strncasecmp(szFindStr, HTTP_FIELD_LOCATION,
1046 strlen(HTTP_FIELD_LOCATION)))//terminate character list does not contain ';' in case of URI
1048 while (DA_FALSE == IS_URI_TERMINATING_CHAR(pValuePos[index])) {
1051 } else if (need_to_end_quataion_mark) {
1052 while (DA_FALSE == IS_TERMINATING_CHAR_EX(pValuePos[index])) {
1056 while (DA_FALSE == IS_TERMINATING_CHAR(pValuePos[index])) {
1061 strLen = index - startPos;
1064 DA_LOGE(" strLen is < 1");
1068 *ppRtnValue = (char*)calloc(1, sizeof(char) * (strLen + 1));
1070 if (*ppRtnValue == NULL) {
1071 DA_LOGE(" *ppRtnValue is NULL");
1075 strncpy(*ppRtnValue, pValuePos + startPos, strLen);
1076 *(*ppRtnValue + strLen) = '\0';
1087 da_bool_t http_msg_request_get_if_range(http_msg_request_t *http_msg_request,
1090 da_bool_t b_ret = DA_FALSE;
1091 http_header_t *header = NULL;
1095 b_ret = __get_http_req_header_for_field(http_msg_request, HTTP_FIELD_IF_RANGE,
1098 DA_LOGV( "no If Range");
1102 *out_value = strdup(header->value);
1107 da_bool_t http_msg_request_get_range(http_msg_request_t *http_msg_request,
1110 da_bool_t b_ret = DA_FALSE;
1111 http_header_t *header = NULL;
1115 b_ret = __get_http_req_header_for_field(http_msg_request, HTTP_FIELD_RANGE,
1118 DA_LOGV( "no Range");
1122 *out_value = strdup(header->value);