Advertisement
Guest User

jd-https-2ch.patch

a guest
Apr 15th, 2017
749
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.09 KB | None | 0 0
  1. From 9cdb42ce66b6c43838cb122996f2525bf195c324 Mon Sep 17 00:00:00 2001
  2. From: jd-street <jd-street@not.available>
  3. Date: Sat, 15 Apr 2017 20:19:56 +0900
  4. Subject: [PATCH 4/4] support HTTPS access to 2ch-like sites via proxy.
  5.  
  6. Don't use SSL between JD and a proxy to access those sites,
  7. though proxy can still use SSL to connect to the origin server.
  8.  
  9. This hacky patch is needed if destination sites require HTTPS access
  10. and HTTPS tunneling is not an option because some processing at proxy
  11. (like authorization cookie management or content scraping) is necessary.
  12.  
  13. Currently, 2ch-like sites neither require HTTPS nor reject HTTP.
  14. Futhermore, the bbsmenu list contains no HTTPS url,
  15. which makes JD always use HTTP to access those sites
  16. (regardless of the URI scheme in <a> links).
  17. So this is a prep work for the possible future
  18. where 2ch mandates HTTPS access and/or bbsmenu contains HTTPS URLs.
  19.  
  20. Signed-off-by: jd-street <jd-street@not.available>
  21. ---
  22. src/jdlib/loader.cpp | 12 ++++++++----
  23.  1 file changed, 8 insertions(+), 4 deletions(-)
  24.  
  25. diff --git a/src/jdlib/loader.cpp b/src/jdlib/loader.cpp
  26. index 7ad1154..aed784e 100644
  27. --- a/src/jdlib/loader.cpp
  28. +++ b/src/jdlib/loader.cpp
  29. @@ -446,8 +446,6 @@ bool Loader::run( SKELETON::Loadable* cb, const LOADERDATA& data_in )
  30.  
  31.          // https
  32.          else if( m_data.protocol.find( "https://" ) != std::string::npos ){
  33. -            m_data.use_ssl = true;
  34. -            m_data.async = false;
  35.              m_data.port = 443;
  36.          }
  37.  
  38. @@ -461,8 +459,14 @@ bool Loader::run( SKELETON::Loadable* cb, const LOADERDATA& data_in )
  39.          }
  40.      }
  41.  
  42. -    // 明示的にssl使用指定
  43. -    if( data_in.use_ssl ){
  44. +    // ssl使用指定
  45. +    // HACK: don't use SSL to access 2ch via a scraping proxy
  46. +    if( data_in.use_ssl
  47. +        || ( m_data.protocol.find( "https://" ) != std::string::npos
  48. +             && m_data.host.find( ".2ch.net" ) == std::string::npos
  49. +             && m_data.host.find( ".bbspink.com" ) == std::string::npos
  50. +           )
  51. +      ){
  52.          m_data.use_ssl = true;
  53.          m_data.async = false;
  54.      }
  55. --
  56. 2.12.2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement