{"action":"created","comment":{"url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/pulls/comments/57119413","id":57119413,"diff_hunk":"@@ -292,33 +284,50 @@ static void ICACHE_FLASH_ATTR http_connect_callback( void * arg )\n \n \tif ( req->post_data != NULL ) /* If there is data then add Content-Length header. */\n \t{\n-\t\tos_sprintf( post_headers, \"Content-Length: %d\\r\\n\", strlen( req->post_data ) );\n+\t\tos_sprintf( post_headers, \"Content-Length:%d\\r\\n\", strlen( req->post_data ) );\n \t}\n \n-\tif(req->headers == NULL) /* Avoid NULL pointer, it may cause exception */\n+\tif (req->headers == NULL) /* Avoid NULL pointer, it may cause exception */\n \t{\n \t\treq->headers = (char *)os_malloc(sizeof(char));\n \t\treq->headers[0] = '\\0';\n \t}\n \n+\tchar ua_header[32] = \"\";\n+\tint ua_len = 0;\n+\t\n+\tif ( os_strstr( req->headers, \"User-Agent:\" ) == NULL )","path":"app/http/httpclient.c","position":73,"original_position":73,"commit_id":"f1cb14b054185d5162f8c453f0d2f2400afdfa66","original_commit_id":"f1cb14b054185d5162f8c453f0d2f2400afdfa66","user":{"login":"marcelstoer","id":624195,"avatar_url":"https://avatars.githubusercontent.com/u/624195?v=3","gravatar_id":"","url":"https://api.github.com/users/marcelstoer","html_url":"https://github.com/marcelstoer","followers_url":"https://api.github.com/users/marcelstoer/followers","following_url":"https://api.github.com/users/marcelstoer/following{/other_user}","gists_url":"https://api.github.com/users/marcelstoer/gists{/gist_id}","starred_url":"https://api.github.com/users/marcelstoer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcelstoer/subscriptions","organizations_url":"https://api.github.com/users/marcelstoer/orgs","repos_url":"https://api.github.com/users/marcelstoer/repos","events_url":"https://api.github.com/users/marcelstoer/events{/privacy}","received_events_url":"https://api.github.com/users/marcelstoer/received_events","type":"User","site_admin":false},"body":"There's no function to convert `req->headers` to lower case at once i.e. you'd have to go through it char-by-char? Wouldn't it be enough to check for  \"User-Agent:\" and \"user-agent:\" only? I've never encountered all-caps headers in my life.","created_at":"2016-03-23T07:40:23Z","updated_at":"2016-03-23T07:40:23Z","html_url":"https://github.com/nodemcu/nodemcu-firmware/pull/1157#discussion_r57119413","pull_request_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/pulls/1157","_links":{"self":{"href":"https://api.github.com/repos/nodemcu/nodemcu-firmware/pulls/comments/57119413"},"html":{"href":"https://github.com/nodemcu/nodemcu-firmware/pull/1157#discussion_r57119413"},"pull_request":{"href":"https://api.github.com/repos/nodemcu/nodemcu-firmware/pulls/1157"}}},"pull_request":{"url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/pulls/1157","id":62697153,"html_url":"https://github.com/nodemcu/nodemcu-firmware/pull/1157","diff_url":"https://github.com/nodemcu/nodemcu-firmware/pull/1157.diff","patch_url":"https://github.com/nodemcu/nodemcu-firmware/pull/1157.patch","issue_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/1157","number":1157,"state":"open","locked":false,"title":"Fixed http module binary download issue, refactored, added HEAD support","user":{"login":"jfollas","id":1516231,"avatar_url":"https://avatars.githubusercontent.com/u/1516231?v=3","gravatar_id":"","url":"https://api.github.com/users/jfollas","html_url":"https://github.com/jfollas","followers_url":"https://api.github.com/users/jfollas/followers","following_url":"https://api.github.com/users/jfollas/following{/other_user}","gists_url":"https://api.github.com/users/jfollas/gists{/gist_id}","starred_url":"https://api.github.com/users/jfollas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfollas/subscriptions","organizations_url":"https://api.github.com/users/jfollas/orgs","repos_url":"https://api.github.com/users/jfollas/repos","events_url":"https://api.github.com/users/jfollas/events{/privacy}","received_events_url":"https://api.github.com/users/jfollas/received_events","type":"User","site_admin":false},"body":"- Issue #1152 (http module did not properly handle binary payload)\r\n- Consolidated duplicate code in http module to make smaller\r\n- Removed the functions-per-method in `httpclient.c` since http module just needs the \"request\" method \r\n- Added support for HTTP HEAD method\r\n- Added HTTP response headers to the callback function as third argument\r\n- Changed `User-Agent` header to only use default of \"ESP8266\" if user didn't provide in headers argument","created_at":"2016-03-14T03:39:48Z","updated_at":"2016-03-23T07:40:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8c13d61cb96eaee69c1d04fc83dcd8500e9cb072","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/pulls/1157/commits","review_comments_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/pulls/1157/comments","review_comment_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/1157/comments","statuses_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/statuses/f1cb14b054185d5162f8c453f0d2f2400afdfa66","head":{"label":"jfollas:httpfix","ref":"httpfix","sha":"f1cb14b054185d5162f8c453f0d2f2400afdfa66","user":{"login":"jfollas","id":1516231,"avatar_url":"https://avatars.githubusercontent.com/u/1516231?v=3","gravatar_id":"","url":"https://api.github.com/users/jfollas","html_url":"https://github.com/jfollas","followers_url":"https://api.github.com/users/jfollas/followers","following_url":"https://api.github.com/users/jfollas/following{/other_user}","gists_url":"https://api.github.com/users/jfollas/gists{/gist_id}","starred_url":"https://api.github.com/users/jfollas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfollas/subscriptions","organizations_url":"https://api.github.com/users/jfollas/orgs","repos_url":"https://api.github.com/users/jfollas/repos","events_url":"https://api.github.com/users/jfollas/events{/privacy}","received_events_url":"https://api.github.com/users/jfollas/received_events","type":"User","site_admin":false},"repo":{"id":51668187,"name":"nodemcu-firmware","full_name":"jfollas/nodemcu-firmware","owner":{"login":"jfollas","id":1516231,"avatar_url":"https://avatars.githubusercontent.com/u/1516231?v=3","gravatar_id":"","url":"https://api.github.com/users/jfollas","html_url":"https://github.com/jfollas","followers_url":"https://api.github.com/users/jfollas/followers","following_url":"https://api.github.com/users/jfollas/following{/other_user}","gists_url":"https://api.github.com/users/jfollas/gists{/gist_id}","starred_url":"https://api.github.com/users/jfollas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfollas/subscriptions","organizations_url":"https://api.github.com/users/jfollas/orgs","repos_url":"https://api.github.com/users/jfollas/repos","events_url":"https://api.github.com/users/jfollas/events{/privacy}","received_events_url":"https://api.github.com/users/jfollas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jfollas/nodemcu-firmware","description":"lua based interactive firmware for mcu like esp8266","fork":true,"url":"https://api.github.com/repos/jfollas/nodemcu-firmware","forks_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/forks","keys_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/teams","hooks_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/hooks","issue_events_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/issues/events{/number}","events_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/events","assignees_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/assignees{/user}","branches_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/branches{/branch}","tags_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/tags","blobs_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/git/refs{/sha}","trees_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/statuses/{sha}","languages_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/languages","stargazers_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/stargazers","contributors_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/contributors","subscribers_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/subscribers","subscription_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/subscription","commits_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/commits{/sha}","git_commits_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/git/commits{/sha}","comments_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/comments{/number}","issue_comment_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/issues/comments{/number}","contents_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/contents/{+path}","compare_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/merges","archive_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/downloads","issues_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/issues{/number}","pulls_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/pulls{/number}","milestones_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/milestones{/number}","notifications_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/labels{/name}","releases_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/releases{/id}","deployments_url":"https://api.github.com/repos/jfollas/nodemcu-firmware/deployments","created_at":"2016-02-13T22:10:57Z","updated_at":"2016-02-13T22:11:00Z","pushed_at":"2016-03-18T00:22:22Z","git_url":"git://github.com/jfollas/nodemcu-firmware.git","ssh_url":"git@github.com:jfollas/nodemcu-firmware.git","clone_url":"https://github.com/jfollas/nodemcu-firmware.git","svn_url":"https://github.com/jfollas/nodemcu-firmware","homepage":"http://nodemcu.com","size":87638,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nodemcu:dev","ref":"dev","sha":"13f519ee413b1f7f7a535a5cc3df093eee04f786","user":{"login":"nodemcu","id":9865736,"avatar_url":"https://avatars.githubusercontent.com/u/9865736?v=3","gravatar_id":"","url":"https://api.github.com/users/nodemcu","html_url":"https://github.com/nodemcu","followers_url":"https://api.github.com/users/nodemcu/followers","following_url":"https://api.github.com/users/nodemcu/following{/other_user}","gists_url":"https://api.github.com/users/nodemcu/gists{/gist_id}","starred_url":"https://api.github.com/users/nodemcu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodemcu/subscriptions","organizations_url":"https://api.github.com/users/nodemcu/orgs","repos_url":"https://api.github.com/users/nodemcu/repos","events_url":"https://api.github.com/users/nodemcu/events{/privacy}","received_events_url":"https://api.github.com/users/nodemcu/received_events","type":"User","site_admin":false},"repo":{"id":26917568,"name":"nodemcu-firmware","full_name":"nodemcu/nodemcu-firmware","owner":{"login":"nodemcu","id":9865736,"avatar_url":"https://avatars.githubusercontent.com/u/9865736?v=3","gravatar_id":"","url":"https://api.github.com/users/nodemcu","html_url":"https://github.com/nodemcu","followers_url":"https://api.github.com/users/nodemcu/followers","following_url":"https://api.github.com/users/nodemcu/following{/other_user}","gists_url":"https://api.github.com/users/nodemcu/gists{/gist_id}","starred_url":"https://api.github.com/users/nodemcu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodemcu/subscriptions","organizations_url":"https://api.github.com/users/nodemcu/orgs","repos_url":"https://api.github.com/users/nodemcu/repos","events_url":"https://api.github.com/users/nodemcu/events{/privacy}","received_events_url":"https://api.github.com/users/nodemcu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nodemcu/nodemcu-firmware","description":"lua based interactive firmware for mcu like esp8266","fork":false,"url":"https://api.github.com/repos/nodemcu/nodemcu-firmware","forks_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/forks","keys_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/teams","hooks_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/hooks","issue_events_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/events{/number}","events_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/events","assignees_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/assignees{/user}","branches_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/branches{/branch}","tags_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/tags","blobs_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/git/refs{/sha}","trees_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/statuses/{sha}","languages_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/languages","stargazers_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/stargazers","contributors_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/contributors","subscribers_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/subscribers","subscription_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/subscription","commits_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/commits{/sha}","git_commits_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/git/commits{/sha}","comments_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/comments{/number}","issue_comment_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/comments{/number}","contents_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/contents/{+path}","compare_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/merges","archive_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/downloads","issues_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues{/number}","pulls_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/pulls{/number}","milestones_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/milestones{/number}","notifications_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/labels{/name}","releases_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/releases{/id}","deployments_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/deployments","created_at":"2014-11-20T15:06:45Z","updated_at":"2016-03-23T04:17:59Z","pushed_at":"2016-03-23T00:40:49Z","git_url":"git://github.com/nodemcu/nodemcu-firmware.git","ssh_url":"git@github.com:nodemcu/nodemcu-firmware.git","clone_url":"https://github.com/nodemcu/nodemcu-firmware.git","svn_url":"https://github.com/nodemcu/nodemcu-firmware","homepage":"http://nodemcu.com","size":104161,"stargazers_count":2026,"watchers_count":2026,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":914,"mirror_url":null,"open_issues_count":119,"forks":914,"open_issues":119,"watchers":2026,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodemcu/nodemcu-firmware/pulls/1157"},"html":{"href":"https://github.com/nodemcu/nodemcu-firmware/pull/1157"},"issue":{"href":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/1157"},"comments":{"href":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/1157/comments"},"review_comments":{"href":"https://api.github.com/repos/nodemcu/nodemcu-firmware/pulls/1157/comments"},"review_comment":{"href":"https://api.github.com/repos/nodemcu/nodemcu-firmware/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodemcu/nodemcu-firmware/pulls/1157/commits"},"statuses":{"href":"https://api.github.com/repos/nodemcu/nodemcu-firmware/statuses/f1cb14b054185d5162f8c453f0d2f2400afdfa66"}}}}