id stringlengths 36 36 | text stringlengths 1 1.25M |
|---|---|
a04b22c5-c579-4c20-ac0e-41c97f51f359 | public final static boolean isCleanerRunning () {
if(cleaner!=null && cleaner.isAlive())
return true;
else
return false;
} |
5aa4dd65-0f47-4c23-873f-f8ed9faaa9c9 | public final static WebConnection getConnection (InetAddress ia, int port) throws IOException {
WebConnection wc = null;
String a;
ArrayList <WebConnection> pool;
if(ia==null) throw new java.net.UnknownHostException("Host not found");
a = ia.getHostAddress() + ":" + port;
synchronized(activeConnec... |
fcf92d4d-d250-4736-a0ed-0f320e218285 | public final static void releaseConnection (WebConnection wc) {
if (!wc.keepalive || keepalivetime<=0)
{
try
{
wc.close();
}
catch (IOException e) {}
return;
}
String a = wc.ia.getHostAddress () + ":" + wc.por... |
9a585ffe-e027-4b7a-adc2-171c22c6679f | public static void setKeepaliveTime (long milis) {
keepalivetime = milis;
} |
ba84d98a-3f16-468a-9389-54bf32c3ee42 | public static long getKeepaliveTime () {
return keepalivetime;
} |
a005dbab-d9c0-421d-bab7-15091264a10a | public void run () {
long d;
if(keepalivetime<=0) return;
while (!isInterrupted()) {
d=System.currentTimeMillis() - keepalivetime;
synchronized(activeConnections) {
Iterator <String> i1;
i1 = activeConnections.keySet ().iterator();
while ( i1.hasNext() ) {
String key;
key = i1.n... |
b40405fa-c682-451c-9880-ee4ba478c5da | request(int htver,int met,String url,ArrayList <String> head,DataInputStream in,DataOutputStream out) throws MalformedURLException
{
hasHost=hasCookie=false;
ims=httprc=0;
ctsize=-1;
reload=false;
cacheable=true;
this.method=met;
protocol=null;
ctype=null;
encoding=null;
location=null;
etag=null;
chunked=fa... |
66ce71cb-0735-4e0d-af44-75f60e35dd7c | final public void rewriteURL(String newURL)
{
this.URL=newURL;
if(!hasHost && referer_hack<2) return; // scan and kill old host header
String s,s1;
int cachedsize=headers.size();
for(int i=0;i<cachedsize;i++)
{
int j;
s=headers.get(i);
j=s.indexOf(':',0);
if(j==-1) continue;
s1=s.substring(0,... |
554a6931-90f6-418d-b78a-bae1ff5f7a6d | final public void removeOutgoingCookies()
{
if(hasCookie==false) return;
// scan and kill c00kie header
String s,s1;
int cachedsize=headers.size();
for(int i=0;i<cachedsize;i++)
{
int j;
s=headers.get(i);
j=s.indexOf(':',0);
if(j==-1) continue;
s1=s.substring(0,j).toLowerCase();
if(... |
7141b06f-56a8-4259-9389-3e3670193b7e | final public String getHeader(String header)
{
String s,s1;
int cachedsize=headers.size();
for(int i=0;i<cachedsize;i++)
{
int j;
s=headers.get(i);
j=s.indexOf(':',0);
if(j==-1) continue;
s1=s.substring(0,j).toLowerCase();
if(s1.equals(header))
return s.substring(j+1).trim();
... |
6fb729cc-1101-4e2b-b12c-eef796e89d75 | final public void addHost(String hostname,String port)
{
if(hasHost) return; /* uz ji mame - nemenime */
if(port==null)
headers.add("Host: "+hostname);
else
headers.add("Host: "+hostname+":"+port);
hasHost=true;
} |
1b6548d5-3ab9-4ca7-b076-251da9de872c | final public String getURL()
{
if(method==httpreq.REQUEST_CONNECT)
return "https://"+URL+"/";
else
return URL;
} |
69dd59cf-2635-488e-a188-a9a9e8cfb665 | final public void setTarget(InetAddress proxyhost, int proxyport)
{
this.proxyhost=proxyhost;
this.proxyport=proxyport;
} |
15683781-5b72-4a2a-9c46-9cd91966e458 | final public WebConnection connectToHost() throws IOException
{
return ConnectionHandler.getConnection(proxyhost,proxyport);
} |
173c889a-d12c-4eb2-a794-055ee93d4b70 | final public void handle_connect(boolean direct) throws IOException
{
WebConnection wc;
try
{
wc=new WebConnection(proxyhost,proxyport);
}
catch (IOException e)
{
send_error(500,"Connect to server failed ("+e+"). CONNECT request canceled.");
return;
}
DataInputStream sin=wc.webis;
DataOutputStr... |
e67b0671-633b-4abd-84d3-652a51dab86c | final public void handle_options() throws IOException
{
int maxforwards=get_and_update_maxforwards();
if(maxforwards==0)
{
/* reply to OPTIONS Message */
make_headers(200,null,null,null,0,0,0,null);
headers.add("Allow: GET, HEAD, OPTIONS, TRACE");
send_headers();
close();
kee... |
d28a10f5-8dac-427c-9887-7bf19a162b14 | @SuppressWarnings("unchecked")
final public void handle_trace() throws IOException
{
int maxforwards=get_and_update_maxforwards();
if(maxforwards==0)
{
/* reply to trace Message */
ArrayList <String> oldheaders=(ArrayList <String>)headers.clone();
make_headers(200,"message/http",null,null,-1,0... |
ebabd8e1-1fa7-4879-b0b7-b49827900827 | final private int get_and_update_maxforwards()
{
int maxforwards=-1;
String s,s1;
int cachedsize=headers.size();
for(int i=0;i<cachedsize;i++)
{
int j;
s=headers.get(i);
j=s.indexOf(':',0);
if(j==-1) continue;
s1=s.substring(0,j).toLowerCase();
if(s1.equals("max-forwards")) {
... |
14009fa5-d809-4e71-8c2d-3ee88fea27f5 | final public void direct_request(boolean datafromclient) throws IOException
{
WebConnection wc;
if(datafromclient==true && ctsize>reqmaxbody)
{
keepalive=false;
send_error(403,"Request body is too large.");
return;
}
try{
if(datafromclient==false)
{
wc=connectToHost();
run_request(wc);... |
e58e7e84-b64b-48b2-b296-7de931f27ecd | final public void run_request(WebConnection wc) throws IOException
{
String firstline=null;
boolean retry=false;
try
{
raw_send_request(wc);
wc.socket.setSoTimeout (request_timeout);
firstline=wc.webis.readLine();
}
catch (IOException e)
{
retry=true;
}
if(firstline==null) retry=true;
if(... |
db16152e-f3e4-4b74-a0c4-27008f648ce7 | final public void raw_send_request(WebConnection wc) throws IOException
{
String met=null;
DataOutputStream sout=wc.webos;
met=httpreq.methodToString(method);
sout.writeBytes(met+" "+(rline==null?URL:rline)+" HTTP/1.1\r\n");
int hscache=headers.size();
for(int i=0;i<hscache;i++)
{
sout.writeBytes(headers.... |
eec4ed90-b464-4ade-89fe-6701d798ac5b | final public void close() throws IOException
{
out.flush();
} |
f0339318-5f39-4699-811b-78f4668e0ef9 | final public void read_headers(String firstline,WebConnection wc) throws IOException
{
DataInputStream in=wc.webis;
String line;
if(firstline==null)
{
try{
wc.close();
}
catch(IOException e) {}
throw new IOException("Document contains no data!");
}
/* precteme si tedy kod */... |
a968c75a-56a2-4820-921a-e3473a5e6b85 | final public void transfer_object(WebConnection wc, OutputStream file,cachedir dir) throws IOException
{
int read=0;
int i;
long whenaborted;
boolean clientdead;
boolean filedead;
DataInputStream sin=wc.webis;
byte b[]=new byte[4096];
clientdead=filedead=false;
whenaborted=0;
int todo;
if(wc.socket!=null) wc... |
58c4d0a6-718d-4a50-a9bd-5f26779b2d69 | final public void add_ims()
{
add_ims(ims);
} |
d2b5917c-5544-4b88-84af-7a9966e7bdcc | final public void add_ims(long when)
{
if(etag!=null) headers.add(1,"If-None-Match: "+etag);
if(when==0) return;
headers.add(0,"If-Modified-Since: "+printDate(new Date(when)));
} |
7db38f7d-d0fa-46eb-b1bd-e81c9a5d0350 | final public void add_header(String header)
{
if(header==null) return;
headers.add(header);
} |
2329fe41-970a-4556-b138-7ea50a1974b4 | final public void send_headers()
{
if(httpv<10) return;
try{
out.writeBytes("HTTP/1.0 "+httprc+" OK\r\n");
int headerscache=headers.size();
for(int i=0;i<headerscache;i++)
{
out.writeBytes(headers.get(i));
out.writeBytes("\r\n");
}
out.writeBytes("\r\n");
out.flush();
}
catch (IOException e)
{... |
f3548882-e695-4cdd-b471-487a21cc082d | final public void make_headers(int rc,String ctype,String enc,String loc,int sz,long lm,long exp,String et)
{
httprc=rc;
headers=new ArrayList <String> ();
Date d=new Date();
if(ctype!=null) headers.add("Content-Type: "+ctype);
if(enc!=null) headers.add("Content-Encoding: "+enc);
if(sz>=0) {
headers.add("Conten... |
b753c011-6371-48b1-b2b5-c8ced76c298f | final public void setRequestTo(String rq)
{
this.rline=rq;
} |
a0cdc7c6-5e29-44df-8086-aaf9e28be8bc | final public void send_error(int errorrc,String msg) throws IOException
{
StringBuffer bd=new StringBuffer(1024); // body
bd.append("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<HTML><HEAD><TITLE>Error</TITLE></HEAD>\n<BODY><h2>");
bd.append(errorrc);
bd.append(" ");
bd.append(msg);
bd.append("</... |
904f1631-86e5-4293-bed1-5aeec1d2bece | final private boolean
CheckQuickAbort(int readb)
{
if (!cacheable)
{
if(trace_abort==true)
System.out.println("[TRACE "+Thread.currentThread().getName()+"] # Load aborted (non-cacheable): "+URL);
return true;
}
if (qa_minlen < 0)
{
/* disabled */
if(trace_abort==tr... |
98f3e206-0eeb-414c-b0b2-96aff4730652 | final public static String printDate(Date d)
{
try
{
synchronized(formatter)
{
return formatter.format(d);
}
}
catch (Exception z)
{
z.printStackTrace();
System.out.println("[JAVA_INTERNAL_ERROR] SimpleDateFormat.format(d) failed\nDate format=EEE, dd MMM yyyy HH:mm:ss 'GMT' BadDate(fo... |
a4e942f4-54de-4bad-ab28-81fb7958cdf2 | final public void nocache()
{
cacheable=false;
} |
50df5b57-714f-40a2-9938-902a6a5ce45e | final public void sendString(String arg) throws IOException
{
out.writeBytes(arg);
log_size=arg.length();
} |
947c20ec-5b34-472e-8cfd-238b5dd23858 | final public void sendBytes(byte b[]) throws IOException
{
out.write(b);
log_size=b.length;
} |
6b45ce4e-f6f5-42fc-bad5-f114aca0de5c | final public static void main(String argv[])
{
faststart=false;
// System.runFinalizersOnExit(true);
VERSION=CACHENAME+" "+CACHEVER;
System.err.println(VERSION+" - full featured caching proxy server"+ /* " and web forwarder"*/ ".\n"+
"Copyright (c) Radim Kolar 1998-2009. OpenSource software; There is NO warranty... |
d5e21ece-9160-4496-aee3-525197b0dc70 | scache(int port,InetAddress adr)
{
if(adr!=null)
try{
server=new ServerSocket(port,listenbacklog,adr);
}
catch(IOException e) {System.err.println("[SMARTCACHE] Fatal error: Cannot bind to my port "+port+"/"+adr.getHostAddress()+"\n[SMARTCACHE] Reason: "+e);System.exit(3);}
else
try{
server=new Ser... |
a6756a5a-20c3-42a8-8a6c-b245b7ad5985 | public final void httpdloop()
{
ThreadGroup clients;
httpreq client;
clients=new ThreadGroup("HTTP-clients");
Thread.currentThread().setName("HTTP accept loop");
while (true ) {
Socket clientSocket = null;
client=null;
try {
clientSocket = server.accept();... |
ca17f5ed-04f0-407a-87b9-a578bdbd6329 | httpreq(Socket socket) {
this.socket=socket;
} |
c2f819ce-ff14-4dd4-a874-644751d1e269 | final public static String methodToString(int method)
{
switch(method)
{
case REQUEST_GET:
return "GET";
case REQUEST_POST:
return "POST";
case REQUEST_HEAD:
return "HEAD";
case REQUEST_PUT:
return "PUT";
case REQUEST_OPTIONS:
return "OPTIONS";
case REQUEST_DELETE:
return "DELETE";
case REQUE... |
21b9693c-2d13-4d11-8db5-0f4a4a096637 | final public void run() {
int httpv=9; /* 9-11 for now */
request rq=null;
try {
/* socket init */
DataInputStream in=new DataInputStream (new BufferedInputStream(socket.getInputStream(), 2048));
DataOutputStream ou=new DataOutputStream(new BufferedOutputStream(socket.getOutputStream(), 2048));
... |
98e6f98e-33bc-417e-86b0-ab7dd465d144 | public final static void server_error(int httpv,int err,String msg,DataOutputStream out) throws java.io.IOException
{
request rq;
rq=new request(httpv,REQUEST_GET,"smartcache://url-parse-error",new ArrayList <String> (),null,out);
rq.keepalive=false;
rq.send_error(err,msg);
} |
2fabba1c-6f0e-40e0-b4bc-eee674c6b66f | public final static boolean
open_logfile(String xlogfilenames[], DataOutputStream xlogfilez[], int i)
{
if(xlogfilez[i]!=null) return true; // allready open
if(xlogfilenames[i]==null) return false; // unknown name
/* OPEN LOGFILE */
try{
DataOutputStream dos;
... |
0e12ce2a-ac96-42e7-a8e4-27c7d09881a3 | public final static void flush(DataOutputStream xlogfilez[])
{
if(xlogfilez!=null)
for(int z=0;z<xlogfilez.length;z++)
{
if(xlogfilez[z]!=null)
try{
xlogfilez[z].flush();
}
catch(IOException e)
{}
}
} |
596d7501-43e6-4638-8360-2e090c5f093b | public final static void read_http_headers(DataInputStream in, List <String> headers) throws IOException {
String oldheader=null,req;
while(true)
{
req=in.readLine();
if(req==null) {
if(trace_inkeepalive)
{
System.out.println("[TRACE "+Thread.currentThread().getName()+"] = EOF when reading request's ... |
17d589ab-9843-4330-9f41-1517183d57c8 | public final static void close_logfiles(DataOutputStream xlogfilez[])
{
if(xlogfilez!=null)
for(int z=0;z<xlogfilez.length;z++)
{
if(xlogfilez[z]!=null)
try{
xlogfilez[z].close();
}
catch(IOException e)
{}
finally
{
xlogfilez[z]=null;
}
}
... |
7e43a401-465d-4c5d-8539-6d022e9e6dd7 | private final void log_this(request rq)
{
/* zalogovat do access.logu */
if(logpatterns!=null && rq!=null)
{
int j=logpatterns.length;
String urlcache=rq.getURL();
for(int i=0;i<j;i++)
{
String fragment;
fragment=mgr.simpleWildMatch(logpatterns[i], urlcache);
... |
4b3c757b-4aa2-45db-803d-0ad5ff913441 | regexp(String exp, boolean ign)
{
ignoreCase=ign;
exact=false;
int i;
if(exp.indexOf('*',0)==-1) { exact=true;
prefix=exp;
prefixlen=exp.length();
if(ign) prefix=prefix.toLowerCase();
re... |
174c72d2-c90f-4d55-821b-793d58649c17 | public String dump()
{
String result="exact="+exact+" prefix="+prefix+" suffix="+suffix+" elements=";
if (elements==null) return result+="null";
for(int i=0;i<elements.length;i++)
result+=elements[i]+",";
return result;
} |
85a4e612-b5ed-4ba2-ac4c-276fe89b6819 | final public String toString()
{
if(exact==true) return prefix;
String result;
if(prefix==null) result="*";
else
result=prefix+"*";
/* pridat elementy */
if(elements!=null)
for(int i=0;i<elements.length;i++)
result+=elements[i]+"*";
/* suffix */
if(suffix!=null) result+=suffix;
return ... |
cb5f39de-c215-402f-8146-98e44d041757 | final public boolean matches(String str)
{
int pos;
pos=0;
if(ignoreCase) str=str.toLowerCase();
if(exact) return str.equals(prefix);
if(prefix!=null)
if(!str.startsWith(prefix)) return false;
else
pos=prefixlen;
if(elements!=null)
{
int j=elements.length;
for(int i=0;i<j;i++)
... |
e9e6a2cb-9d50-4a9e-986f-db2e6ed1cc9e | final public String[] search(String str)
{
int pos=0; // pozice v testovacim stringu
int rsize=1; // velikost result size
int rpos=0; // pozice v result bufferu
String result[];
String origstr=str;
if(ignoreCase) str=str.toLowerCase();
if(exact)
if(str.equals(prefix))
return new String[0];... |
909cd395-fe3c-4790-84b2-16499bfc0062 | public static void main(String argv[])
{
if (argv.length<2) return;
String res[];
regexp r=new regexp(argv[0],false);
System.out.println("Regexp: "+r+" compiled: "+r.dump());
System.out.println("Matches: "+argv[1]+" : "+r.matches(argv[1]));
res=r.search(argv[1]);
System.out.println("Search: "+argv[1]+" :... |
c82d63e2-dc4c-4a33-bd09-d1af40d072f9 | uireq(Socket cs)
{
s=cs;
} |
75e7044e-b021-4fb4-a5dd-dad3cbc17c69 | public void run()
{
http10=true;
boolean badhost=false;
try
{
in=new DataInputStream (new BufferedInputStream(s.getInputStream()));
ou=new DataOutputStream(new BufferedOutputStream(s.getOutputStream()));
/* precteme radku GET / */
s.setSoTimeout(httpreq.client_timeout... |
7df4834d-4aa8-4a35-9db1-db9433a9e385 | public final void send_reply(String reply) throws IOException
{
StringBuffer ans=new StringBuffer(2048);
if(http10)
{
ans.append("HTTP/1.0 200 UI Reply Follows\r\n");
ans.append("Server: ");
ans.append(scache.CACHENAME);
ans.append(" UI ");
ans.append(ui.VERSION);
ans.append("\r\nPragma: no-cache\r\nCach... |
cb7849cc-5f10-4d5a-9bd4-e2aac08f041b | public WebConnection (InetAddress ia, int port) throws IOException {
this.ia = ia;
this.port = port;
if(port<=0 || port >65535) throw new java.net.UnknownHostException("Port number out of range");
if(ia==null) throw new java.net.UnknownHostException("Host not found in WebConnection");
socket=null;
recon... |
2ac73f98-aa85-4ade-8f63-8ffb9c8c6513 | public WebConnection(DataInputStream is)
{
keepalive=false;
webis=is;
} |
0816d15e-e8c3-43d0-b92b-7cded0cba133 | public void reconnect() throws IOException
{
keepalive=false;
releasedAt=0;
if(socket!=null)
try
{
socket.close();
}
catch (Exception ignore)
{
}
socket = new Socket (ia, port);
socket.setTcpNoDelay(true); // disable nagle
webos = new DataOutputStream(
new BufferedOutputSt... |
9e9bf126-d09e-4b24-ba1d-c4fbdaa6e4ad | public void close () throws IOException {
try {
if(webos!=null) webos.close ();
if(webis!=null) webis.close ();
if(socket!=null) socket.close ();
} catch (IOException e) {
// System.out.println("couldnt close WebConnection: " + e.getMessage ());
throw e;
}
finally
{
webos = null;
... |
234c3f0f-c421-4372-b89f-8fb1b123ae70 | public InetAddress getInetAddress () {
return ia;
} |
56765749-f14a-4b2c-afa7-5c884f35988b | public int getPort () {
return port;
} |
05ca015e-dc01-4d14-8368-a84f429f016b | public void setReleased () {
setReleased (System.currentTimeMillis());
} |
78299cd9-3f79-4e0f-ae39-d25d5a134c95 | public void setReleased (long d) {
releasedAt = d;
keepalive=false;
} |
3af04aed-9dd1-4eb2-a388-907c580eabaa | public long getReleasedAt () {
return releasedAt;
} |
b9564c40-d798-4323-a99d-ac0ae2fa1b8c | public DataInputStream getInputStream () {
return webis;
} |
b6b49130-d200-4e9e-88d5-be6c2b0cfebe | public DataOutputStream getOutputStream () {
return webos;
} |
789157ab-6bcc-400a-93db-86863a42d319 | public boolean getKeepAlive () {
return keepalive;
} |
6a6108ac-b17c-48b5-8f82-156a399d94a0 | public void setKeepAlive (boolean ka) {
keepalive=ka;
} |
9d7c0fa9-bfe6-411d-991b-ed22539dc760 | public String toString()
{
if(ia!=null)
return ia.getHostAddress () + ":" + port;
else
return "UNKNOWN/Closed";
} |
c3ea5bfd-0b8c-4fc4-8e3d-f84015eaef9e | public void run()
{
System.out.println("[INFO] shutdown hook is running...");
directory_saver_thread.interrupt();
try {
directory_saver_thread.join(15000);
System.out.println("[INFO] shutdown hook is done.");
} catch (Exception ex)
{
System.out.println("[ERROR] shutdown hook join failed:"+ex.toString()... |
096d8fdf-c675-4204-bfa5-cd8712ae74c2 | public shutdownhook(Thread saver)
{
this.setName("shutdown_hook");
directory_saver_thread = saver;
Runtime.getRuntime().addShutdownHook(this);
} |
628620ad-af12-46ad-9699-0399f626dba4 | mgr()
{
dircache=new HashMap <String, cachedir>(40);
/* static init */
request.formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
httpreq.formatter.setTimeZone(TimeZone.getDefault());
cacheobject.c_hit = new AtomicInteger();
cacheobject.c_block = new AtomicInteger();
cacheobject.c_miss = new AtomicInteger();
... |
b2a23152-46b2-45f8-be5a-afc6c15a1667 | public final void check_filesystem()
{
if(
(cache_dir.length()==2 && cache_dir.charAt(1)==':') || /* c: */
(cache_dir.length()==1 && (cache_dir.charAt(0)=='/' || cache_dir.charAt(0)=='\\') ) || /* / */
(cache_dir.length()==3 && cache_dir.charAt(1)==':' && ( cache_dir.charAt(2)=='/' || cache_dir.charA... |
0781095f-4887-43bb-ad92-2272bf7a4c6e | public final void go()
{
scache daemon=new scache(ourport,ouraddress);
Thread saver = new Thread(this);
saver.start(); /* start background directory saver... */
new shutdownhook(saver);
/* refresh pattern hack */
if(refresh!=null && -1==isInRegexpArray("*",refresh))
{
refresh=addRegexpToArray("*",refresh,fa... |
1ac43055-94c9-4cc5-9c27-a96b280e6a61 | private final static boolean filesystemCanUseBackslash()
{
if(cachedir.readonly) return false;
File test=new File(cache_dir,"test\\slash");
try{
new FileOutputStream(test).close();
}
catch (IOException e1) {
return false;
}
test.delete();
return true;
} |
a3b70594-c9e8-49a0-b4f8-c7180c10e4ed | private final static boolean filesystemHasRealDirsize()
{
try
{
if(new File(".").length()>0) return true;
else return false;
}
catch (Exception grrrrrrrrrrrrrrrr)
{
return false;
}
// return false; /* Uncomment to keep some JAVAC compilers happy */
} |
376d6318-fa27-4db5-8811-7e7b0541c367 | private final void writeableFilesystem()
{
(new File(cache_dir)).mkdirs();
new File(cache_dir,"canwritelongname.txt").delete();
try{
new FileOutputStream(cache_dir+File.separator+"canwritelongname.txt").close();
new File(cache_dir,"canwritelongname.txt").delete();
}
catch (IOException e1... |
4ab3e26a-7e90-4097-8dd9-c1fe7153128c | private final boolean endDotFilesystem()
{
try{
new FileOutputStream(cache_dir+File.separator+"dot.").close();
}
catch (IOException e1) {
return false;
}
File d=new File(cache_dir);
String names[];
names=d.list();
new File(cache_dir,"dot.").delete();
if(names==null) return false;
... |
7eb61129-812c-41b4-941e-9bb9691f3d48 | public final void read_config(String cfgfile)
{
try{
String line,token;
StringTokenizer st;
int lineno=0;
cfgfile=scache.cfgdir+File.separator+cfgfile;
DataInputStream dis=new DataInputStream(new BufferedInputStream(new FileInputStream(cfgfile)));
while ( (line = dis.readLine()) != null)
{
lineno++;
... |
b507a0d9-7bcc-4272-a59b-236bffbae738 | public final void setproxy(String hostname,int port,String auth,boolean ftp)
{
if (auth!=null)
if(ftp)
ftp_proxy_auth="Proxy-authorization: Basic "+HTUU.encode_string(auth);
else
http_proxy_auth="Proxy-authorization: Basic "+HTUU.encode_string(auth);
else
if(ftp)
ftp_proxy_auth=n... |
e53a1042-50a4-4a91-8b13-654b67b92317 | final public void process_request(request req) throws MalformedURLException, IOException
{
boolean allowed=false; /* is URL allowed? */
boolean direct=false; /* use direct connection? no proxy */
boolean uireq=false; /* requesting data from UI? */
String requested=req.getURL();
/* HANDLE REMAP RULES ! */
try {
... |
657eff7f-befd-48fb-aeee-abf4067cde71 | final public synchronized cachedir getDir(String locdir,String proto,String host,String port,String direct)
{
cachedir dir=dircache.get(locdir);
if(dir!=null) return dir;
dir=new cachedir(locdir,(proto==null?"http":proto)
+"://"+host+(port==null?"":":"+port)
+direct);
dircache.put(locdir,dir);
return dir;
} |
2eda1464-e3ff-41fd-85f0-b1e7e87b72a3 | final public synchronized cachedir getDir(String locdir,String urlpart)
{
cachedir dir=dircache.get(locdir);
if(dir!=null) return dir;
dir=new cachedir(locdir,urlpart);
dircache.put(locdir,dir);
return dir;
} |
e677a026-33a5-400f-a9e7-e6e89e3feaba | final public void run()
{
int ticks;
if(immediate_shutdownflag==null || flag_check_interval<=0)
flag_check_interval=(int)(SAVETIMER);
/* normalize fci */
ticks=(int)(SAVETIMER/flag_check_interval);
if(ticks==0) ticks=1;
flag_check_interval=(int)(SAVETIMER/ticks);
int i=0;
Thread.currentThread().setName("... |
e5f973f8-4eb1-4761-9166-80790b745052 | final private synchronized void save()
{
int saved=0;
int gc=0;
int cleaned=0;
Iterator <cachedir> i;
i = dircache.values().iterator();
while(i.hasNext())
{
cachedir d;
d=i.next();
if(d.dirty==true) {
d.save();
saved++;
}
else {
i.remove();
cleaned+=d.cleandir();
gc++;
... |
07dcc068-4c07-4968-99cd-96315596904f | final public static String[] parseURL(String url,String proto)
{
String[] res=new String[5];
res[3]=""; /* HashTable do not likes NULL */
int i,j,seven;
if(proto!=null)
{
/* we allready have protocol parsed */
res[4]=proto;
seven=proto.length()+3; /* '://' */
}
else
{
seven=url.indexOf(... |
47336e72-91d2-47d9-93c3-13b635d5668a | final public static String getLocalDir(String host,String port,String urldir,String proto)
{
/*
Host - zero.vole.cz:3333
urldir = /ddfgfds/rerew/ - musi koncit s /
*/
StringBuffer result=new StringBuffer(80);
result.append(cache_dir);
int i;
/* 1. spocitat hash z host stringu */
CRC32 crc=new CRC32();
// ... |
2e53e15a-b925-4223-9ff9-15f459235d42 | final static String[] addStringToArray(String what,String[] array)
{
//if(what==null) return array;
if(array==null) { array=new String[1];array[0]=what;return array;}
String[] tmp;
int ar=array.length;
tmp=new String[ar+1];
System.arraycopy(array,0,tmp,0,ar);
tmp[ar]=what;
return tmp;
} |
2c2fce44-b289-4d1e-a212-87ab5304bddc | final static String[] reverseStringArray(String[] what)
{
String res[];
if(what==null) return null;
res=new String[what.length];
for(int i=0;i<what.length;i++)
res[what.length-1-i]=what[i];
return res;
} |
6c77ae6a-1bc8-409d-b1a7-061b04a353fa | final static regexp[] reverseRegexpArray(regexp[] what)
{
regexp res[];
if(what==null) return null;
res=new regexp[what.length];
for(int i=0;i<what.length;i++)
res[what.length-1-i]=what[i];
return res;
} |
8b3b6545-e6a4-46e2-98ab-66eb2067937a | final static regexp[] addRegexpToArray(String what,regexp[] array, boolean clean)
{
int i;
if(what==null) return array;
if(array==null)
{
array=new regexp[1];
array[0]=new regexp(what,!case_sensitive);
return array;
}
/* test zda neni rule uz zbytecne */
if( (i=isInRegexpArray(what,array)) > -... |
f79f3c0a-045c-4503-943b-05652b8ecd94 | final static java.util.regex.Pattern[] addRealRegexpToArray(String what,java.util.regex.Pattern[] array)
{
java.util.regex.Pattern newrx;
if(what==null) return array;
try {
newrx = java.util.regex.Pattern.compile(what, case_sensitive == true ? 0 : java.util.regex.Pattern.CASE_INSENSITIVE);
}
catch ( java.util.r... |
add92609-8516-4b1f-86b2-ad4bb1f6fba8 | public final static regexp[] cleanUpRegexpArray(regexp[] array,String what)
{
if(array==null) return null;
/* test zda nova rule neco nevyhodi */
regexp whatrule=new regexp(what,!case_sensitive);
regexp[] tmp;
for(int i=0;i<array.length;i++)
{
if(whatrule.matches(array[i].toString()))
{
System.err.pr... |
85fbcfaf-f44f-4e09-a1de-a68a7c40a5bd | final static int isInRegexpArray(String what,regexp[] array)
{
if(array==null) return -1;
for(int i=0;i<array.length;i++)
if(array[i].matches(what)) { return i;}
return -1;
} |
266c6399-c281-43b0-b2a7-a55bf7fd29fd | final public static int [] incIntegerArraySize(int[] array)
{
if(array==null) { array=new int[1];return array;}
int[] tmp;
tmp=new int[array.length+1];
System.arraycopy(array,0,tmp,0,array.length);
return tmp;
} |
b7a460c7-93a5-425b-afd8-ae97359292ee | final public static long[] incLongArraySize(long[] array)
{
if(array==null) { array=new long[1];return array;}
long[] tmp;
tmp=new long[array.length+1];
System.arraycopy(array,0,tmp,0,array.length);
return tmp;
} |
82de9abf-3116-4054-b362-3bdd0ead81e7 | final public static float[] incFloatArraySize(float[] array)
{
if(array==null) { array=new float[1];return array;}
float[] tmp;
tmp=new float[array.length+1];
System.arraycopy(array,0,tmp,0,array.length);
return tmp;
} |
7d4d3198-87fd-4f48-b59b-645046c2980b | final public static String simpleWildMatch(String mask, String test)
{
if(mask==null) return test;
int i=mask.indexOf('*',0);
if(i==-1) {
if(test.equals(mask))
return test;
else
return null;
}
int tl=test.length();
int ml=mask.length();
if(i!=ml-1) throw new Ill... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.