mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Http_server: Fix full-text search not working
This commit is contained in:
parent
f1da174c5c
commit
0eabb64abc
@ -30,8 +30,8 @@ public class Xoa_app_ {
|
||||
}
|
||||
}
|
||||
public static final String Name = "xowa";
|
||||
public static final int Version_id = 529;
|
||||
public static final String Version = "4.5.7.1706";
|
||||
public static final int Version_id = 530;
|
||||
public static final String Version = "4.5.8.1707";
|
||||
public static String Build_date = "2012-12-30 00:00:00";
|
||||
public static String Build_date_fmt = "yyyy-MM-dd HH:mm:ss";
|
||||
public static String Op_sys_str;
|
||||
|
@ -17,7 +17,9 @@ package gplx.xowa.addons.servers.https; import gplx.*; import gplx.xowa.*; impor
|
||||
import gplx.core.envs.*;
|
||||
public class Http_long_poll_cmd implements gplx.xowa.htmls.bridges.Bridge_cmd_itm {
|
||||
private final List_adp msgs = List_adp_.New();
|
||||
private boolean active;
|
||||
private String prv_guid;
|
||||
private long prv_start;
|
||||
private long prv_timeout;
|
||||
|
||||
public void Init_by_app(Xoa_app app) {
|
||||
app.Gui__cbk_mgr().Reg(Xog_cbk_wkr__http.Instance);
|
||||
@ -27,17 +29,30 @@ public class Http_long_poll_cmd implements gplx.xowa.htmls.bridges.Bridge_cmd_it
|
||||
msgs.Add(msg);
|
||||
}
|
||||
}
|
||||
public String Exec(gplx.langs.jsons.Json_nde data) {
|
||||
// NOTE: this class is a singleton and only supports one user; need to track multiple requests by having http_server track incoming users
|
||||
public String Exec(gplx.langs.jsons.Json_nde data) {
|
||||
// for each new request, update guid / start_time
|
||||
String cur_guid = data.Get_as_str_or("guid", "");
|
||||
long cur_timeout = data.Get_as_long_or("timeout", 5000);
|
||||
synchronized (msgs) {
|
||||
if (active) return "polling";
|
||||
this.prv_guid = cur_guid;
|
||||
this.prv_start = System_.Ticks();
|
||||
this.prv_timeout = cur_timeout;
|
||||
}
|
||||
|
||||
// check if already active; if so, return;
|
||||
while (true) {
|
||||
synchronized (msgs) {
|
||||
if (!String_.Eq(cur_guid, prv_guid))
|
||||
return String_.Format("long-poll ignored: new long-poll arrived: prv={0} cur={1}", prv_guid, cur_guid);
|
||||
|
||||
if (System_.Ticks__elapsed_in_frac(prv_start) > prv_timeout)
|
||||
return String_.Format("long-poll ignored: old long-poll timed-out: guid={0}", cur_guid);
|
||||
}
|
||||
|
||||
// get msgs in queue
|
||||
int msgs_len = 0;
|
||||
synchronized (msgs) {
|
||||
active = true;
|
||||
msgs_len = msgs.Len();
|
||||
}
|
||||
|
||||
@ -55,7 +70,6 @@ public class Http_long_poll_cmd implements gplx.xowa.htmls.bridges.Bridge_cmd_it
|
||||
String[] rv = null;
|
||||
synchronized (msgs) {
|
||||
rv = msgs.To_str_ary_and_clear();
|
||||
active = false;
|
||||
}
|
||||
return String_.Concat_lines_nl(rv);
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public class Xoa_cmd_arg_mgr {
|
||||
, Gfo_cmd_arg_itm_.opt_("server_port_recv").Example_("55000").Note_("applies to --app_mode server; port where xowa server will receive messages; clients should send messages to this port")
|
||||
, Gfo_cmd_arg_itm_.opt_("server_port_send").Example_("55001").Note_("applies to --app_mode server; port where xowa server will send messages; clients should listen for messages from this port")
|
||||
, Gfo_cmd_arg_itm_.opt_("http_server_port").Example_("8080").Note_("applies to --app_mode http_server; port used by http_server; default is 8080")
|
||||
, Gfo_cmd_arg_itm_.opt_("http_server_home").Example_("home/wiki/Main_Page").Note_("applies to --app_mode http_server; default home page for root address. EX: navigating to localhost:8080 will navigate to localhost:8080/home/wiki/Main_Page")
|
||||
, Gfo_cmd_arg_itm_.opt_("http_server_home").Example_("home/wiki/Main_Page").Note_("applies to --app_mode http_server; default home page for root address. EX: navigating to localhost:8080 will navigate to localhost:8080/home/wiki/Main_Page. To navigate to a wiki's main page, use the domain name only. EX: --http_server_home en.wikipedia.org")
|
||||
, Gfo_cmd_arg_itm_.opt_("http_server.max_clients").Example_("15").Note_("applies to --app_mode http_server; limits maximum number of concurrent connections; default is 0 (no limit)")
|
||||
, Gfo_cmd_arg_itm_.opt_("http_server.max_clients_timeout").Example_("50").Note_("applies to --app_mode http_server; time in milliseconds to wait before checking again to see if a connection is free; default is 50 (wait 50 ms)")
|
||||
, Gfo_cmd_arg_itm_.sys_("show_license").Dflt_(true)
|
||||
|
@ -161,13 +161,16 @@ class Xosrv_http_wkr_ {
|
||||
public static void Write_response_as_html(Http_client_wtr client_wtr, boolean cross_domain, String html) {Write_response_as_html(client_wtr, cross_domain, Bry_.new_u8(html));}
|
||||
public static void Write_response_as_html(Http_client_wtr client_wtr, boolean cross_domain, byte[] html) {
|
||||
try{
|
||||
client_wtr.Write_bry(Rsp__http_ok);
|
||||
// TODO_OLD: add command-line argument to allow testing from local file
|
||||
// if (cross_domain)
|
||||
// client_wtr.Write_str("Access-Control-Allow-Origin: *\n"); // No 'Access-Control-Allow-Origin' header is present on the requested resource.
|
||||
client_wtr.Write_bry(Rsp__content_type_html);
|
||||
client_wtr.Write_bry(Byte_ascii.Nl_bry);
|
||||
client_wtr.Write_bry(html);
|
||||
client_wtr.Write_bry
|
||||
( Bry_.Add
|
||||
( Rsp__http_ok
|
||||
, Rsp__content_type_html
|
||||
, Byte_ascii.Nl_bry
|
||||
, html
|
||||
));
|
||||
} catch (Exception err) {
|
||||
client_wtr.Write_str("Site not found. Check address please, or see console log.\n" + Err_.Message_lang(err));
|
||||
client_wtr.Rls();
|
||||
|
@ -1 +1 @@
|
||||
download_central update
|
||||
v4.5.7.1706
|
||||
|
Loading…
Reference in New Issue
Block a user