mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-06-27 05:23:13 +00:00
1.6.1
This commit is contained in:
@ -30,6 +30,7 @@ using System.Text;
|
||||
using Esiur.Misc;
|
||||
using Esiur.Data;
|
||||
using System.Net;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Esiur.Net.Packets
|
||||
{
|
||||
@ -241,12 +242,12 @@ namespace Esiur.Net.Packets
|
||||
// check limit
|
||||
if (postSize > data.Length - headerSize)
|
||||
return -(postSize - (data.Length - headerSize));
|
||||
|
||||
|
||||
|
||||
if (
|
||||
Headers["content-type"] == null
|
||||
|| Headers["content-type"] == ""
|
||||
|| Headers["content-type"].StartsWith("application/x-www-form-urlencoded"))
|
||||
|| Headers["content-type"].StartsWith("application/x-www-form-urlencoded"))
|
||||
{
|
||||
string[] PostVars = null;
|
||||
PostVars = Encoding.UTF8.GetString(data, (int)headerSize, (int)postSize).Split('&');
|
||||
@ -265,10 +266,10 @@ namespace Esiur.Net.Packets
|
||||
}
|
||||
else
|
||||
if (PostForms.Contains("unknown"))
|
||||
PostForms["unknown"] = PostForms["unknown"]
|
||||
+ "&" + WebUtility.HtmlDecode(WebUtility.UrlDecode(PostVars[J]));
|
||||
else
|
||||
PostForms.Add("unknown", WebUtility.HtmlDecode(WebUtility.UrlDecode(PostVars[J])));
|
||||
PostForms["unknown"] = PostForms["unknown"]
|
||||
+ "&" + WebUtility.HtmlDecode(WebUtility.UrlDecode(PostVars[J]));
|
||||
else
|
||||
PostForms.Add("unknown", WebUtility.HtmlDecode(WebUtility.UrlDecode(PostVars[J])));
|
||||
}
|
||||
}
|
||||
else if (Headers["content-type"].StartsWith("multipart/form-data"))
|
||||
@ -291,6 +292,10 @@ namespace Esiur.Net.Packets
|
||||
PostForms.Add(ps[0].Substring(st, ed - st), ps[1]);
|
||||
}
|
||||
}
|
||||
//else if (Headers["content-type"] == "application/json")
|
||||
//{
|
||||
// var json = DC.Clip(data, headerSize, postSize);
|
||||
//}
|
||||
else
|
||||
{
|
||||
//PostForms.Add(Headers["content-type"], Encoding.Default.GetString( ));
|
||||
|
@ -110,11 +110,11 @@ namespace Esiur.Net.Packets
|
||||
|
||||
// Request Invoke
|
||||
InvokeFunctionArrayArguments = 0x10,
|
||||
GetProperty,
|
||||
GetPropertyIfModified,
|
||||
SetProperty,
|
||||
InvokeFunctionNamedArguments,
|
||||
|
||||
Listen,
|
||||
Unlisten,
|
||||
SetProperty,
|
||||
|
||||
// Request Attribute
|
||||
GetAllAttributes = 0x18,
|
||||
UpdateAllAttributes,
|
||||
@ -543,7 +543,8 @@ namespace Esiur.Net.Packets
|
||||
offset += cl;
|
||||
|
||||
}
|
||||
else if (Action == IIPPacketAction.GetProperty)
|
||||
else if (Action == IIPPacketAction.Listen
|
||||
|| Action == IIPPacketAction.Unlisten)// .GetProperty)
|
||||
{
|
||||
if (NotEnough(offset, ends, 5))
|
||||
return -dataLengthNeeded;
|
||||
@ -554,20 +555,20 @@ namespace Esiur.Net.Packets
|
||||
MethodIndex = data[offset++];
|
||||
|
||||
}
|
||||
else if (Action == IIPPacketAction.GetPropertyIfModified)
|
||||
{
|
||||
if (NotEnough(offset, ends, 9))
|
||||
return -dataLengthNeeded;
|
||||
//else if (Action == IIPPacketAction.GetPropertyIfModified)
|
||||
//{
|
||||
// if (NotEnough(offset, ends, 9))
|
||||
// return -dataLengthNeeded;
|
||||
|
||||
ResourceId = data.GetUInt32(offset);
|
||||
offset += 4;
|
||||
// ResourceId = data.GetUInt32(offset);
|
||||
// offset += 4;
|
||||
|
||||
MethodIndex = data[offset++];
|
||||
// MethodIndex = data[offset++];
|
||||
|
||||
ResourceAge = data.GetUInt64(offset);
|
||||
offset += 8;
|
||||
// ResourceAge = data.GetUInt64(offset);
|
||||
// offset += 8;
|
||||
|
||||
}
|
||||
//}
|
||||
else if (Action == IIPPacketAction.SetProperty)
|
||||
{
|
||||
if (NotEnough(offset, ends, 6))
|
||||
@ -707,9 +708,9 @@ namespace Esiur.Net.Packets
|
||||
offset += cl;
|
||||
}
|
||||
else if (Action == IIPPacketAction.InvokeFunctionArrayArguments
|
||||
|| Action == IIPPacketAction.InvokeFunctionNamedArguments
|
||||
|| Action == IIPPacketAction.GetProperty
|
||||
|| Action == IIPPacketAction.GetPropertyIfModified)
|
||||
|| Action == IIPPacketAction.InvokeFunctionNamedArguments)
|
||||
//|| Action == IIPPacketAction.GetProperty
|
||||
//|| Action == IIPPacketAction.GetPropertyIfModified)
|
||||
{
|
||||
if (NotEnough(offset, ends, 1))
|
||||
return -dataLengthNeeded;
|
||||
@ -740,7 +741,9 @@ namespace Esiur.Net.Packets
|
||||
offset += (uint)size;
|
||||
}
|
||||
}
|
||||
else if (Action == IIPPacketAction.SetProperty)
|
||||
else if (Action == IIPPacketAction.SetProperty
|
||||
|| Action == IIPPacketAction.Listen
|
||||
|| Action == IIPPacketAction.Unlisten)
|
||||
{
|
||||
// nothing to do
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ namespace Esiur.Net.Packets
|
||||
}
|
||||
*/
|
||||
|
||||
PosixTime Timeval;
|
||||
//PosixTime Timeval;
|
||||
public byte[] Header;
|
||||
public byte[] Preamble;
|
||||
//public byte[] Payload;
|
||||
|
Reference in New Issue
Block a user