Some tweaks to get it running right
This commit is contained in:
parent
621794f0b3
commit
c63be78a08
@ -25,9 +25,9 @@
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
|
@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
namespace BlubbFish.BosMon.Webserver {
|
||||
class POCSAG {
|
||||
@ -52,7 +52,7 @@ namespace BlubbFish.BosMon.Webserver {
|
||||
internal String ToXML() {
|
||||
String ret = "<telegram>\r\n";
|
||||
ret += "<function>"+this.Function+ "</function>\r\n";
|
||||
ret += "<message>"+ HttpUtility.HtmlEncode(this.Message) + "</message>\r\n";
|
||||
ret += "<message>"+ WebUtility.HtmlEncode(this.Message) + "</message>\r\n";
|
||||
ret += "<type>3</type>\r\n";
|
||||
ret += "<address>"+this.Address.ToString("D7")+ "</address>\r\n";
|
||||
ret += "<timestamp>"+((DateTimeOffset)this.Time).ToUnixTimeMilliseconds()+ "</timestamp>\r\n";
|
||||
|
@ -38,7 +38,7 @@ namespace BlubbFish.BosMon.Webserver {
|
||||
ctx.Response.OutputStream.Close();
|
||||
ctx.Response.Close();
|
||||
} catch(Exception e) {
|
||||
Helper.WriteError("Context Exception: " + e.Message +""+e.Source+ "\n\n" + e.StackTrace);
|
||||
Helper.WriteError("Context Exception: " + e.Message + " " + e.Source + "\n" + e.StackTrace);
|
||||
}
|
||||
}, this._listener.GetContext());
|
||||
}
|
||||
@ -49,6 +49,7 @@ namespace BlubbFish.BosMon.Webserver {
|
||||
}
|
||||
|
||||
private void SendResponse(HttpListenerContext ctx) {
|
||||
try {
|
||||
if (this.CheckAuth(ctx.Request)) {
|
||||
ctx.Response.ContentType = "text/xml";
|
||||
ctx.Response.Headers.Add(HttpResponseHeader.Server, "BM Webserver 1.3");
|
||||
@ -79,6 +80,10 @@ namespace BlubbFish.BosMon.Webserver {
|
||||
}
|
||||
ctx.Response.StatusCode = 403;
|
||||
}
|
||||
catch(Exception e) {
|
||||
Helper.WriteError("Send Response Exception: " + e.Message + " " + e.Source + "\n" + e.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
private void ParseInput(HttpListenerContext request) {
|
||||
if(this.CheckAuth(request.Request)) {
|
||||
@ -91,7 +96,7 @@ namespace BlubbFish.BosMon.Webserver {
|
||||
foreach (String item in items) {
|
||||
String[] kv = item.Split('=');
|
||||
if (kv.Length == 2) {
|
||||
kv[1] = HttpUtility.UrlDecode(kv[1]);
|
||||
kv[1] = WebUtility.UrlDecode(kv[1]);
|
||||
input.Add(kv[0], kv[1]);
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ ExecStartPre=/bin/rm /var/log/bmweb.log
|
||||
ExecStartPre=/bin/touch /var/log/bmweb.log
|
||||
ExecStartPre=/bin/chown bmweb:bmweb /var/log/bmweb.log
|
||||
ExecStartPre=/bin/chmod 644 /var/log/bmweb.log
|
||||
ExecStart=/usr/bin/mono /usr/local/bin/bmweb/BosMon-Webserver.exe
|
||||
ExecStart=/usr/bin/mono --debug /usr/local/bin/bmweb/BosMon-Webserver.exe
|
||||
KillMode=control-group
|
||||
TimeoutStopSec=5
|
||||
Restart=on-failure
|
||||
|
@ -3,7 +3,7 @@ Version: x.x-x
|
||||
Section: base
|
||||
Priority: optional
|
||||
Architecture: any
|
||||
Depends: mono-runtime (>= 5.16.0), libmono-system-web4.0-cil (>= 5.16.0)
|
||||
Depends: mono-runtime (>= 5.16.0)
|
||||
Maintainer: BlubbFish <dev@blubbfish.net>
|
||||
Description: Bosmon-Webserver
|
||||
A Webserver for Bosmon Telegrafs
|
||||
|
Loading…
Reference in New Issue
Block a user