-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update from mochi repo #15
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Quoted attributes are allowed to contain newlines.
Fix for parsing unescaped < characters.
Fix for problem with to_html rendering faulty html with singleton tags.
http://tools.ietf.org/html/rfc2616#section-14.35.1 If the last-byte-pos value is absent, or if the value is greater than or equal to the current length of the entity-body, last-byte-pos is taken to be equal to one less than the current length of the entity-body in bytes. Specifically, the 'greater than equal to' case.
Fix a case in handling range headers
There were two issues: - file:pread() returns eof in the case when the length of the read is 0 bytes, for any offset. This causes badarg exceptions later in iolist_size when the 'eof' atom is encountered instead of a binary - The range-length computation is off by 1 for 0-length ranges: {Skip, Skip + Length - 1, PartialBody} would result in e.g. {0, -1, eof}. {0, -1} is invalid HTTP according to http://tools.ietf.org/html/rfc2616#section-14.16 A byte-content-range-spec with a byte-range-resp-spec whose last-byte-pos value is less than its first-byte-pos value, or whose instance-length value is less than or equal to its last-byte-pos value, is invalid. This patch fixes both issues.
Handling combined header
The source is still unclear but R15B02 now will return and emsgsize error if the received packet is larger than the recvbuf. This can be tested with the following (sorry I don't know how to integrate this sort of test into mochiweb's tests). -module(mochi_test). -export([start/0, handle_http/1, test/1]). start() -> application:start (inets), mochiweb_http:start([{port, 5678}, {loop, fun(Req) -> handle_http(Req) end}]). handle_http(Req) -> Req:respond({ 200, [ {"Content-Type", "text/html"} ], [ "<html><body>Hello</body></html>" ] }). test (Len) -> httpc:request (get, {"http://127.0.0.1:5678/", [{"X-Random", [$a || _ <- lists:seq(1,Len)]}]}, [], []). Once compiled you can run this with erl -pa ebin -boot start_sasl Then run with mochi_test:start(). mochi_test:test(10000). The result is different with R14B04 and R15B02. With R15B02 there was a crash in the mochiweb_acceptor. This patch deals with that crash.
On Windows, it is possible to access arbitrary files by crafting a GET with unescaped \, like GET /..\..\..\..\..\windows\win.ini http://www.couchbase.com/issues/browse/MB-7390
On Windows, it is possible to access arbitrary files by crafting a GET with unescaped \, like GET /..\..\..\..\..\windows\win.ini Please also see ouchbase.com/issues/browse/MB-7390
Pull request for issue 92: Do not allow backslashes in path (windows security).
Fix for mochiweb_acceptor crash under R15B02
* With Erlang R16B03 running on FreeBSD/amd64 10.0-PRERELEASE (base/stable/10 r260159), the following tests will not finish within the default eunit timeout of 5 seconds (See `lib/eunit/src/eunit_internal.hrl` (of R16B03)) so cases modified to extend timeout to 60 seconds (`LARGE_TIMEOUT`): % note well the underscore at the end of function names single_100k_http_POST_test_() single_100k_https_POST_test_() multiple_100k_http_POST_test_() multiple_100k_https_POST_test_() See also <mochi/mochiweb@02066a5>
Update test/mochiweb_tests.erl
While investigating basho/webmachine#186 it was noted that a small but non-zero percentage of clients embed whitespace in Range headers. It appears this is valid: From http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html byte-range-set = 1#( byte-range-spec | suffix-byte-range-spec ) From http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2 #rule ...separated by one or more commas (",") and OPTIONAL linear white space (LWS)... ...null elements are allowed, but do not contribute to the count of elements present. That is, "(element), , (element) " is permitted, but counts as only two elements...
Allow whitespace in Range headers
max limits the sum of active connections and listeners. The implementation assumes that max is greater than acceptor_pool_size, and always maintains the acceptor_pool at acceptor_pool_size as long as the max is not exceeded. If max is less than acceptor_pool_size, acceptor_pool_size is the effective max.
If we added a new socket in the recycle_acceptor, we should not decrement the number of active sockets.
implementation of max, the number of connections is now limited with a default of 2048
Fix type specs in base64url
* rebar prepare-deps is equivalent to rebar -r get-deps compile * Only rebar *-deps and rebar compile are recursive by default. Therefore, we don't need to pass skip_deps=true.
Makefile: adapt rebar calls to new behavior
There are travis failures due to crypto compatibility issues for older Erlang releases. Fixing. |
The crypto compatibility changes in mochiweb_session.erl and mochiweb_websocket.erl are necessary for older releases of Erlang not supported in the primary mochiweb repo.
👍 Looks fine, passes all tests on multiple Erlangs. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
update basho fork from main mochiweb repo