mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
java setters are strewn all over the place
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@693 19e92222-5c0b-0410-8929-a290d50e31e9
This commit is contained in:
parent
98d65e6da0
commit
8a68f2e821
2 changed files with 13 additions and 0 deletions
|
@ -53,6 +53,8 @@ public class Http11 extends RubyObject {
|
|||
public final static String MAX_FIELD_VALUE_LENGTH_ERR = "HTTP element FIELD_VALUE is longer than the 81920 allowed length.";
|
||||
public final static int MAX_REQUEST_URI_LENGTH = 1024 * 12;
|
||||
public final static String MAX_REQUEST_URI_LENGTH_ERR = "HTTP element REQUEST_URI is longer than the 12288 allowed length.";
|
||||
public final static int MAX_FRAGMENT_LENGTH = 1024;
|
||||
public final static String MAX_FRAGMENT_LENGTH_ERR = "HTTP element REQUEST_PATH is longer than the 1024 allowed length.";
|
||||
public final static int MAX_REQUEST_PATH_LENGTH = 1024;
|
||||
public final static String MAX_REQUEST_PATH_LENGTH_ERR = "HTTP element REQUEST_PATH is longer than the 1024 allowed length.";
|
||||
public final static int MAX_QUERY_STRING_LENGTH = 1024 * 10;
|
||||
|
@ -97,6 +99,7 @@ public class Http11 extends RubyObject {
|
|||
this.hp.parser.http_field = http_field;
|
||||
this.hp.parser.request_method = request_method;
|
||||
this.hp.parser.request_uri = request_uri;
|
||||
this.hp.parser.fragment = fragment;
|
||||
this.hp.parser.request_path = request_path;
|
||||
this.hp.parser.query_string = query_string;
|
||||
this.hp.parser.http_version = http_version;
|
||||
|
@ -149,6 +152,15 @@ public class Http11 extends RubyObject {
|
|||
}
|
||||
};
|
||||
|
||||
private Http11Parser.ElementCB fragment = new Http11Parser.ElementCB() {
|
||||
public void call(Object data, int at, int length) {
|
||||
RubyHash req = (RubyHash)data;
|
||||
validateMaxLength(length, MAX_FRAGMENT_LENGTH, MAX_FRAGMENT_LENGTH_ERR);
|
||||
RubyString val = RubyString.newString(runtime,new ByteList(hp.parser.buffer,at,length));
|
||||
req.aset(runtime.newString("FRAGMENT"),val);
|
||||
}
|
||||
};
|
||||
|
||||
private Http11Parser.ElementCB request_path = new Http11Parser.ElementCB() {
|
||||
public void call(Object data, int at, int length) {
|
||||
RubyHash req = (RubyHash)data;
|
||||
|
|
|
@ -81,6 +81,7 @@ class HttpParserTest < Test::Unit::TestCase
|
|||
parser.execute(req, get, 0)
|
||||
end
|
||||
assert parser.finished?
|
||||
assert_equal '/forums/1/topics/2375?page=1', req['REQUEST_URI']
|
||||
assert_equal 'posts-17408', req['FRAGMENT']
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue