Guest User

Untitled

a guest
Aug 20th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. diff --git a/src/libwaitress/waitress.c b/src/libwaitress/waitress.c
  2. index 1a6d4cd..d3698af 100644
  3. --- a/src/libwaitress/waitress.c
  4. +++ b/src/libwaitress/waitress.c
  5. @@ -815,6 +815,22 @@ static WaitressReturn_t WaitressConnect (WaitressHandle_t *waith) {
  6.  
  7. #ifdef ENABLE_TLS
  8. if (waith->url.tls) {
  9. + /* set up proxy tunnel */
  10. + if (WaitressProxyEnabled (waith)) {
  11. + char buf[256];
  12. + size_t size;
  13. + snprintf (buf, sizeof (buf), "CONNECT %s:%s HTTP/1.1\r\n\r\n",
  14. + waith->url.host, WaitressDefaultPort (&waith->url));
  15. + WaitressOrdinaryWrite (waith, buf, strlen (buf));
  16. +
  17. + WaitressOrdinaryRead (waith, buf, sizeof (buf)-1, &size);
  18. + buf[size] = 0;
  19. + printf ("ret: %s\n", buf);
  20. + if (WaitressParseStatusline (buf) != 200) {
  21. + return WAITRESS_RET_CONNECT_REFUSED;
  22. + }
  23. + }
  24. +
  25. if (gnutls_handshake (waith->request.tlsSession) != GNUTLS_E_SUCCESS) {
  26. return WAITRESS_RET_TLS_HANDSHAKE_ERR;
  27. }
Add Comment
Please, Sign In to add comment