mirror of
https://github.com/arduino-libraries/ArduinoHttpClient.git
synced 2025-04-19 21:22:15 +03:00
Disabled proxy capability as it introduced a dependency on Ethernet, which meant that it didn't work properly with a WiFi shield
This commit is contained in:
parent
44d790b8a6
commit
c1405676f4
@ -4,7 +4,9 @@
|
|||||||
|
|
||||||
#include "HttpClient.h"
|
#include "HttpClient.h"
|
||||||
#include "b64.h"
|
#include "b64.h"
|
||||||
|
#ifdef PROXY_ENABLED // currently disabled as introduces dependency on Dns.h in Ethernet
|
||||||
#include <Dns.h>
|
#include <Dns.h>
|
||||||
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
@ -16,6 +18,7 @@ const char* HttpClient::kPut = "PUT";
|
|||||||
const char* HttpClient::kDelete = "DELETE";
|
const char* HttpClient::kDelete = "DELETE";
|
||||||
const char* HttpClient::kContentLengthPrefix = "Content-Length: ";
|
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)
|
HttpClient::HttpClient(Client& aClient, const char* aProxy, uint16_t aProxyPort)
|
||||||
: iClient(&aClient), iProxyPort(aProxyPort)
|
: iClient(&aClient), iProxyPort(aProxyPort)
|
||||||
{
|
{
|
||||||
@ -30,6 +33,13 @@ HttpClient::HttpClient(Client& aClient, const char* aProxy, uint16_t aProxyPort)
|
|||||||
(void)dns.getHostByName(aProxy, iProxyAddress);
|
(void)dns.getHostByName(aProxy, iProxyAddress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
HttpClient::HttpClient(Client& aClient)
|
||||||
|
: iClient(&aClient)
|
||||||
|
{
|
||||||
|
resetState();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void HttpClient::resetState()
|
void HttpClient::resetState()
|
||||||
{
|
{
|
||||||
@ -162,7 +172,7 @@ int HttpClient::sendInitialHeaders(const char* aServerName, IPAddress aServerIP,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
iClient->print(aURLPath);
|
iClient->print(aURLPath);
|
||||||
iClient->println(" HTTP/1.0");
|
iClient->println(" HTTP/1.1");
|
||||||
// The host header, if required
|
// The host header, if required
|
||||||
if (aServerName)
|
if (aServerName)
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <IPAddress.h>
|
#include <IPAddress.h>
|
||||||
#include "Ethernet.h"
|
|
||||||
#include "Client.h"
|
#include "Client.h"
|
||||||
|
|
||||||
static const int HTTP_SUCCESS =0;
|
static const int HTTP_SUCCESS =0;
|
||||||
@ -38,7 +37,11 @@ public:
|
|||||||
// FIXME Write longer API request, using port and user-agent, example
|
// FIXME Write longer API request, using port and user-agent, example
|
||||||
// FIXME Update tempToPachube example to calculate Content-Length correctly
|
// 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);
|
HttpClient(Client& aClient, const char* aProxy =NULL, uint16_t aProxyPort =0);
|
||||||
|
#else
|
||||||
|
HttpClient(Client& aClient);
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Start a more complex request.
|
/** Start a more complex request.
|
||||||
Use this when you need to send additional headers in the request,
|
Use this when you need to send additional headers in the request,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user