1
0
mirror of https://github.com/arduino-libraries/ArduinoHttpClient.git synced 2025-06-11 17:08:08 +03:00

Updated to use the new generic Client API (rather than the Ethernet-specific one) and added ability to connect via an HTTP proxy

This commit is contained in:
amcewen
2011-09-05 16:03:00 +01:00
parent a9a0821cff
commit 6e8d284c7b
3 changed files with 106 additions and 25 deletions

View File

@ -9,7 +9,7 @@
#include <HttpClient.h>
#include <b64.h>
#include <Ethernet.h>
#include <Client.h>
#include <EthernetClient.h>
// This example downloads the URL "http://arduino.cc/"
@ -44,7 +44,7 @@ void loop()
{
int err =0;
Client c;
EthernetClient c;
HttpClient http(c);
err = http.get(kHostname, 80, kPath);
@ -77,8 +77,8 @@ void loop()
unsigned long timeoutStart = millis();
char c;
// Whilst we haven't timed out & haven't reached the end of the body
while (http.connected() &&
( (millis() - timeoutStart) < kNetworkTimeout ))
while ( (http.connected() || http.available()) &&
((millis() - timeoutStart) < kNetworkTimeout) )
{
if (http.available())
{