Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use WEB_PORT define instead of hardcoded "80" string #358

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/http_get/http_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "ssid_config.h"

#define WEB_SERVER "chainxor.org"
#define WEB_PORT 80
#define WEB_PORT "80"
#define WEB_URL "http://chainxor.org/"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A Host header may be needed too and the port included in that. e.g. "Host: chainxor.org:8000" Might be nice to avoid the host name duplication too. So perhaps keep the port as a number and use snprintf to build up the headers.


void http_get_task(void *pvParameters)
Expand All @@ -37,7 +37,7 @@ void http_get_task(void *pvParameters)
struct addrinfo *res;

printf("Running DNS lookup for %s...\r\n", WEB_SERVER);
int err = getaddrinfo(WEB_SERVER, "80", &hints, &res);
int err = getaddrinfo(WEB_SERVER, WEB_PORT, &hints, &res);

if(err != 0 || res == NULL) {
printf("DNS lookup failed err=%d res=%p\r\n", err, res);
Expand Down