I am trying to write a script that does http pipelining with scapy. When I call my send function to send my two http requests back to back, the requests are not pipelined. The Second http request is sent after the first http response is received.
Snippet of what I have:
#Send SYN
syn = IP(src="31.31.31.10",dst='31.31.31.17') / TCP(dport=80,sport=RandShort(),flags='S')
syn_ack = sr1(syn)
#Send ACK
ack = (IP(src="31.31.31.10",dst="31.31.31.17")/TCP(dport=80, sport=syn_ack[TCP].dport,seq=syn_ack[TCP].ack, ack=syn_ack[TCP].seq + 1, flags='A'))
send(ack)
#Set the HTTP data
http1 = 'GET /a.html HTTP/1.1\r\nUser-Agent: curl/7.19.4\r\nHost: www.google.com\r\nAccept: */*\r\n\r\n'
http2 = 'GET /b.html HTTP/1.1\r\nUser-Agent: curl/7.19.4\r\nHost: www.google.com\r\nAccept: */*\r\n\r\n'
#Send First GET
get1 = (IP(src="31.31.31.10",dst="31.31.31.17")/TCP(dport=80, sport=syn_ack[TCP].dport,seq=syn_ack[TCP].ack, ack=syn_ack[TCP].seq + 1, flags='PA')/http1)
send (get1)
get1_payload = len(http1)
#Send the Second GET
get2 = (IP(src="31.31.31.10",dst="31.31.31.17")/TCP(dport=80, sport=syn_ack[TCP].dport,seq=syn_ack[TCP].ack + get1_payload, ack=syn_ack[TCP].seq + 1,flags='PA')/http1)
send (get2)
Is scapy just sending the second request too slow or am I not doing something correctly?