MCPcopy Create free account
hub / github.com/HumbleNet/HumbleNet / ILibAddHeaderLine

Function ILibAddHeaderLine

3rdparty/webrtc/Microstack/ILibParsers.c:4500–4536  ·  view source on GitHub ↗

! \fn ILibAddHeaderLine(struct packetheader *packet, char* FieldName, int FieldNameLength, char* FieldData, int FieldDataLength) \brief Adds an HTTP header entry into a packetheader structure \param packet The packet to modify \param FieldName The header name, eg: \b CONTENT-TYPE \param FieldNameLength The length of the \a FieldName \param FieldData The header value, eg: \b text/xml \param FieldDa

Source from the content-addressed store, hash-verified

4498\param FieldDataLength The length of the \a FieldData
4499*/
4500void ILibAddHeaderLine(struct packetheader *packet, const char* FieldName, int FieldNameLength, const char* FieldData, int FieldDataLength)
4501{
4502 struct packetheader_field_node *node;
4503
4504 //
4505 // Create the Header Node
4506 //
4507 if ((node = (struct packetheader_field_node*)malloc(sizeof(struct packetheader_field_node))) == NULL) ILIBCRITICALEXIT(254);
4508 node->UserAllocStrings = -1;
4509 if ((node->Field = (char*)malloc(FieldNameLength+1)) == NULL) ILIBCRITICALEXIT(254);
4510 memcpy(node->Field, FieldName, FieldNameLength);
4511 node->Field[FieldNameLength] = '\0';
4512 node->FieldLength = FieldNameLength;
4513
4514 if ((node->FieldData = (char*)malloc(FieldDataLength+1)) == NULL) ILIBCRITICALEXIT(254);
4515 memcpy(node->FieldData,FieldData,FieldDataLength);
4516 node->FieldData[FieldDataLength] = '\0';
4517 node->FieldDataLength = FieldDataLength;
4518
4519 node->NextField = NULL;
4520
4521 ILibAddEntryEx(packet->HeaderTable,node->Field,node->FieldLength,node->FieldData,node->FieldDataLength);
4522
4523 //
4524 // And attach it to the linked list
4525 //
4526 if (packet->LastField!=NULL)
4527 {
4528 packet->LastField->NextField = node;
4529 packet->LastField = node;
4530 }
4531 else
4532 {
4533 packet->LastField = node;
4534 packet->FirstField = node;
4535 }
4536}
4537
4538char* ILibUrl_GetHost(char *url, int urlLen)
4539{

Callers 3

ILibClonePacketFunction · 0.85

Calls 2

mallocFunction · 0.85
ILibAddEntryExFunction · 0.85

Tested by

no test coverage detected