in src/generic/formdata.c [501:547]
void mimeReadHeader(Tcl_Channel channel, Tcl_Obj * hdr)
{
Tcl_Obj *tclo = NULL;
int first = 0;
char *cline = NULL;
int len = 0;
if ((channel == NULL) || (hdr == NULL))
return;
/* printf("DBG mimeReadHeader - starting\n"); fflush(stdout); */
tclo = Tcl_NewObj();
first = TCL_OK;
Tcl_IncrRefCount(tclo);
while (Tcl_GetsObj(channel, tclo) != -1) {
cline = Tcl_GetStringFromObj(tclo, &len);
if (strcmp(cline, "\r") == 0)
break;
/* cut CR from line */
if (len > 0)
if (cline[len - 1] == '\r')
Tcl_SetObjLength(tclo, len - 1);
if (first == TCL_ERROR)
Tcl_AppendToObj(hdr, "\n", 1);
else
first = TCL_ERROR;
Tcl_AppendObjToObj(hdr, tclo);
Tcl_DecrRefCount(tclo);
tclo = Tcl_NewObj();
Tcl_IncrRefCount(tclo);
}
Tcl_DecrRefCount(tclo);
/* printf("DBG mimeReadHeader - hdr: %s\n",Tcl_GetString(hdr)); fflush(stdout); */
}