Skip to content

Commit c140567

Browse files
committed
Disabled proxy capability as it introduced a dependency on Ethernet, which meant that it didn't work properly with a WiFi shield
1 parent 44d790b commit c140567

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

HttpClient.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
#include "HttpClient.h"
66
#include "b64.h"
7+
#ifdef PROXY_ENABLED // currently disabled as introduces dependency on Dns.h in Ethernet
78
#include <Dns.h>
9+
#endif
810
#include <string.h>
911
#include <ctype.h>
1012

@@ -16,6 +18,7 @@ const char* HttpClient::kPut = "PUT";
1618
const char* HttpClient::kDelete = "DELETE";
1719
const char* HttpClient::kContentLengthPrefix = "Content-Length: ";
1820

21+
#ifdef PROXY_ENABLED // currently disabled as introduces dependency on Dns.h in Ethernet
1922
HttpClient::HttpClient(Client& aClient, const char* aProxy, uint16_t aProxyPort)
2023
: iClient(&aClient), iProxyPort(aProxyPort)
2124
{
@@ -30,6 +33,13 @@ HttpClient::HttpClient(Client& aClient, const char* aProxy, uint16_t aProxyPort)
3033
(void)dns.getHostByName(aProxy, iProxyAddress);
3134
}
3235
}
36+
#else
37+
HttpClient::HttpClient(Client& aClient)
38+
: iClient(&aClient)
39+
{
40+
resetState();
41+
}
42+
#endif
3343

3444
void HttpClient::resetState()
3545
{
@@ -162,7 +172,7 @@ int HttpClient::sendInitialHeaders(const char* aServerName, IPAddress aServerIP,
162172
}
163173
}
164174
iClient->print(aURLPath);
165-
iClient->println(" HTTP/1.0");
175+
iClient->println(" HTTP/1.1");
166176
// The host header, if required
167177
if (aServerName)
168178
{

HttpClient.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
#include <Arduino.h>
99
#include <IPAddress.h>
10-
#include "Ethernet.h"
1110
#include "Client.h"
1211

1312
static const int HTTP_SUCCESS =0;
@@ -38,7 +37,11 @@ class HttpClient : public Client
3837
// FIXME Write longer API request, using port and user-agent, example
3938
// FIXME Update tempToPachube example to calculate Content-Length correctly
4039

40+
#ifdef PROXY_ENABLED // currently disabled as introduces dependency on Dns.h in Ethernet
4141
HttpClient(Client& aClient, const char* aProxy =NULL, uint16_t aProxyPort =0);
42+
#else
43+
HttpClient(Client& aClient);
44+
#endif
4245

4346
/** Start a more complex request.
4447
Use this when you need to send additional headers in the request,

0 commit comments

Comments
 (0)