Closed
Description
Basic Infos
- This issue complies with the issue POLICY doc.
- I have read the documentation at readthedocs and the issue is not addressed there.
- I have tested that the issue is present in current master branch (aka latest git).
- I have searched the issue tracker for a similar issue.
- I have filled out all fields below.
Platform
- Hardware: [other]
- Core Version: [latest git hash or date]
- Development Env: [Arduino IDE]
- Operating System: [MacOS]
Settings in IDE
- Module: [Generic ESP8266 Module]
- Flash Mode: [dior]
- Flash Size: [4MB]
- lwip Variant: [v2 Lower Memory]
- CPU Frequency: [80Mhz]
- Upload Using: [SERIAL]
- Upload Speed: [115200] (serial upload only)
Problem Description
When I try and call against the DD-WRT router firmware with an http authorization username/password it will give me a -2 "send header failed" every other call. This does not happen when it is called from other devices. It also is not related to the time between calls, as it is always every other be it once per second or once per half second.
MCVE Sketch
#include <Arduino.h>
v/* All the imports and setup for the wifi */
#include <Arduino.h>
#include <ESP8266WiFi.h>
// Imports
#include <ESP8266WiFiMulti.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClient.h>
ESP8266WiFiMulti WiFiMulti;
WiFiClient client;
HTTPClient http;
// Settings
const int time_between_updates = 500; // time between bandwidth checks in ms
// Variables we will be using
char last_router_return = 'Wait for it...';
int last_update = -1001;
void setup() {
// Start the serial at 115200 baurd
Serial.begin(115200);
// Connect to the wifi
WiFi.mode(WIFI_STA);
WiFiMulti.addAP("SSID", "PASSWORD");
}
void loop() {
int now = millis();
if(now>=last_update+time_between_updates){
last_update = now;
get_bandwidth_usage();
}else{
Serial.print(millis());
Serial.print(" ");
Serial.println(last_update+time_between_updates);
delay(100);
}
}
// Timer will call this every second (because internets are sold in mb/s)
bool get_bandwidth_usage(){
if ((WiFiMulti.run() == WL_CONNECTED)) {
http.begin(client, "http://ROUTER_USERNAME:ROUTER_PASSWORD@192.168.1.1/fetchif.cgi?br0");
// We're connected so make that call!
int httpCode = http.GET();
Serial.println(httpCode);
// If it's a positive number (because it didn't error arduino side) and it's 200 (because that means the server succeeded).
if (httpCode > 0) {
if (httpCode == HTTP_CODE_OK){
// The stuff I want to do will go here.
}
}else{
Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
}
}else{
Serial.println("Looks like we're not connected to the WiFi yet. Lets try that next pass.");
}
}```
### Debug Messages
-2
[HTTP] GET... failed, error: send header failed
Metadata
Metadata
Assignees
Labels
No labels