mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.7.3.1'
This commit is contained in:
@@ -18,9 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.core.ios; import gplx.*; import gplx.core.*;
|
||||
import gplx.core.ios.streams.*;
|
||||
public class Io_stream_zip_mgr {
|
||||
private final Bry_bfr bfr = Bry_bfr_.Reset(256);
|
||||
private Io_stream_wtr wtr_gzip, wtr_zip, wtr_bzip2;
|
||||
private Io_stream_rdr rdr_gzip, rdr_zip, rdr_bzip2;
|
||||
public byte[] Zip(byte type, byte[] val) {
|
||||
if (type == Io_stream_.Tid_raw) return val;
|
||||
Io_stream_wtr wtr = Wtr(type);
|
||||
@@ -29,14 +27,13 @@ public class Io_stream_zip_mgr {
|
||||
return wtr.To_ary_and_clear();
|
||||
}
|
||||
public byte[] Unzip(byte type, byte[] val) {
|
||||
synchronized (this) { // LOCK:static-obj;rdr_*;necessary; DATE:2016-07-06
|
||||
if (type == Io_stream_.Tid_raw) return val;
|
||||
Io_stream_rdr rdr = Rdr(type);
|
||||
rdr.Open_mem(val);
|
||||
return Io_stream_rdr_.Load_all_as_bry(bfr, rdr);
|
||||
}
|
||||
if (type == Io_stream_.Tid_raw) return val;
|
||||
Io_stream_rdr rdr = Rdr(type);
|
||||
rdr.Open_mem(val);
|
||||
return Io_stream_rdr_.Load_all_as_bry(Bry_bfr_.New(), rdr);
|
||||
}
|
||||
private Io_stream_wtr Wtr(byte type) {
|
||||
Bry_bfr bfr = Bry_bfr_.New();
|
||||
switch (type) {
|
||||
case Io_stream_.Tid_gzip : if (wtr_gzip == null) wtr_gzip = Io_stream_wtr_.new_by_mem(bfr, Io_stream_.Tid_gzip) ; return wtr_gzip.Open();
|
||||
case Io_stream_.Tid_zip : if (wtr_zip == null) wtr_zip = Io_stream_wtr_.new_by_mem(bfr, Io_stream_.Tid_zip) ; return wtr_zip.Open();
|
||||
@@ -45,11 +42,11 @@ public class Io_stream_zip_mgr {
|
||||
default : throw Err_.new_unhandled(type);
|
||||
}
|
||||
}
|
||||
private Io_stream_rdr Rdr(byte type) {
|
||||
private Io_stream_rdr Rdr(byte type) { // TS.MEM: DATE:2016-07-12
|
||||
switch (type) {
|
||||
case Io_stream_.Tid_gzip : if (rdr_gzip == null) rdr_gzip = Io_stream_rdr_.new_by_tid_(Io_stream_.Tid_gzip) ; return rdr_gzip;
|
||||
case Io_stream_.Tid_zip : if (rdr_zip == null) rdr_zip = Io_stream_rdr_.new_by_tid_(Io_stream_.Tid_zip) ; return rdr_zip;
|
||||
case Io_stream_.Tid_bzip2 : if (rdr_bzip2 == null) rdr_bzip2 = Io_stream_rdr_.new_by_tid_(Io_stream_.Tid_bzip2) ; return rdr_bzip2;
|
||||
case Io_stream_.Tid_gzip : return Io_stream_rdr_.new_by_tid_(Io_stream_.Tid_gzip);
|
||||
case Io_stream_.Tid_zip : return Io_stream_rdr_.new_by_tid_(Io_stream_.Tid_zip);
|
||||
case Io_stream_.Tid_bzip2 : return Io_stream_rdr_.new_by_tid_(Io_stream_.Tid_bzip2);
|
||||
case Io_stream_.Tid_raw :
|
||||
default : throw Err_.new_unhandled(type);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ public class Gfo_url_parser {
|
||||
private final Btrie_slim_mgr protocols = Btrie_slim_mgr.ci_a7(); // ASCII:url_protocol; EX:"http:", "ftp:", etc
|
||||
private final Bry_ary segs_ary = new Bry_ary(4), qargs = new Bry_ary(4);
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr_.Reset(500);
|
||||
private final Btrie_rv trv = new Btrie_rv();
|
||||
public byte[] Relative_url_protocol_bry() {return Gfo_protocol_itm.Itm_https.Key_w_colon_bry();} // NOTE: https b/c any WMF wiki will now default to WMF; DATE:2015-07-26
|
||||
public Gfo_url_parser() {
|
||||
Init_protocols(Gfo_protocol_itm.Ary());
|
||||
@@ -76,8 +77,8 @@ public class Gfo_url_parser {
|
||||
path_bgn = qarg_key_bgn = qarg_val_bgn = anch_bgn = anch_nth_bgn = -1;
|
||||
segs_ary.Clear(); qargs.Clear();
|
||||
int pos = src_bgn;
|
||||
Object protocol_obj = protocols.Match_bgn(src, src_bgn, src_end);
|
||||
pos = protocols.Match_pos();
|
||||
Object protocol_obj = protocols.Match_at(trv, src, src_bgn, src_end);
|
||||
pos = trv.Pos();
|
||||
pos = Bry_find_.Find_fwd_while(src, pos, src_end, Byte_ascii.Slash);
|
||||
if (protocol_obj == null) {
|
||||
this.protocol_tid = Gfo_protocol_itm.Tid_unknown;
|
||||
|
||||
@@ -22,7 +22,7 @@ public class Http_request_parser {
|
||||
private int type, content_length;
|
||||
private byte[] url, protocol, host, user_agent, accept, accept_language, accept_encoding, x_requested_with, cookie, referer, content_type, content_type_boundary, connection, pragma, cache_control, origin;
|
||||
private Http_post_data_hash post_data_hash;
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr_.New_w_size(255);
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr_.New_w_size(255); private final Btrie_rv trv = new Btrie_rv();
|
||||
private final Http_server_wtr server_wtr; private final boolean log;
|
||||
public Http_request_parser(Http_server_wtr server_wtr, boolean log) {this.server_wtr = server_wtr; this.log = log;}
|
||||
public void Clear() {
|
||||
@@ -59,12 +59,12 @@ public class Http_request_parser {
|
||||
}
|
||||
break; // assume form_data sends POST request
|
||||
}
|
||||
Object o = trie.Match_bgn(line, 0, line_len);
|
||||
Object o = trie.Match_at(trv, line, 0, line_len);
|
||||
if (o == null) {
|
||||
server_wtr.Write_str_w_nl(String_.Format("http.request.parser; unknown line; line={0} request={1}", line_str, To_str()));
|
||||
continue;
|
||||
}
|
||||
int val_bgn = Bry_find_.Find_fwd_while_ws(line, trie.Match_pos(), line_len); // skip ws after key; EX: "Host: "
|
||||
int val_bgn = Bry_find_.Find_fwd_while_ws(line, trv.Pos(), line_len); // skip ws after key; EX: "Host: "
|
||||
int tid = ((Int_obj_val)o).Val();
|
||||
switch (tid) {
|
||||
case Tid_get:
|
||||
|
||||
Reference in New Issue
Block a user