MCPcopy Create free account
hub / github.com/apache/httpd / construct_host_header

Function construct_host_header

server/vhost.c:1135–1166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1133}
1134
1135static APR_INLINE const char *construct_host_header(request_rec *r,
1136 int is_v6literal)
1137{
1138 struct iovec iov[5];
1139 apr_size_t nvec = 0;
1140 /*
1141 * We cannot use ap_get_server_name/port here, because we must
1142 * ignore UseCanonicalName/Port.
1143 */
1144 if (is_v6literal) {
1145 iov[nvec].iov_base = "[";
1146 iov[nvec].iov_len = 1;
1147 nvec++;
1148 }
1149 iov[nvec].iov_base = (void *)r->hostname;
1150 iov[nvec].iov_len = strlen(r->hostname);
1151 nvec++;
1152 if (is_v6literal) {
1153 iov[nvec].iov_base = "]";
1154 iov[nvec].iov_len = 1;
1155 nvec++;
1156 }
1157 if (r->parsed_uri.port_str) {
1158 iov[nvec].iov_base = ":";
1159 iov[nvec].iov_len = 1;
1160 nvec++;
1161 iov[nvec].iov_base = r->parsed_uri.port_str;
1162 iov[nvec].iov_len = strlen(r->parsed_uri.port_str);
1163 nvec++;
1164 }
1165 return apr_pstrcatv(r->pool, iov, nvec, NULL);
1166}
1167
1168AP_DECLARE(void) ap_update_vhost_from_headers(request_rec *r)
1169{

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected