dushkin
2011-07-24 09:15:12 UTC
Hi,
I have a task to simulate a web server which receieves http requests.
Now the http requests can arrive, as you surly know, in any kind of
combinations:
1. All request in one packet
2. A header in one packet and its content on the next one
3. And also multiple fragmets on the requests on multiple packets.
4. (Can they also come in packets including the end of one request
following the start of another one?)
Can you give me some pointers to a smart algorithm (or maybe existsing
class that you know) that can process those packets into a complete
HTTP request?
----------------------------------
For example:
Packet1: GET /services/org.openmobilealliance.pres-content/users
Packet2: /sip:***@attucinteg1.com/oma_status-icon/
rcs_status_icon HTTP/1.1\r\nAccept: */*\r\nContent-Type: application/
vnd.oma.pres-content+xml; charset="utf-8"
Cache-Control: no-cache
Packet3: Pragma: no-cache
User-Agent: Java/1.6.0
Host: 192.168.5.135:8080
Connection: keep-alive
----------------------------------
will give
GET /services/org.openmobilealliance.pres-content/users/
sip:***@attucinteg1.com/oma_status-icon/rcs_status_icon HTTP/
1.1
Accept: */*
Content-Type: application/vnd.oma.pres-content+xml; charset="utf-8"
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Java/1.6.0
Host: 192.168.5.135:8080
Connection: keep-alive
----------------------------------
Of course the packets can be more complicated (starting from the
middle of the packets, or containg some content (like XMLs - that can
be by itseld truncated into several packets)
Many thanks!
I have a task to simulate a web server which receieves http requests.
Now the http requests can arrive, as you surly know, in any kind of
combinations:
1. All request in one packet
2. A header in one packet and its content on the next one
3. And also multiple fragmets on the requests on multiple packets.
4. (Can they also come in packets including the end of one request
following the start of another one?)
Can you give me some pointers to a smart algorithm (or maybe existsing
class that you know) that can process those packets into a complete
HTTP request?
----------------------------------
For example:
Packet1: GET /services/org.openmobilealliance.pres-content/users
Packet2: /sip:***@attucinteg1.com/oma_status-icon/
rcs_status_icon HTTP/1.1\r\nAccept: */*\r\nContent-Type: application/
vnd.oma.pres-content+xml; charset="utf-8"
Cache-Control: no-cache
Packet3: Pragma: no-cache
User-Agent: Java/1.6.0
Host: 192.168.5.135:8080
Connection: keep-alive
----------------------------------
will give
GET /services/org.openmobilealliance.pres-content/users/
sip:***@attucinteg1.com/oma_status-icon/rcs_status_icon HTTP/
1.1
Accept: */*
Content-Type: application/vnd.oma.pres-content+xml; charset="utf-8"
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Java/1.6.0
Host: 192.168.5.135:8080
Connection: keep-alive
----------------------------------
Of course the packets can be more complicated (starting from the
middle of the packets, or containg some content (like XMLs - that can
be by itseld truncated into several packets)
Many thanks!