mirror of mongrel-development@rubyforge.org (inactive)
 help / color / mirror / Atom feed
From: Eric Wong <normalperson-rMlxZR9MS24@public.gmane.org>
To: mongrel-development-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
Subject: Re: [PATCH] join repeated headers with a	comma
Date: Sun, 9 Aug 2009 17:19:54 -0700	[thread overview]
Message-ID: <20090810001954.GA18021@dcvr.yhbt.net> (raw)
In-Reply-To: <20090810001022.GA17572-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>

> --- a/ext/http11/http11.c
> +++ b/ext/http11/http11.c
> @@ -182,6 +182,7 @@ void http_field(void *data, const char *field, size_t flen, const char *value, s
>    VALUE req = (VALUE)data;
>    VALUE v = Qnil;
>    VALUE f = Qnil;
> +  VALUE e = Qnil;
>  
>    VALIDATE_MAX_LENGTH(flen, FIELD_NAME);
>    VALIDATE_MAX_LENGTH(vlen, FIELD_VALUE);

On second thought, we're doing the concatenation _after_ the length
validation.  I don't think this affects things much in practice since we
already have an overall header size limit and anything capable of
running Ruby/Mongrel shouldn't have to worry given about a few tens of
kilobytes...

> @@ -208,7 +209,13 @@ void http_field(void *data, const char *field, size_t flen, const char *value, s
>      /* fprintf(stderr, "UNKNOWN HEADER <%s>\n", RSTRING_PTR(f)); */
>    }
>  
> -  rb_hash_aset(req, f, v);
> +  e = rb_hash_aref(req, f);
> +  if (e == Qnil) {
> +    rb_hash_aset(req, f, v);
> +  } else {
> +    rb_str_buf_cat(e, ",", 1);
> +    rb_str_buf_append(e, v);
> +  }
>  }

      parent reply	other threads:[~2009-08-10  0:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-10  0:10 Eric Wong
     [not found] ` <20090810001022.GA17572-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2009-08-10  0:19   ` Eric Wong [this message]
replies disabled, historical list

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).