Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2016-12-18 18:46:03 +0300
committerDavid Crocker <dcrocker@eschertech.com>2016-12-18 18:46:03 +0300
commit90c4e1a53ab9fb40933259fa852b1498ecca0dc0 (patch)
treecb4b6abfa7e9449683748b69f0f723d535fe21a2 /src
parentda3d67403f756c749deb175f209a6d964720a4c7 (diff)
Version 1.17RC2
Renamed function Network::IPAddress to GetIPAddress to avoid clash with IPAddress class used in DuetEthernet build Duet 0.8.5 web server now looks for a gzipped version of the file is a web file was not found Duet 0.8.5 web server only returns a 404 page of the file that was not found was a .html or .htm file
Diffstat (limited to 'src')
-rw-r--r--src/Configuration.h4
-rw-r--r--src/Duet/Network.cpp6
-rw-r--r--src/Duet/Network.h2
-rw-r--r--src/Duet/Webserver.cpp47
-rw-r--r--src/Duet/Webserver.h2
-rw-r--r--src/DuetNG/DuetWiFi/Network.cpp2
-rw-r--r--src/DuetNG/DuetWiFi/Network.h2
-rw-r--r--src/RADDS/Network.cpp2
-rw-r--r--src/RADDS/Network.h2
9 files changed, 36 insertions, 33 deletions
diff --git a/src/Configuration.h b/src/Configuration.h
index 4905ccae..ead50a21 100644
--- a/src/Configuration.h
+++ b/src/Configuration.h
@@ -28,11 +28,11 @@ Licence: GPL
// Firmware name is now defined in the Pins file
#ifndef VERSION
-# define VERSION "1.17RC1a"
+# define VERSION "1.17RC2"
#endif
#ifndef DATE
-# define DATE "2016-12-13"
+# define DATE "2016-12-18"
#endif
#define AUTHORS "reprappro, dc42, zpl, t3p3, dnewman"
diff --git a/src/Duet/Network.cpp b/src/Duet/Network.cpp
index 157d3814..f3ecfcf3 100644
--- a/src/Duet/Network.cpp
+++ b/src/Duet/Network.cpp
@@ -471,7 +471,7 @@ void Network::Spin()
{
if (!ethernetStarted)
{
- start_ethernet(platform->IPAddress(), platform->NetMask(), platform->GateWay(), &ethernet_status_callback);
+ start_ethernet(platform->GetIPAddress(), platform->NetMask(), platform->GateWay(), &ethernet_status_callback);
ethernetStarted = true;
// Initialise this one here, because it requires a configured IGMP network interface
@@ -479,7 +479,7 @@ void Network::Spin()
}
else
{
- ethernet_set_configuration(platform->IPAddress(), platform->NetMask(), platform->GateWay());
+ ethernet_set_configuration(platform->GetIPAddress(), platform->NetMask(), platform->GateWay());
}
state = NetworkObtainingIP;
}
@@ -736,7 +736,7 @@ bool Network::InLwip() const
return lwipLocked;
}
-const uint8_t *Network::IPAddress() const
+const uint8_t *Network::GetIPAddress() const
{
return ethernet_get_ipaddress();
}
diff --git a/src/Duet/Network.h b/src/Duet/Network.h
index 0d1f77c9..cc099864 100644
--- a/src/Duet/Network.h
+++ b/src/Duet/Network.h
@@ -169,7 +169,7 @@ class Network
// Global settings
- const uint8_t *IPAddress() const;
+ const uint8_t *GetIPAddress() const;
void SetIPAddress(const uint8_t ipAddress[], const uint8_t netmask[], const uint8_t gateway[]);
void SetHostname(const char *name);
diff --git a/src/Duet/Webserver.cpp b/src/Duet/Webserver.cpp
index 69807ace..293b77e0 100644
--- a/src/Duet/Webserver.cpp
+++ b/src/Duet/Webserver.cpp
@@ -617,7 +617,6 @@ void Webserver::HttpInterpreter::DoFastUpload()
if (transaction->ReadBuffer(buffer, len))
{
network->Unlock();
-#if 1
// Write data in sector-aligned chunks. This also means that the buffer in fatfs is only used to hold the FAT.
static const size_t writeBufLength = 2048; // use a multiple of the 512b sector size
static uint32_t writeBufStorage[writeBufLength/4]; // aligned buffer for file writes
@@ -652,18 +651,6 @@ void Webserver::HttpInterpreter::DoFastUpload()
}
}
}
-#else
- if (!fileBeingUploaded.Write(buffer, len))
- {
- platform->Message(GENERIC_MESSAGE, "Error: Could not write upload data!\n");
- CancelUpload();
-
- while (!network->Lock());
- SendJsonResponse("upload");
- return;
- }
- uploadedBytes += len;
-#endif
while (!network->Lock());
}
@@ -710,6 +697,7 @@ void Webserver::HttpInterpreter::SendFile(const char* nameOfFileToSend, bool isW
{
NetworkTransaction *transaction = webserver->currentTransaction;
FileStore *fileToSend;
+ bool zip = false;
if (isWebFile)
{
@@ -722,16 +710,32 @@ void Webserver::HttpInterpreter::SendFile(const char* nameOfFileToSend, bool isW
}
}
fileToSend = platform->GetFileStore(platform->GetWebDir(), nameOfFileToSend, false);
- if (fileToSend == nullptr)
+
+ // If we failed to open the file, see if we can open a file with the same name and a ".gz" extension
+ if (fileToSend == nullptr && !StringEndsWith(nameOfFileToSend, ".gz") && strlen(nameOfFileToSend) + 3 <= FILENAME_LENGTH)
{
- nameOfFileToSend = FOUR04_PAGE_FILE;
- fileToSend = platform->GetFileStore(platform->GetWebDir(), nameOfFileToSend, false);
- if (fileToSend == nullptr)
+ char nameBuf[FILENAME_LENGTH + 1];
+ strcpy(nameBuf, nameOfFileToSend);
+ strcat(nameBuf, ".gz");
+ fileToSend = platform->GetFileStore(platform->GetWebDir(), nameBuf, false);
+ if (fileToSend != nullptr)
{
- RejectMessage("not found", 404);
- return;
+ zip = true;
}
}
+
+ // If we still couldn't find the file and it was an HTML file, return the 404 error page
+ if (fileToSend == nullptr && (StringEndsWith(nameOfFileToSend, ".html") || StringEndsWith(nameOfFileToSend, ".htm")))
+ {
+ nameOfFileToSend = FOUR04_PAGE_FILE;
+ fileToSend = platform->GetFileStore(platform->GetWebDir(), nameOfFileToSend, false);
+ }
+
+ if (fileToSend == nullptr)
+ {
+ RejectMessage("not found", 404);
+ return;
+ }
transaction->SetFileToWrite(fileToSend);
}
else
@@ -761,7 +765,6 @@ void Webserver::HttpInterpreter::SendFile(const char* nameOfFileToSend, bool isW
}
const char* contentType;
- bool zip = false;
if (StringEndsWith(nameOfFileToSend, ".png"))
{
contentType = "image/png";
@@ -1541,7 +1544,7 @@ bool Webserver::HttpInterpreter::ProcessMessage()
}
else
{
- SendFile(commandWords[1]);
+ SendFile(commandWords[1], true);
}
ResetState();
@@ -2175,7 +2178,7 @@ void Webserver::FtpInterpreter::ProcessLine()
else if (StringEquals(clientMessage, "PASV"))
{
/* get local IP address */
- const byte *ip_address = network->IPAddress();
+ const uint8_t * const ip_address = network->GetIPAddress();
/* open random port > 1023 */
//rand(); // TRNG doesn't require this
diff --git a/src/Duet/Webserver.h b/src/Duet/Webserver.h
index 01366e2f..d2bab356 100644
--- a/src/Duet/Webserver.h
+++ b/src/Duet/Webserver.h
@@ -193,7 +193,7 @@ class Webserver
const char* value;
};
- void SendFile(const char* nameOfFileToSend, bool isWebFile = true);
+ void SendFile(const char* nameOfFileToSend, bool isWebFile);
void SendGCodeReply();
void SendJsonResponse(const char* command);
void GetJsonResponse(const char* request, OutputBuffer *&response, const char* key, const char* value, size_t valueLength, bool& keepOpen);
diff --git a/src/DuetNG/DuetWiFi/Network.cpp b/src/DuetNG/DuetWiFi/Network.cpp
index 7920ed34..3b9c6226 100644
--- a/src/DuetNG/DuetWiFi/Network.cpp
+++ b/src/DuetNG/DuetWiFi/Network.cpp
@@ -736,7 +736,7 @@ bool Network::IsEnabled() const
return state != disabled;
}
-const uint8_t *Network::IPAddress() const
+const uint8_t *Network::GetIPAddress() const
{
return ipAddress;
}
diff --git a/src/DuetNG/DuetWiFi/Network.h b/src/DuetNG/DuetWiFi/Network.h
index 7f4e66f4..a4bf3759 100644
--- a/src/DuetNG/DuetWiFi/Network.h
+++ b/src/DuetNG/DuetWiFi/Network.h
@@ -46,7 +46,7 @@ class Network
};
public:
- const uint8_t *IPAddress() const;
+ const uint8_t *GetIPAddress() const;
void SetIPAddress(const uint8_t ipAddress[], const uint8_t netmask[], const uint8_t gateway[]);
Network(Platform* p);
diff --git a/src/RADDS/Network.cpp b/src/RADDS/Network.cpp
index 901f3b45..13ff7724 100644
--- a/src/RADDS/Network.cpp
+++ b/src/RADDS/Network.cpp
@@ -2,7 +2,7 @@
static const uint8_t dummy_ipv4[4] = { 0, 0, 0, 0 };
-const uint8_t *Network::IPAddress() const
+const uint8_t *Network::GetIPAddress() const
{
return dummy_ipv4;
}
diff --git a/src/RADDS/Network.h b/src/RADDS/Network.h
index 0cc3db50..564702c9 100644
--- a/src/RADDS/Network.h
+++ b/src/RADDS/Network.h
@@ -28,7 +28,7 @@ public:
void SetHostname(const char *name) const { };
void SetHttpPort(uint16_t port) const { };
uint16_t GetHttpPort() const { return (uint16_t)0; }
- const uint8_t *IPAddress() const;
+ const uint8_t *GetIPAddress() const;
};
#endif