{"action":"opened","issue":{"url":"https://api.github.com/repos/esp8266/Arduino/issues/5102","repository_url":"https://api.github.com/repos/esp8266/Arduino","labels_url":"https://api.github.com/repos/esp8266/Arduino/issues/5102/labels{/name}","comments_url":"https://api.github.com/repos/esp8266/Arduino/issues/5102/comments","events_url":"https://api.github.com/repos/esp8266/Arduino/issues/5102/events","html_url":"https://github.com/esp8266/Arduino/issues/5102","id":356233811,"node_id":"MDU6SXNzdWUzNTYyMzM4MTE=","number":5102,"title":"ESP8266 doesn't use local DNS table, and almost always makes query.","user":{"login":"Deimos1994","id":31592485,"node_id":"MDQ6VXNlcjMxNTkyNDg1","avatar_url":"https://avatars0.githubusercontent.com/u/31592485?v=4","gravatar_id":"","url":"https://api.github.com/users/Deimos1994","html_url":"https://github.com/Deimos1994","followers_url":"https://api.github.com/users/Deimos1994/followers","following_url":"https://api.github.com/users/Deimos1994/following{/other_user}","gists_url":"https://api.github.com/users/Deimos1994/gists{/gist_id}","starred_url":"https://api.github.com/users/Deimos1994/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Deimos1994/subscriptions","organizations_url":"https://api.github.com/users/Deimos1994/orgs","repos_url":"https://api.github.com/users/Deimos1994/repos","events_url":"https://api.github.com/users/Deimos1994/events{/privacy}","received_events_url":"https://api.github.com/users/Deimos1994/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-01T21:28:28Z","updated_at":"2018-09-01T21:28:28Z","closed_at":null,"author_association":"NONE","body":"\r\n\r\n### Basic Infos\r\n\r\n- [X] This issue complies with the [issue POLICY doc](https://github.com/esp8266/Arduino/blob/master/POLICY.md).\r\n- [X] I have read the documentation at [readthedocs](https://arduino-esp8266.readthedocs.io/en/latest) and the issue is not addressed there.\r\n- [X] I have tested that the issue is present in current master branch (aka latest git).\r\n- [X] I have searched the issue tracker for a similar issue.\r\n- [X] If there is a stack dump, I have decoded it.\r\n- [X] I have filled out all fields below.\r\n\r\n#### Platform\r\n\r\n- Hardware:\t\t\t\tNodemcu v1.0\r\n- Core Version:\t\t\tV2.4.2\r\n- Development Env:\t\tArduino IDE\r\n- Operating System:\t\tWindows 7\r\n\r\n### Settings in IDE\r\n\r\n- Module:  \t\t\tNodemcu|\r\n- Flash Mode:\t\t\t[qio|dio|other]\r\n- Flash Size: \t\t[4MB/1MB]\r\n- lwip Variant:   v2 Higher Bandwidth\r\n- Reset Method:\t\t[ck|nodemcu]\r\n- Flash Frequency:\t       [40Mhz]\r\n- CPU Frequency:\t\t[80Mhz]\r\n- Upload Using:\t\t[SERIAL]\r\n- Upload Speed:   [115200]\r\n\r\n\r\n### Problem Description\r\n\r\nESP Always make DNS query \r\n\r\n\r\n### [MCVE](https://stackoverflow.com/help/mcve) Sketch\r\n\r\n```cpp\r\n\r\n#include <Arduino.h>\r\n#include <ESP8266WiFi.h>\r\n#include <ESP8266WiFiMulti.h>\r\n#include <ESP8266HTTPClient.h>\r\n\r\nESP8266WiFiMulti WiFiMulti;\r\n\r\nvoid setup() {\r\n\r\n  Serial.begin(19200);\r\n  Serial.println();\r\n  \r\n  delay(1000);\r\n  WiFi.mode(WIFI_STA);\r\n  \r\n   IPAddress ip(192, 168, 4, 213);\r\n   IPAddress gateway(192, 168, 4, 1);\r\n   IPAddress subnet(255, 255, 255, 0);\r\n   IPAddress dnsAdrr(8, 8, 8, 8);\r\n   WiFi.config(ip, gateway, subnet, dnsAdrr);\r\n   \r\n  WiFiMulti.addAP(\"MyNetwork\", \"MyPassword\");\r\n\r\n}\r\n\r\nvoid loop() {\r\n  // wait for WiFi connection\r\n  if ((WiFiMulti.run() == WL_CONNECTED)) {\r\n\r\n    HTTPClient http;\r\n    Serial.print(\"[HTTP] begin...\\n\");\r\n    http.begin(\"http://api.thingspeak.com/gvhgvjustrandomhv\"); //HTTP    \r\n    int httpCode = http.GET();\r\n    Serial.printf(\"[HTTP] GET... code: %d\\n\", httpCode);\r\n    http.end();\r\n  }\r\n\r\n  delay(60000);\r\n  \r\n}\r\n\r\n```\r\n\r\n### Debug Messages\r\n\r\nTraffic in Wireshark, filtered by IP and DNS/HTTP packets\r\n\r\n![11111](https://user-images.githubusercontent.com/31592485/44949788-73943480-ae41-11e8-91b3-fc5875b1e799.JPG)\r\n\r\n\r\nAs you can see it makes dns query every time, but it shouden't, right?\r\nIf I understood everything correctly ESP8266 should have a local dns table, that stores 3 addresses (when using lwip 2).\r\nOf course if I replace api.thingspeak.com with its IP address 34.226.44.238 then no more DNS queries.\r\nWhy doesn't it use local DNS table?\r\n\r\n**Serial**\r\nDebug level: HTTP_CLIENT\r\n\r\n```\r\nlwIP:2.0.3(STABLE-2_0_3_RELEASE/glue:arduino-2.4.1-13-g163bb82)/BearSSL:6d1cefc\r\n\r\nscandone\r\nstate: 0 -> 2 (b0)\r\nstate: 2 -> 3 (0)\r\nstate: 3 -> 5 (10)\r\nadd 0\r\naid 1\r\ncnt \r\n\r\nconnected with MyNetwork, channel 11\r\ndhcp client start...\r\nstate: 5 -> 0 (0)\r\nrm 0\r\nscandone\r\nscandone\r\nstate: 0 -> 2 (b0)\r\nstate: 2 -> 3 (0)\r\nstate: 3 -> 5 (10)\r\nadd 0\r\naid 1\r\ncnt \r\n\r\nconnected with W-Network, channel 11\r\nip:192.168.4.213,mask:255.255.255.0,gw:192.168.4.1\r\nip:192.168.4.213,mask:255.255.255.0,gw:192.168.4.1\r\n[HTTP] begin...\r\n[HTTP-Client][begin] url: http://api.thingspeak.com/gvhgvjustrandomhv\r\n[HTTP-Client][begin] host: api.thingspeak.com port: 80 url: /gvhgvjustrandomhv\r\n[HTTP-Client] connected to api.thingspeak.com:80\r\n[HTTP-Client] sending request header\r\n-----\r\nGET /gvhgvjustrandomhv HTTP/1.1\r\nHost: api.thingspeak.com\r\nUser-Agent: ESP8266HTTPClient\r\nConnection: close\r\nAccept-Encoding: identity;q=1,chunked;q=0.1,*;q=0\r\n\r\n-----\r\n[HTTP-Client][handleHeaderResponse] RX: 'HTTP/1.1 404 Not Found'\r\n[HTTP-Client][handleHeaderResponse] RX: 'Content-Type: text/html; charset=utf-8'\r\n[HTTP-Client][handleHeaderResponse] RX: 'Content-Length: 728'\r\n[HTTP-Client][handleHeaderResponse] RX: 'Connection: close'\r\n[HTTP-Client][handleHeaderResponse] RX: 'Status: 404 Not Found'\r\n[HTTP-Client][handleHeaderResponse] RX: 'X-Request-Id: 0b80b791-a4a6-47c4-8ec1-2a960dcd8a6d'\r\n[HTTP-Client][handleHeaderResponse] RX: 'X-Runtime: 0.003208'\r\n[HTTP-Client][handleHeaderResponse] RX: 'X-Powered-By: Phusion Passenger 4.0.57'\r\n[HTTP-Client][handleHeaderResponse] RX: 'Date: Sat, 01 Sep 2018 21:24:11 GMT'\r\n[HTTP-Client][handleHeaderResponse] RX: 'Server: nginx/1.9.3 + Phusion Passenger 4.0.57'\r\n[HTTP-Client][handleHeaderResponse] RX: ''\r\n[HTTP-Client][handleHeaderResponse] code: 404\r\n[HTTP-Client][handleHeaderResponse] size: 728\r\n[HTTP] GET... code: 404\r\n[HTTP-Client][end] still data in buffer (728), clean up.\r\n[HTTP-Client][end] tcp stop\r\npm open,type:2 0\r\n[HTTP] begin...\r\n[HTTP-Client][begin] url: http://api.thingspeak.com/gvhgvjustrandomhv\r\n[HTTP-Client][begin] host: api.thingspeak.com port: 80 url: /gvhgvjustrandomhv\r\n[HTTP-Client] connected to api.thingspeak.com:80\r\n[HTTP-Client] sending request header\r\n-----\r\nGET /gvhgvjustrandomhv HTTP/1.1\r\nHost: api.thingspeak.com\r\nUser-Agent: ESP8266HTTPClient\r\nConnection: close\r\nAccept-Encoding: identity;q=1,chunked;q=0.1,*;q=0\r\n\r\n-----\r\n[HTTP-Client][handleHeaderResponse] RX: 'HTTP/1.1 404 Not Found'\r\n[HTTP-Client][handleHeaderResponse] RX: 'Content-Type: text/html; charset=utf-8'\r\n[HTTP-Client][handleHeaderResponse] RX: 'Content-Length: 728'\r\n[HTTP-Client][handleHeaderResponse] RX: 'Connection: close'\r\n[HTTP-Client][handleHeaderResponse] RX: 'Status: 404 Not Found'\r\n[HTTP-Client][handleHeaderResponse] RX: 'X-Request-Id: 4f64ec15-68f8-4dff-a8fe-db10ef64ca66'\r\n[HTTP-Client][handleHeaderResponse] RX: 'X-Runtime: 0.004759'\r\n[HTTP-Client][handleHeaderResponse] RX: 'X-Powered-By: Phusion Passenger 4.0.57'\r\n[HTTP-Client][handleHeaderResponse] RX: 'Date: Sat, 01 Sep 2018 21:25:12 GMT'\r\n[HTTP-Client][handleHeaderResponse] RX: 'Server: nginx/1.9.3 + Phusion Passenger 4.0.57'\r\n[HTTP-Client][handleHeaderResponse] RX: ''\r\n[HTTP-Client][handleHeaderResponse] code: 404\r\n[HTTP-Client][handleHeaderResponse] size: 728\r\n[HTTP] GET... code: 404\r\n[HTTP-Client][end] tcp stop\r\n[HTTP] begin...\r\n[HTTP-Client][begin] url: http://api.thingspeak.com/gvhgvjustrandomhv\r\n[HTTP-Client][begin] host: api.thingspeak.com port: 80 url: /gvhgvjustrandomhv\r\n[HTTP-Client] connected to api.thingspeak.com:80\r\n[HTTP-Client] sending request header\r\n-----\r\nGET /gvhgvjustrandomhv HTTP/1.1\r\nHost: api.thingspeak.com\r\nUser-Agent: ESP8266HTTPClient\r\nConnection: close\r\nAccept-Encoding: identity;q=1,chunked;q=0.1,*;q=0\r\n\r\n-----\r\n[HTTP-Client][handleHeaderResponse] RX: 'HTTP/1.1 404 Not Found'\r\n[HTTP-Client][handleHeaderResponse] RX: 'Content-Type: text/html; charset=utf-8'\r\n[HTTP-Client][handleHeaderResponse] RX: 'Content-Length: 728'\r\n[HTTP-Client][handleHeaderResponse] RX: 'Connection: close'\r\n[HTTP-Client][handleHeaderResponse] RX: 'Status: 404 Not Found'\r\n[HTTP-Client][handleHeaderResponse] RX: 'X-Request-Id: 44ec1930-6ef0-4623-9a25-753917819ca4'\r\n[HTTP-Client][handleHeaderResponse] RX: 'X-Runtime: 0.004188'\r\n[HTTP-Client][handleHeaderResponse] RX: 'X-Powered-By: Phusion Passenger 4.0.57'\r\n[HTTP-Client][handleHeaderResponse] RX: 'Date: Sat, 01 Sep 2018 21:26:13 GMT'\r\n[HTTP-Client][handleHeaderResponse] RX: 'Server: nginx/1.9.3 + Phusion Passenger 4.0.57'\r\n[HTTP-Client][handleHeaderResponse] RX: ''\r\n[HTTP-Client][handleHeaderResponse] code: 404\r\n[HTTP-Client][handleHeaderResponse] size: 728\r\n[HTTP] GET... code: 404\r\n[HTTP-Client][end] still data in buffer (728), clean up.\r\n[HTTP-Client][end] tcp stop\r\n\r\n```\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"Deimos1994"}}