nsresult nsHttpResponseHead::Parse(char *block) { LOG(("nsHttpResponseHead::Parse [this=%p]\n", this)); // this command works on a buffer as prepared by Flatten, as such it is // not very forgiving ;-) char *p = PL_strstr(block, "\r\n"); if (!p) return NS_ERROR_UNEXPECTED; *p = 0; ParseStatusLine(block); do { block = p + 2; if (*block == 0) break; p = PL_strstr(block, "\r\n"); if (!p) return NS_ERROR_UNEXPECTED; *p = 0; ParseHeaderLine(block); } while (1); return NS_OK; }
void nsHttpHeaderArray::ParseHeaderSet(char *buffer) { nsHttpAtom hdr; char *val; while (buffer) { char *eof = strchr(buffer, '\r'); if (!eof) { break; } *eof = '\0'; ParseHeaderLine(buffer, &hdr, &val); buffer = eof + 1; if (*buffer == '\n') { buffer++; } } }