Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sun604645125
Mozi.HttpEmbedded
提交
e36f8501
M
Mozi.HttpEmbedded
项目概览
sun604645125
/
Mozi.HttpEmbedded
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
Mozi.HttpEmbedded
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
e36f8501
编写于
9月 09, 2020
作者:
JasonWcx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
再次修改If-Modified-Since判断条件
上级
13dfea83
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
38 addition
and
38 deletion
+38
-38
Mozi.HttpEmbedded.Test/admin/login.html
Mozi.HttpEmbedded.Test/admin/login.html
+3
-3
Mozi.HttpEmbedded.Test/admin/rtl-login.html
Mozi.HttpEmbedded.Test/admin/rtl-login.html
+1
-1
Mozi.HttpEmbedded/HttpServer.cs
Mozi.HttpEmbedded/HttpServer.cs
+2
-2
Mozi.HttpEmbedded/SocketServer.cs
Mozi.HttpEmbedded/SocketServer.cs
+30
-30
Mozi.HttpEmbedded/Source/StaticFiles.cs
Mozi.HttpEmbedded/Source/StaticFiles.cs
+2
-2
未找到文件。
Mozi.HttpEmbedded.Test/admin/login.html
浏览文件 @
e36f8501
...
...
@@ -57,7 +57,7 @@
</div>
</div>
<div
class=
"text-center"
>
<a
href=
"index.html"
class=
"btn btn-primary"
>
Login
</a>
<a
href=
"index.html"
class=
"btn btn-primary"
>
登陆
</a>
</div>
</form>
</div>
...
...
@@ -65,8 +65,8 @@
</div>
<div
class=
"d-flex justify-content-center"
>
<span
class=
"mr-2"
>
Don't have an account
?
</span>
<a
href=
"signup.html"
>
Sign Up
</a>
<span
class=
"mr-2"
>
没有账户
?
</span>
<a
href=
"signup.html"
>
注册
</a>
</div>
</div>
...
...
Mozi.HttpEmbedded.Test/admin/rtl-login.html
浏览文件 @
e36f8501
<!DOCTYPE html>
<!DOCTYPE html>
<html
lang=
"en"
dir=
"rtl"
>
<head>
...
...
Mozi.HttpEmbedded/HttpServer.cs
浏览文件 @
e36f8501
...
...
@@ -163,11 +163,11 @@ namespace Mozi.HttpEmbedded
{
//响应静态文件
if
(
st
.
Exists
(
path
,
""
))
{
DateTime
dtModified
=
st
.
GetLastModified
(
path
).
ToUniversalTime
();
{
string
ifmodifiedsince
=
context
.
Request
.
Headers
.
GetValue
(
HeaderProperty
.
IfModifiedSince
.
PropertyTag
);
if
(
st
.
CheckIfModified
(
path
,
ifmodifiedsince
))
{
DateTime
dtModified
=
st
.
GetLastModified
(
path
).
ToUniversalTime
();
context
.
Response
.
Headers
.
Add
(
HeaderProperty
.
LastModified
,
dtModified
.
ToString
(
"r"
));
context
.
Response
.
Write
(
st
.
Load
(
path
,
""
));
}
...
...
Mozi.HttpEmbedded/SocketServer.cs
浏览文件 @
e36f8501
...
...
@@ -144,37 +144,21 @@ namespace Mozi.HttpEmbedded
{
StateObject
so
=
(
StateObject
)
iar
.
AsyncState
;
Socket
client
=
so
.
WorkSocket
;
if
(
client
.
Connected
)
{
int
iByteRead
=
client
.
EndReceive
(
iar
);
if
(
client
.
Connected
)
{
int
iByteRead
=
client
.
EndReceive
(
iar
);
if
(
iByteRead
>
0
)
if
(
iByteRead
>
0
)
{
//置空数据连接
so
.
ResetBuffer
(
iByteRead
);
if
(
client
.
Available
>
0
)
{
//置空数据连接
so
.
ResetBuffer
(
iByteRead
);
if
(
client
.
Available
>
0
)
{
//Thread.Sleep(10);
client
.
BeginReceive
(
so
.
Buffer
,
0
,
StateObject
.
BufferSize
,
0
,
CallbackReceive
,
so
);
}
else
{
_socketDocker
.
Remove
(
client
);
if
(
AfterReceiveEnd
!=
null
)
{
AfterReceiveEnd
(
this
,
new
DataTransferArgs
()
{
Data
=
so
.
Data
.
ToArray
(),
IP
=
so
.
IP
,
Port
=
so
.
RemotePort
,
Socket
=
so
.
WorkSocket
});
}
}
//Thread.Sleep(10);
client
.
BeginReceive
(
so
.
Buffer
,
0
,
StateObject
.
BufferSize
,
0
,
CallbackReceive
,
so
);
}
else
{
else
{
_socketDocker
.
Remove
(
client
);
if
(
AfterReceiveEnd
!=
null
)
{
...
...
@@ -190,7 +174,7 @@ namespace Mozi.HttpEmbedded
}
}
else
{
{
_socketDocker
.
Remove
(
client
);
if
(
AfterReceiveEnd
!=
null
)
{
...
...
@@ -203,8 +187,24 @@ namespace Mozi.HttpEmbedded
Socket
=
so
.
WorkSocket
});
}
client
.
Dispose
();
}
}
else
{
_socketDocker
.
Remove
(
client
);
if
(
AfterReceiveEnd
!=
null
)
{
AfterReceiveEnd
(
this
,
new
DataTransferArgs
()
{
Data
=
so
.
Data
.
ToArray
(),
IP
=
so
.
IP
,
Port
=
so
.
RemotePort
,
Socket
=
so
.
WorkSocket
});
}
client
.
Dispose
();
}
}
}
}
Mozi.HttpEmbedded/Source/StaticFiles.cs
浏览文件 @
e36f8501
...
...
@@ -68,7 +68,7 @@ namespace Mozi.HttpEmbedded.Source
/// </summary>
/// <param name="path"></param>
/// <param name="ifModifiedSince"></param>
/// <returns></returns>
/// <returns><
see cref="Boolean:true">Modified</see><
/returns>
public
bool
CheckIfModified
(
string
path
,
string
ifModifiedSince
)
{
DateTime
dtModified
=
System
.
IO
.
File
.
GetLastWriteTime
(
_root
+
"\\"
+
path
);
...
...
@@ -79,7 +79,7 @@ namespace Mozi.HttpEmbedded.Source
DateTime
dtSince
=
DateTime
.
ParseExact
(
ifModifiedSince
,
"ddd, dd MMM yyyy HH:mm:ss GMT"
,
CultureInfo
.
InvariantCulture
,
DateTimeStyles
.
AdjustToUniversal
).
ToLocalTime
();
if
(
dtModified
<=
dtSince
)
if
(
(
dtModified
-
dtSince
).
TotalSeconds
<
1
)
{
return
false
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录