- lpsztmp = heap_realloc(lphttpHdr->lpszValue, (len+1)*sizeof(WCHAR));
- if (lpsztmp)
- {
- lphttpHdr->lpszValue = lpsztmp;
- /* FIXME: Increment lphttpHdr->wCount. Perhaps lpszValue should be an array */
- if (ch > 0)
- {
- lphttpHdr->lpszValue[origlen] = ch;
- origlen++;
- lphttpHdr->lpszValue[origlen] = ' ';
- origlen++;
- }
-
- memcpy(&lphttpHdr->lpszValue[origlen], value, valuelen*sizeof(WCHAR));
- lphttpHdr->lpszValue[len] = '\0';
- }
- else
- {
- WARN("heap_realloc (%d bytes) failed\n",len+1);
- res = ERROR_OUTOFMEMORY;
- }
-
- goto out;
+ res = HTTP_InsertCustomHeader(request, &hdr);
+ LeaveCriticalSection( &request->headers_section );
+ return res;