about summary refs log tree commit homepage
path: root/ext
DateCommit message (Collapse)
2009-03-29http11: use :http_body instead of "HTTP_BODY"
"HTTP_BODY" could conflict with a "Body:" HTTP header if there ever is one. Also, try to hide this body from the Rack environment before @app is called since it is only used by Unicorn internally.
2009-03-24simplify the HttpParser interface
This cuts the HttpParser interface down to #execute and #reset method. HttpParser#execute will return true if it completes and false if it is not. http->nread state is kept internally so we don't have to keep track of it in Ruby; removing one parameter from #execute. HttpParser#reset is unchanged. All errors are handled through exceptions anyways, so the HttpParser#error? method stopped being useful. Also added some more unit tests to the HttpParser since I know some folks are (rightfully) uncomfortable with changing stable C code. We now have tests for incremental parsing. In summary, we have: * more test cases * less C code * simpler interfaces * small performance improvement => win \o/
2009-03-21http11: don't set headers Rack doesn't like
Fix the logic in HttpParser up front so we don't have to mess around with the following convoluted steps: 1. setting the HTTP_CONTENT_{LENGTH,TYPE} headers 2. reading the HTTP_CONTENT_{LENGTH,TYPE} headers again 3. setting the CONTENT_{LENGTH,TYPE} based on the HTTP_-prefixed one 4. deleting the HTTP_CONTENT_{LENGTH,TYPE} headers (since Rack doesn't like them) 1, 2, 3 were in the C code, 4 was in Ruby. Now the logic is: 1. if CONTENT_{LENGTH,TYPE} headers are seen, don't prefix with "HTTP_". All the branch logic for the new code is done at init time, too so there's no additional overhead in the HTTP parsing phase. There's also no additional overhead of hash lookups in the extra steps.
2009-03-21unicorn/http11: remove GATEWAY_INTERFACE
It's a CGI-ism and is not in the Rack spec, so don't bother.
2009-03-10http11: mark private methods as static
There's no point in increasing method visibility since it can cause conflicts with other libraries and reduces the inlining opportunities the compiler can make.
2009-03-10http11: remove unnecessary CPP definitions
2009-03-03unicorn/http11: hopefully fix gem installation
Also, update the Manifest
2009-02-25rename http11 => unicorn/http11
Avoid conflicting with existing (and future) Mongrel installs in case either changes. Of course, this also allows us more freedom to experiment and break the API if needed... However, I'm only planning on making minor changes to remove the amount of C code we have to maintain and possibly some minor performance improvements.
2009-02-20http11: set SERVER_NAME env regardless of Host: header
The Rack spec requires it. So we'll just set it to "localhost" if we're dealing with HTTP/1.0 clients that omit the "Host:" header.
2009-02-19http11: don't bother defining SERVER_SOFTWARE
It was mistakenly set to false before, which breaks Rack::Lint. As the Rack SPEC doesn't require it, don't bother setting it at all and save a few bytes of memory.
2009-02-09s/Mongrel/Unicorn/g
Avoid conflicting with existing Mongrel libraries since we'll be incompatible and break things w/o disrupting Mongrel installations.
2009-02-09Remove Java and Win32 support
Supporting corporate enterprise platforms isn't my style :P Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-01-31Clean up some logging.
2009-01-31No more special params hash.
2008-07-15http_parser: restore r996 (accept '"', '<', and '>' characters in URLs)
This seems to have gotten accidentally dropped during a merge: r1020 Some broken web browsers don't properly escape ", <, and > characters in URLs, however these URLs to occasionally legitimate and sometimes show up. This patch was submitted by Eden Li here: http://rubyforge.org/pipermail/mongrel-users/2006-October/001845.html This patch was accepted by Zed Shaw here: http://rubyforge.org/pipermail/mongrel-users/2006-October/001847.html git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@1031 19e92222-5c0b-0410-8929-a290d50e31e9
2008-07-15http11: fix Ragel parser to work with Ragel 6.2
The main thing is to not update the parser current state (cs) if we have an error. The other changes were to revert mistakes in an attempt at Ragel 6.2 compatibility. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@1029 19e92222-5c0b-0410-8929-a290d50e31e9
2008-05-24Restore trunk from stable1-2 branch.
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@1020 19e92222-5c0b-0410-8929-a290d50e31e9
2008-03-27http11_parser: accept '"' (double-quote), '<', and '>' characters in URLs
Some broken web browsers don't properly escape ", <, and > characters in URLs, however these URLs to occasionally legitimate and sometimes show up. This patch was submitted by Eden Li here: http://rubyforge.org/pipermail/mongrel-users/2006-October/001845.html This patch was accepted by Zed Shaw here: http://rubyforge.org/pipermail/mongrel-users/2006-October/001847.html git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@996 19e92222-5c0b-0410-8929-a290d50e31e9
2008-03-24Backport Eric's changes to the http parser from trunk (Eric Wong).
Apply fix for Ragel 6 (Eric Wong, Ry Dahl). Two tests fail with the new parser (1 failed with the old parser). Needs investigation. Close #12 (mongrel_rails send_signal leaves a filehandle open until gc). Close #14 (mongrel_rails command line option --num-procs does not change the max number of procs). Close #15 (mongrel squashes helpful exception in register method). Close #16, XXX needs audit! (CGIWrapper "options" attr_reader has no corresponding @options variable). Close #20 (Mongrel doesn't erase temporary files during it's operation on windows). Close #19, XXX needs audit! (HttpResponse#reset does not properly reset HeaderOut). Close #22 (gem_plugin should load gems from Gem.path not Gem.dir). Close #23 (mongrel_cluster's mongrel_rails configuration option isn't fully respected). If I had git, being offline wouldn't have resulted in one massive commit. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/branches/stable_1-2@995 19e92222-5c0b-0410-8929-a290d50e31e9
2008-03-08ext/http11: memoize X-Forwarded-For + X-Real-IP headers keys
While these headers are not in RFCs, they are commonly set by proxies and having proxies in front of Mongrel is a popular deployment configuration. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@994 19e92222-5c0b-0410-8929-a290d50e31e9
2008-03-06ext/http11: remove strchr() and scary comment regarding it
Replace it with memchr(3) instead, which works on a buffer with a predetermined length, so we don't have to worry about strange versions of Ruby which don't null-terminate strings. memchr() is used several times in the MRI source code itself (without compatibility definitions), so it should be portable to all platforms MRI runs on. Additionally, we now tolerate null bytes in the Host header and can still parse ports in them correctly if anybody sends them :) If it matters, it is also theoretically faster as it doesn't need to check for a '\0' terminator. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@993 19e92222-5c0b-0410-8929-a290d50e31e9
2008-03-06ext/http11: optimistically optimize setting of common headers
Most HTTP traffic will send a small, common subset of headers. For these, we can avoid recreating RString objects and instead use predefined, frozen RString objects. This results in a ~22% speed improvement in header parsing for common cases where clients send the headers we have predefined, frozen objects for. Additionally, new parser tests have been added to ensure the optimizations work (for MRI). There is an optional qsort(3) and bsearch(3) dependency to improve average lookup time for the frozen strings; but it's not enabled due to portability concerns. The linear search performance is acceptable, and can be hand-optimized for the most frequently seen headers by putting those first. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@992 19e92222-5c0b-0410-8929-a290d50e31e9
2008-03-06ext/http11: define "HTTP_" with CPP as a constant instead of a Ruby global
This reduces line-wrapping and makes code easier to read as well as slightly improving performance by avoiding variable/pointer dereferencing overhead. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@991 19e92222-5c0b-0410-8929-a290d50e31e9
2008-03-06ext/http11: modify the C Ragel parser to upper-snake-case headers in-place
This is based on Zed's suggestion and helps take complexity out of the hand-written C code, allowing memcpy() to be used instead. Zed Shaw wrote in <20080303044659.5a550c19.zedshaw@zedshaw.com>: > * Also, now that I think about it, if you don't care that the original > string is modified in place then you can just have ragel do all of this > as it goes. Simply modify the parser to have it do this transform on > the header chars using the existing pointer. That'd probably be > alright since people don't usually keep the input headers around when > using the mongrel parser. I don't have a working Java runtime, so I've only made the bare minimum modification to the http11_parser.java.rl file which allows Ragel to still work with it. All the other Java parts are untouched and whatever upper-casing routine was used before continues to be used now. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@990 19e92222-5c0b-0410-8929-a290d50e31e9
2008-03-02http11: ~6% performance increase in header parsing
Allocate one string object and avoid appending to it causing it to be resized. Additionally, optimize the string toupper copy so that it's done in a single pass. Also, use an inline, locale-independent toupper() implementation which should be more predictable for users with exotic locales (HTTP header names are always ASCII). The following test script was used: require 'mongrel' include Mongrel parser = HttpParser.new req = "GET /ruby HTTP/1.1\r\n" \ "User-Agent: curl/7.12.3\r\n" \ "Host: bogomips.org\r\n" \ "Accept: */*\r\n" \ "\r\n".freeze hash = Hash.new 100000.times do parser.execute(hash, req, 0) parser.reset hash.clear end git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@989 19e92222-5c0b-0410-8929-a290d50e31e9
2008-02-23Update all constants for the release, as Luis reminded me.
$ rpl -R -x'.java' -x'.c' -x'.rb' '1.1.3' '1.1.4' * git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/branches/stable_1-2@980 19e92222-5c0b-0410-8929-a290d50e31e9
2008-01-02so does java
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@945 19e92222-5c0b-0410-8929-a290d50e31e9
2008-01-02trunk version # targets 1.2
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@944 19e92222-5c0b-0410-8929-a290d50e31e9
2008-01-02updated version number to 1.1.3
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/branches/stable_1-1@943 19e92222-5c0b-0410-8929-a290d50e31e9
2007-12-29* ext/http11/http11.c: bumped version to 1.1.3.
* Rakefile: workaround and ugly hack to get PURE_RUBY version of gem built. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/branches/stable_1-1@933 19e92222-5c0b-0410-8929-a290d50e31e9
2007-12-16New Mongrel.log is verified working for Mongrel Handler, Rails and Merb.
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@916 19e92222-5c0b-0410-8929-a290d50e31e9
2007-12-15fix server versioning string in Java 1-1-2
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/branches/stable_1-1@908 19e92222-5c0b-0410-8929-a290d50e31e9
2007-12-15update hardcoded version strings for 1-1-2
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/branches/stable_1-1@907 19e92222-5c0b-0410-8929-a290d50e31e9
2007-12-11Added compatibility for ruby1.9. Changes made:
* changed RSTRING(temp)->ptr to STRING_PTR(temp) (new macro available since ruby 1.8.6) * changed RSTRING(data)->len to RSTRING_LEN(data) (new macro available since ruby 1.8.6) * added ifndef conditions to check if macros STRING_PTR and STRING_LEN. If do not defined, create them. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@895 19e92222-5c0b-0410-8929-a290d50e31e9
2007-11-12ugh
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@878 19e92222-5c0b-0410-8929-a290d50e31e9
2007-10-30dunno what that manifest was for
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@840 19e92222-5c0b-0410-8929-a290d50e31e9
2007-10-27had no idea the version was hardcoded in the C extension somewhere
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@806 19e92222-5c0b-0410-8929-a290d50e31e9
2007-10-26revert trunk to 1.1
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@744 19e92222-5c0b-0410-8929-a290d50e31e9
2007-10-26except for all that java business
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@742 19e92222-5c0b-0410-8929-a290d50e31e9
2007-10-26reverts for 1.0.2
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@741 19e92222-5c0b-0410-8929-a290d50e31e9
2007-10-22pure ruby URIClassifier passes on C and JRuby both; now time to profile and ↵
see if it's worth keeping git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@722 19e92222-5c0b-0410-8929-a290d50e31e9
2007-10-18java setters are strewn all over the place
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@693 19e92222-5c0b-0410-8929-a290d50e31e9
2007-10-17fragment support for java.rl
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@676 19e92222-5c0b-0410-8929-a290d50e31e9
2007-10-17almost working
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@675 19e92222-5c0b-0410-8929-a290d50e31e9
2007-10-17restore machine actions
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@674 19e92222-5c0b-0410-8929-a290d50e31e9
2007-10-17missed one
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@673 19e92222-5c0b-0410-8929-a290d50e31e9
2007-10-17definitely broken
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@672 19e92222-5c0b-0410-8929-a290d50e31e9
2007-10-17ragel task does java too
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@670 19e92222-5c0b-0410-8929-a290d50e31e9
2007-10-17clean pattern is global; etc
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@669 19e92222-5c0b-0410-8929-a290d50e31e9
2007-10-17commit stuff
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@667 19e92222-5c0b-0410-8929-a290d50e31e9