Skip to content

Commit

Permalink
Disabled proxy capability as it introduced a dependency on Ethernet, …
Browse files Browse the repository at this point in the history
…which meant that it didn't work properly with a WiFi shield
  • Loading branch information
amcewen committed Aug 13, 2012
1 parent 44d790b commit c140567
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
12 changes: 11 additions & 1 deletion HttpClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

#include "HttpClient.h"
#include "b64.h"
#ifdef PROXY_ENABLED // currently disabled as introduces dependency on Dns.h in Ethernet
#include <Dns.h>
#endif
#include <string.h>
#include <ctype.h>

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

#ifdef PROXY_ENABLED // currently disabled as introduces dependency on Dns.h in Ethernet
HttpClient::HttpClient(Client& aClient, const char* aProxy, uint16_t aProxyPort)
: iClient(&aClient), iProxyPort(aProxyPort)
{
Expand All @@ -30,6 +33,13 @@ HttpClient::HttpClient(Client& aClient, const char* aProxy, uint16_t aProxyPort)
(void)dns.getHostByName(aProxy, iProxyAddress);
}
}
#else
HttpClient::HttpClient(Client& aClient)
: iClient(&aClient)
{
resetState();
}
#endif

void HttpClient::resetState()
{
Expand Down Expand Up @@ -162,7 +172,7 @@ int HttpClient::sendInitialHeaders(const char* aServerName, IPAddress aServerIP,
}
}
iClient->print(aURLPath);
iClient->println(" HTTP/1.0");
iClient->println(" HTTP/1.1");
// The host header, if required
if (aServerName)
{
Expand Down
5 changes: 4 additions & 1 deletion HttpClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include <Arduino.h>
#include <IPAddress.h>
#include "Ethernet.h"
#include "Client.h"

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

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

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

0 comments on commit c140567

Please sign in to comment.