bin/varnishd/cache/cache_http.c
void
http_CopyHome(const struct http *hp)
{
	unsigned u, l;
	const char *p;

	for (u = 0; u < hp->nhd; u++) {
		if (hp->hd[u].b == NULL) {
			assert(u < HTTP_HDR_FIRST);
			continue;
		}

		l = Tlen(hp->hd[u]);
		if (WS_Allocated(hp->ws, hp->hd[u].b, l))
			continue;

		p = WS_Copy(hp->ws, hp->hd[u].b, l + 1L);
		if (p == NULL) {
			http_fail(hp);
			VSLb(hp->vsl, SLT_LostHeader, "%s", hp->hd[u].b);
			return;
		}
		hp->hd[u].b = p;
		hp->hd[u].e = p + l;
	}
}
/*--------------------------------------------------------------------
 * This function copies any header fields which reference foreign
 * storage into our own WS.
 */
This function copies any header fields which reference foreign
storage into our own WS.
This function copies any header fields which reference foreign storage into our own WS .
void
http_CopyHome(const struct http *hp)
{
	unsigned u, l;
	const char *p;
	for (u = 0; u < hp->nhd; u++) {
		if (hp->hd[u].b == NULL) {
			assert(u < HTTP_HDR_FIRST);
			continue;
		}
		l = Tlen(hp->hd[u]);
		if (WS_Allocated(hp->ws, hp->hd[u].b, l))
			continue;
		p = WS_Copy(hp->ws, hp->hd[u].b, l + 1L);
		if (p == NULL) {
			http_fail(hp);
			VSLb(hp->vsl, SLT_LostHeader, "%s", hp->hd[u].b);
			return;
		}
		hp->hd[u].b = p;
		hp->hd[u].e = p + l;
	}
}
void http_CopyHome ( const struct http * hp ) { unsigned u , l ; const char * p ; for ( u = 0 ; u < hp -> nhd ; u ++ ) { if ( hp -> hd [ u ] . b == NULL ) { assert ( u < HTTP_HDR_FIRST ) ; continue ; } l = Tlen ( hp -> hd [ u ] ) ; if ( WS_Allocated ( hp -> ws , hp -> hd [ u ] . b , l ) ) continue ; p = WS_Copy ( hp -> ws , hp -> hd [ u ] . b , l + 1L ) ; if ( p == NULL ) { http_fail ( hp ) ; VSLb ( hp -> vsl , SLT_LostHeader , " " , hp -> hd [ u ] . b ) ; return ; } hp -> hd [ u ] . b = p ; hp -> hd [ u ] . e = p + l ; } }
This function copies any header fields which reference foreign
 storage into our own WS.
This function copies any header fields which reference foreign storage into our own WS .