Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP packet fragmentation support #1212

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Packet++/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ add_library(
src/GreLayer.cpp
src/GtpLayer.cpp
src/HttpLayer.cpp
src/HttpReassembly.cpp
src/IcmpLayer.cpp
src/IcmpV6Layer.cpp
src/IgmpLayer.cpp
Expand Down Expand Up @@ -79,6 +80,7 @@ set(public_headers
header/GreLayer.h
header/GtpLayer.h
header/HttpLayer.h
header/HttpReassembly.h
header/IcmpLayer.h
header/IcmpV6Layer.h
header/IgmpLayer.h
Expand Down
18 changes: 18 additions & 0 deletions Packet++/header/HttpReassembly.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef PACKETPP_HTTP_REASSEMBLY
#define PACKETPP_HTTP_REASSEMBLY

/**
* @file
* This file includes an implementation of HTTP/1.x reassembly mechanism.
*/

/**
* @namespace pcpp
* @brief The main namespace for the PcapPlusPlus lib
*/
namespace pcpp
{

}

#endif /* PACKETPP_HTTP_REASSEMBLY */
6 changes: 6 additions & 0 deletions Packet++/src/HttpReassembly.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "HttpReassembly.h"

namespace pcpp
{

}
Empty file.
Empty file.
jpcofr marked this conversation as resolved.
Show resolved Hide resolved
Empty file.
32 changes: 32 additions & 0 deletions Tests/Packet++Test/Tests/HttpTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,3 +506,35 @@ PTF_TEST_CASE(HttpMalformedResponseTest)
index++;
}
} // HttpMalformedResponseTest



/// Tests HTTP packet reassembly
PTF_TEST_CASE(HttpReassemblyTest)
{
timeval time;
gettimeofday(&time, nullptr);

READ_FILE_AND_CREATE_PACKET(1, "PacketExamples/Http1xFrag1.dat");
READ_FILE_AND_CREATE_PACKET(2, "PacketExamples/Http1xFrag2.dat");
READ_FILE_AND_CREATE_PACKET(3, "PacketExamples/Http1xFrag3.dat");

pcpp::Packet frag1(&rawPacket1);
pcpp::Packet frag2(&rawPacket2);
pcpp::Packet frag3(&rawPacket3);

PTF_ASSERT_TRUE(frag1.isPacketOfType(pcpp::HTTPResponse));
pcpp::HttpResponseLayer* responseLayer1 = frag1.getLayerOfType<pcpp::HttpResponseLayer>();
PTF_ASSERT_NOT_NULL(responseLayer1);
responseLayer1->isHeaderComplete();

PTF_ASSERT_TRUE(frag2.isPacketOfType(pcpp::HTTPResponse));
pcpp::HttpResponseLayer* responseLayer2 = frag2.getLayerOfType<pcpp::HttpResponseLayer>();
PTF_ASSERT_NOT_NULL(responseLayer2);

PTF_ASSERT_TRUE(frag3.isPacketOfType(pcpp::HTTPResponse));
pcpp::HttpResponseLayer* responseLayer3 = frag3.getLayerOfType<pcpp::HttpResponseLayer>();
PTF_ASSERT_NOT_NULL(responseLayer3);

PTF_ASSERT_TRUE(true);
} // HttpReassemblyTest