Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-http by
Diff: source/http_request_builder.h
- Revision:
- 21:fcd2bfd31a39
- Parent:
- 10:b017c7d2cf23
diff -r 0e63d6a93c02 -r fcd2bfd31a39 source/http_request_builder.h
--- a/source/http_request_builder.h Sat Nov 18 14:03:26 2017 +0100
+++ b/source/http_request_builder.h Thu Dec 14 16:19:22 2017 +0700
@@ -28,7 +28,19 @@
HttpRequestBuilder(http_method a_method, ParsedUrl* a_parsed_url)
: method(a_method), parsed_url(a_parsed_url)
{
- set_header("Host", string(parsed_url->host()));
+ string host(parsed_url->host());
+
+ char port_str[10];
+ sprintf(port_str, ":%d", parsed_url->port());
+
+ if (strcmp(parsed_url->schema(), "http") == 0 && parsed_url->port() != 80) {
+ host += string(port_str);
+ }
+ else if (strcmp(parsed_url->schema(), "https") == 0 && parsed_url->port() != 443) {
+ host += string(port_str);
+ }
+
+ set_header("Host", host);
}
/**
