Parsing raw HTTP Request

前端 未结 3 1597
逝去的感伤
逝去的感伤 2020-12-09 12:58

I working on HTTP Traffic Data set which is composed of complete POST and GET request Like given below. I have written code in java that has separated each of these request

3条回答
  •  Happy的楠姐
    2020-12-09 13:36

    I [am] working on [an] HTTP Traffic Data set which is composed of complete POST and GET request[s]

    So you want to parse a file or list that contains multiple HTTP requests. What data do you want to extract? Anyway here is a Java HTTP parsing class, which can read the method, version and URI used in the request-line, and that reads all headers into a Hashtable.

    You can use that one or write one yourself if you feel like reinventing the wheel. Take a look at the RFC to see what a request looks like in order to parse it correctly:

    Request       = Request-Line              ; Section 5.1
                        *(( general-header        ; Section 4.5
                         | request-header         ; Section 5.3
                         | entity-header ) CRLF)  ; Section 7.1
                        CRLF
                        [ message-body ]          ; Section 4.3
    

提交回复
热议问题