httpmachine icon indicating copy to clipboard operation
httpmachine copied to clipboard

A mechanism to ensure that the parser will only parse requests or only parse responses

Open bvanderveen opened this issue 10 years ago • 0 comments

As described by @sergey-litvinov on #10:

  • update IHttpParserDelegate just to have common methods between request and response (Headers, Body, etc).
  • create two interfaces IHttpRequestParserDelegate and IHttpResponseParserDelegate that will inherit IHttpParserDelegate with Request\Response specific methods.
  • two constructors for HttpParser.
    • one receives IHttpRequestParserDelegate.
    • one receives IHttpResponseParserDelegate.
  • two member variables
    • one IHttpParserDelegate variable
    • a flag as to whether the delegate is a IHttpRequestParserDelegate or a IHttpResponseParserDelegate
  • in the request/response-specific embedded actions, check the flag on and throw and exception if the value is unexpected

bvanderveen avatar Mar 29 '14 06:03 bvanderveen