mirror of
https://github.com/mattiasgustavsson/libs.git
synced 2026-11-30 16:48:22 +01:00
Merge pull request #36 from thp/http-remove-default-port
http.h: Do not add port 80 to Host header
This commit is contained in:
@@ -420,7 +420,8 @@ http_t* http_get( char const* url, void* memctx )
|
||||
internal->request_header_large = (char*) HTTP_MALLOC( memctx, request_header_len + 1 );
|
||||
request_header = internal->request_header_large;
|
||||
}
|
||||
sprintf( request_header, "GET %s HTTP/1.0\r\nHost: %s:%s\r\n\r\n", resource, address, port );
|
||||
int default_http_port = (strcmp(port, "80") == 0);
|
||||
sprintf( request_header, "GET %s HTTP/1.0\r\nHost: %s%s%s\r\n\r\n", resource, address, default_http_port ? "" : ":", default_http_port ? "" : port );
|
||||
|
||||
return &internal->http;
|
||||
}
|
||||
@@ -458,7 +459,8 @@ http_t* http_post( char const* url, void const* data, size_t size, void* memctx
|
||||
internal->request_header_large = (char*) HTTP_MALLOC( memctx, request_header_len + 1 );
|
||||
request_header = internal->request_header_large;
|
||||
}
|
||||
sprintf( request_header, "POST %s HTTP/1.0\r\nHost: %s:%s\r\nContent-Length: %d\r\n\r\n", resource, address, port,
|
||||
int default_http_port = (strcmp(port, "80") == 0);
|
||||
sprintf( request_header, "POST %s HTTP/1.0\r\nHost: %s%s%s\r\nContent-Length: %d\r\n\r\n", resource, address, default_http_port ? "" : ":", default_http_port ? "" : port,
|
||||
(int) size );
|
||||
|
||||
internal->request_data_size = size;
|
||||
|
||||
Reference in New Issue
Block a user