Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
d588094e
提交
d588094e
authored
10 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove undocumented H2 Console feature 'transfer'
上级
b5b92017
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
2 行增加
和
86 行删除
+2
-86
WebApp.java
h2/src/main/org/h2/server/web/WebApp.java
+1
-3
WebServer.java
h2/src/main/org/h2/server/web/WebServer.java
+0
-15
WebThread.java
h2/src/main/org/h2/server/web/WebThread.java
+1
-46
transfer.jsp
h2/src/main/org/h2/server/web/res/transfer.jsp
+0
-22
没有找到文件。
h2/src/main/org/h2/server/web/WebApp.java
浏览文件 @
d588094e
...
...
@@ -151,7 +151,7 @@ public class WebApp {
"jsp"
.
equals
(
suffix
))
{
cache
=
false
;
mimeType
=
"text/html"
;
if
(
session
==
null
&&
!
file
.
startsWith
(
WebServer
.
TRANSFER
)
)
{
if
(
session
==
null
)
{
session
=
server
.
createNewSession
(
hostAddr
);
if
(!
"notAllowed.jsp"
.
equals
(
file
))
{
file
=
"index.do"
;
...
...
@@ -239,8 +239,6 @@ public class WebApp {
file
=
autoCompleteList
();
}
else
if
(
"tools.do"
.
equals
(
file
))
{
file
=
tools
();
}
else
if
(
"transfer.do"
.
equals
(
file
))
{
file
=
"transfer.jsp"
;
}
else
{
file
=
"error.jsp"
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/web/WebServer.java
浏览文件 @
d588094e
...
...
@@ -6,7 +6,6 @@
package
org
.
h2
.
server
.
web
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
...
...
@@ -32,7 +31,6 @@ import org.h2.message.DbException;
import
org.h2.server.Service
;
import
org.h2.server.ShutdownHandler
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.util.IOUtils
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.MathUtils
;
import
org.h2.util.NetUtils
;
...
...
@@ -48,8 +46,6 @@ import org.h2.util.Utils;
*/
public
class
WebServer
implements
Service
{
static
final
String
TRANSFER
=
"transfer"
;
static
final
String
[][]
LANGUAGES
=
{
{
"cs"
,
"\u010ce\u0161tina"
},
{
"de"
,
"Deutsch"
},
...
...
@@ -170,17 +166,6 @@ public class WebServer implements Service {
*/
byte
[]
getFile
(
String
file
)
throws
IOException
{
trace
(
"getFile <"
+
file
+
">"
);
if
(
file
.
startsWith
(
TRANSFER
+
"/"
)
&&
new
File
(
TRANSFER
).
exists
())
{
file
=
file
.
substring
(
TRANSFER
.
length
()
+
1
);
if
(!
isSimpleName
(
file
))
{
return
null
;
}
File
f
=
new
File
(
TRANSFER
,
file
);
if
(!
f
.
exists
())
{
return
null
;
}
return
IOUtils
.
readBytesAndClose
(
new
FileInputStream
(
f
),
-
1
);
}
byte
[]
data
=
Utils
.
getResource
(
"/org/h2/server/web/res/"
+
file
);
if
(
data
==
null
)
{
trace
(
" null"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/web/WebThread.java
浏览文件 @
d588094e
...
...
@@ -7,12 +7,9 @@ package org.h2.server.web;
import
java.io.BufferedInputStream
;
import
java.io.BufferedOutputStream
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.io.RandomAccessFile
;
import
java.net.Socket
;
import
java.net.UnknownHostException
;
import
java.util.Iterator
;
...
...
@@ -37,7 +34,6 @@ class WebThread extends WebApp implements Runnable {
protected
final
Socket
socket
;
private
final
Thread
thread
;
private
InputStream
input
;
private
int
headerBytes
;
private
String
ifModifiedSince
;
WebThread
(
Socket
socket
,
WebServer
server
)
{
...
...
@@ -210,12 +206,10 @@ class WebThread extends WebApp implements Runnable {
private
String
readHeaderLine
()
throws
IOException
{
StringBuilder
buff
=
new
StringBuilder
();
while
(
true
)
{
headerBytes
++;
int
c
=
input
.
read
();
if
(
c
==
-
1
)
{
throw
new
IOException
(
"Unexpected EOF"
);
}
else
if
(
c
==
'\r'
)
{
headerBytes
++;
if
(
input
.
read
()
==
'\n'
)
{
return
buff
.
length
()
>
0
?
buff
.
toString
()
:
null
;
}
...
...
@@ -320,7 +314,7 @@ class WebThread extends WebApp implements Runnable {
}
}
if
(
multipart
)
{
uploadMultipart
(
input
,
len
);
// not supported
}
else
if
(
session
!=
null
&&
len
>
0
)
{
byte
[]
bytes
=
DataUtils
.
newBytes
(
len
);
for
(
int
pos
=
0
;
pos
<
len
;)
{
...
...
@@ -332,45 +326,6 @@ class WebThread extends WebApp implements Runnable {
return
keepAlive
;
}
private
void
uploadMultipart
(
InputStream
in
,
int
len
)
throws
IOException
{
if
(!
new
File
(
WebServer
.
TRANSFER
).
exists
())
{
return
;
}
String
fileName
=
"temp.bin"
;
headerBytes
=
0
;
String
boundary
=
readHeaderLine
();
while
(
true
)
{
String
line
=
readHeaderLine
();
if
(
line
==
null
)
{
break
;
}
int
index
=
line
.
indexOf
(
"filename=\""
);
if
(
index
>
0
)
{
fileName
=
line
.
substring
(
index
+
"filename=\""
.
length
(),
line
.
lastIndexOf
(
'"'
));
}
trace
(
" "
+
line
);
}
if
(!
WebServer
.
isSimpleName
(
fileName
))
{
return
;
}
len
-=
headerBytes
;
File
file
=
new
File
(
WebServer
.
TRANSFER
,
fileName
);
OutputStream
out
=
new
FileOutputStream
(
file
);
IOUtils
.
copy
(
in
,
out
,
len
);
out
.
close
();
// remove the boundary
RandomAccessFile
f
=
new
RandomAccessFile
(
file
,
"rw"
);
int
testSize
=
(
int
)
Math
.
min
(
f
.
length
(),
Constants
.
IO_BUFFER_SIZE
);
f
.
seek
(
f
.
length
()
-
testSize
);
byte
[]
bytes
=
DataUtils
.
newBytes
(
Constants
.
IO_BUFFER_SIZE
);
f
.
readFully
(
bytes
,
0
,
testSize
);
String
s
=
new
String
(
bytes
,
"ASCII"
);
int
x
=
s
.
lastIndexOf
(
boundary
);
f
.
setLength
(
f
.
length
()
-
testSize
+
x
-
2
);
f
.
close
();
}
private
static
String
getHeaderLineValue
(
String
line
)
{
return
line
.
substring
(
line
.
indexOf
(
':'
)
+
1
).
trim
();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/web/res/transfer.jsp
deleted
100644 → 0
浏览文件 @
b5b92017
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
Copyright 2004-2014 H2 Group. Multiple-Licensed under the MPL 2.0,
and the EPL 1.0 (http://h2database.com/html/license.html).
Initial Developer: H2 Group
-->
<html><head>
<meta
http-equiv=
"Content-Type"
content=
"text/html;charset=utf-8"
/>
<title>
Upload
</title>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"stylesheet.css"
/>
</head>
<body>
<form
action=
"transfer.do"
method=
"post"
enctype=
"multipart/form-data"
>
<p>
File:
<br
/>
<input
name=
"file"
type=
"file"
size=
"50"
/><br
/><br
/>
<input
type=
"submit"
value=
"Upload"
/>
</p>
</form>
</body></html>
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论