Welcome! Log In Create A New Profile


RE: Issuing an HTTP request from a stream module

April 14, 2019 09:26AM
Thank you, Roman, this is very helpful!

> In nginx source there are at least 2 examples of how to write an HTTP client:
> - OCSP stapling (src/event/ngx_event_openssl_stapling.c)
> - mail_auth module (src/mail/ngx_mail_auth_http_module.c)
> Also, the HTTP proxy module does this as well, but the entire module is much more complicated.
I was familiar with the proxy module, but since it depends on 'upstream' it is harder to derive the required code from it,
wasn't familiar with the 2 other implementations you mentioned...

I looked at ngx_event_openssl_stapling, something small that I noticed - I didn't see any handling
for the case in which the response headers are larger than the allocated buffer (16K).
While it is an edge case, unless I'm missing something, the code will call recv with decreasing sizes,
until the buffer will eventually get full, and recv will be called with size=0.
I think it makes sense to check the size and print some error if this happens.

> --
> Roman Arutyunyan
> _______________________________________________
> nginx-devel mailing list
> nginx-devel@nginx.org
> https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmailman.nginx.org%2Fmailman%2Flistinfo%2Fnginx-devel&data=02%7C01%7Ceran.kornblau%40kaltura.com%7Cb0737c825fe744818b6608d6bc2db562%7C0c503748de3f4e2597e26819d53a42b6%7C0%7C0%7C636903301834679796&sdata=Qf53use9qeujNa2g4MKBy2DBtgLCeEi7D3j3M%2BftGXg%3D&reserved=0


nginx-devel mailing list
Subject Author Views Posted

Issuing an HTTP request from a stream module

erankor 447 April 08, 2019 08:18AM

Re: Issuing an HTTP request from a stream module

Roman Arutyunyan 183 April 08, 2019 10:24AM

RE: Issuing an HTTP request from a stream module

erankor 268 April 14, 2019 09:26AM

Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 66
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready