How to check HTTP request headers before receiving request body using WCF

I am implementing a REST service using WCF, which will be used to download very large files. The HTTP headers in this request will transmit information that will be verified before allowing downloads (e.g. permissions, available disk space, etc.). Perhaps this check will fail, which will lead to an error. I would like to do this check before the client sends the request body, so it can detect a failure before loading potentially gigabytes of data.

RESTful web services use HTTP 1.1 Expect: 100-continuein the request to implement this. For example, the Amazon S3 REST API can check your key and ACL in response to an object operation PUT, returning 100 Continue, if all is well, indicating that you can start sending your data.

I rummaged around the WCF documentation and I just can't figure out how to do this without using a rather small connection to the HTTP request processing pipeline. How do you propose solving this problem?

+3
source share

Source: https://habr.com/ru/post/1742549/


All Articles