Hi Mohamed,

> Append all multiple message-header fields with the same name and
> remove any white space in front of fiels value.
> ---
>  gweb/gweb.c |   34 +++++++++++++++++++++++++++++++---
>  1 files changed, 31 insertions(+), 3 deletions(-)
> 
> diff --git a/gweb/gweb.c b/gweb/gweb.c
> index c6a76cc..87c323a 100644
> --- a/gweb/gweb.c
> +++ b/gweb/gweb.c
> @@ -786,17 +786,45 @@ static gboolean received_data(GIOChannel *channel, 
> GIOCondition cond,
>                                       g_strdup(str));
>                       }
>               } else {
> +                     gchar *key;
> +                     gchar *value;
> +
>                       pos = memchr(str, ':', session->current_header->len);
>                       if (pos != NULL) {
>                               *pos = '\0';
>                               pos++;
>  
> +                             key = g_strdup(str);
> +
> +                             /* remove white space */
> +                             while (*pos == ' ')
> +                                     pos++;
> +
> +                             count = (char *)pos - str;
> +                             g_string_erase(session->current_header, 0,
> +                                                                     count);
> +
> +                             value = g_hash_table_lookup(
> +                                             session->result.headers, key);
> +                             if (value != NULL) {
> +                                     g_string_insert_c(
> +                                                     session->current_header,
> +                                                                     0, ' ');
> +                                     g_string_insert_c(
> +                                                     session->current_header,
> +                                                                     0, ';');
> +
> +                                     g_string_insert(session->current_header,
> +                                                             0, value);
> +                             }
> +

this gets a little bit too nested for my taste. Can you try to make this
whole function a lot more simpler. We need to split things out here.

Regards

Marcel


_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to