networking · beginner · ~15 min
Recognise the default TLS/HTTPS port.
HTTPS is HTTP over TLS, served on port 443 by default. Recognise that port.
Implement int is_https_port(int port) that returns 1 if port is 443, otherwise 0.
One int port.
Returns 1 if port == 443, else 0.
is_https_port(443) -> 1
is_https_port(80) -> 0
One integer port.
1 if port is 443, else 0.
The default HTTPS port is 443.
int is_https_port(int port) {
/* TODO */
return 0;
}
Assuming HTTP request header fits in a single recv() buffer; not parsing \r\n line endings properly; failing to send valid HTTP response status.
HTTP requests with headers split across packets; malformed headers lacking colon; empty lines; requests without Content-Length.
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.