Interception of http GET working.

This commit is contained in:
Adrian Bowyer 2013-09-27 17:21:51 +01:00
parent aaf75220de
commit 4e6f8a1b75
2 changed files with 13 additions and 4 deletions

View file

@ -721,8 +721,8 @@ void Network::Spin()
// Read any data that's been received.
if(inputPointer < inputLength)
return;
//if(inputPointer < inputLength)
// return;
// Anything new come in?
@ -744,13 +744,20 @@ void Network::ReceiveInput(char* ip, int length)
{
inputBuffer = ip;
inputLength = length;
//reprap.GetPlatform()->Message(HOST_MESSAGE, "Length: ");
//sprintf(scratchString, "%d", inputLength);
//reprap.GetPlatform()->Message(HOST_MESSAGE, scratchString);
//reprap.GetPlatform()->Message(HOST_MESSAGE, "\n");
reprap.GetPlatform()->Message(HOST_MESSAGE, inputBuffer);
inputPointer = 0;
}
extern "C" {
void RepRapNetworkReceiveInput(char* ip, int length)
{
reprap.GetPlatform()->GetNetwork()->ReceiveInput(ip, length);
}
}
void Network::Write(char b)

View file

@ -231,7 +231,7 @@ static void CloseConnection()
}
}
static void CloseConnectionAndFreeBuffer()
static void FreeBufferAndCloseConnection()
{
FreeBuffer();
CloseConnection();
@ -263,6 +263,8 @@ http_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
// Deal with data received
RepRapNetworkReceiveInput(data, p->len);
// Free the buffer
// Send any data to reply
@ -301,7 +303,7 @@ http_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
tcp_sent(pcb, http_sent);
} else
{
CloseConnectionAndFreeBuffer();
FreeBufferAndCloseConnection();
//pbuf_free(p);
//close_conn(pcb, hs);
}