1

The Request type provides accessors for the request method and the request version but not for the bit in between.

So if I have the following request:

GET http://www.example.org/index.html HTTP/1.1

I want the http://www.example.org/index.html in between

RFC7230 Section 5.3.2 allows for this when making a request to a proxy. Section 5.4 says that the Host header should be overriden by the proxy with the host in the URI if the request is in absolute-form. This seems good enough for me, I don't know if WAI would handle this correctly if a client was not behaving correctly and sending a Host header different from the absolute-form URI.

Alternatively, if this is not possible: I'd like to ask if there is a more low level HTTP library than WAI available in Haskell?

Community
  • 1
  • 1
Philippe
  • 1,715
  • 4
  • 25
  • 49

1 Answers1

0

The rawPathInfo accessor method will provide this. See https://hackage.haskell.org/package/wai-3.2.2.1/docs/Network-Wai.html#v:rawPathInfo for details.

If you want the query string too, it's available via the rawQueryString accessor.

As for the host, HTTP requests don't normally look like your example (HTTP/1.1 clients will only look like that if they're connecting to a proxy, rather than to the destination Web server). Instead, they often look like this:

GET /index.html HTTP/1.1
Host: www.example.org

If you want http://www.example.org too, then you'll have to rebuild it yourself from the host and protocol information.