diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-08-18 23:28:31 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-08-18 23:28:31 -0700 |
commit | 79bba4abefb57f12b54ddd338ed8f9ec828b5e89 (patch) | |
tree | f8584c5cb38a062f3f4d772d9e24894e5e00d42c | |
parent | b1ea62b4d19cf8604aee273c868688631d7135d4 (diff) | |
download | unicorn-79bba4abefb57f12b54ddd338ed8f9ec828b5e89.tar.gz |
Ruby strings may be copy-on-write (multiple #dup'ed strings can point to the same internal buffers). So since HttpParser#headers modifies its buffer argument, we'll need to make sure the String object we have points to its own private buffer. This doesn't affect Unicorn except in a to-be-written test case that relies on a #dup'ed String.
-rw-r--r-- | ext/unicorn_http/unicorn_http.rl | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/unicorn_http/unicorn_http.rl b/ext/unicorn_http/unicorn_http.rl index 19091f4..ed9c359 100644 --- a/ext/unicorn_http/unicorn_http.rl +++ b/ext/unicorn_http/unicorn_http.rl @@ -383,6 +383,8 @@ static void advance_str(VALUE str, off_t nr) if (len == 0) return; + rb_str_modify(str); + assert(nr <= len); len -= nr; if (len > 0) /* unlikely, len is usually 0 */ |