GNU/Weeb Mailing List <[email protected]>
 help / color / mirror / Atom feed
From: Ammar Faizi <[email protected]>
To: Ammar Faizi <[email protected]>
Cc: Michael William Jonathan <[email protected]>,
	GNU/Weeb FB Team <[email protected]>,
	GNU/Weeb Mailing List <[email protected]>
Subject: [PATCH fb v1 0/3] Facebook Onion assets optimization
Date: Sat, 13 May 2023 01:44:08 +0700	[thread overview]
Message-ID: <[email protected]> (raw)

Hi,

Facebook Onion CDN is slow...

Replace Facebook onion asset endpoint with non-onion for faster response
time. Avoid HTTP request to Facebook onion if possible. When using
Facebook onion, the CDN asset URL looks like this:

  https://scontent.xx.facebookcooa4ldbat4g7iacswl3p2zrf5nuylvnhxn6kqolvojixwid.onion/something

we can simply replace the domain with scontent.xx.fbcdn.net to get the
same asset:

  https://scontent.xx.fbcdn.net/something

Side note: We don't fully understand how Facebook actually manages their
CDN. We may introduce a subtle issue by doing it this way. But we hope
we don't.

There are 3 patches in this series:

1. Don't use proxy if the host isn't an onion domain.

Speed up the HTTP request by not using the Tor proxy if the destination
host is not an onion domain. This is also a preparation to handle
Facebook assets (photos, video, files) better and faster.

2. Introduce `build_url()` function.

Introduce build_url() function to construct a URL based on the return
value of parse_url(). Currently, the only purpose of this function is to
easily change the hostname without inventing our own URL parser. This
function is taken from an answer on the stackoverflow site. I put the
stackoverflow link in the commit message.

3. Replace Facebook onion asset endpoint with non-onion.

We're mucking around with the URL here, in patch #3.

Signed-off-by: Ammar Faizi <[email protected]>
---

The following changes since commit 68e95a61956e75ad08ad0bb68f10172fd2883816:

  Merge branch 'dev.cache' (Facebook scraper cache) (2023-05-09 17:59:03 +0700)

are available in the Git repository at:

  https://gitlab.torproject.org/ammarfaizi2/Facebook.git dev.fast_asset

for you to fetch changes up to 8a74bcd85a0ea781ed23c77527af288abcfff900:

  fb: web: Replace Facebook onion asset endpoint with non-onion (2023-05-13 01:35:01 +0700)

----------------------------------------------------------------
Ammar Faizi (3):
      fb: web: Don't use proxy if the host isn't an onion domain
      fb: helper: Introduce `build_url()` function
      fb: web: Replace Facebook onion asset endpoint with non-onion

 src/Facebook/helpers.php | 18 ++++++++++++++++++
 web/public/api.php       | 18 ++++++++++++++++++
 2 files changed, 36 insertions(+)

base-commit: 68e95a61956e75ad08ad0bb68f10172fd2883816
-- 
Ammar Faizi


             reply	other threads:[~2023-05-12 18:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-12 18:44 Ammar Faizi [this message]
2023-05-12 18:44 ` [PATCH fb v1 1/3] fb: web: Don't use proxy if the host isn't an onion domain Ammar Faizi
2023-05-12 18:44 ` [PATCH fb v1 2/3] fb: helper: Introduce `build_url()` function Ammar Faizi
2023-05-12 18:44 ` [PATCH fb v1 3/3] fb: web: Replace Facebook onion asset endpoint with non-onion Ammar Faizi
2023-05-12 19:10 ` [PATCH fb v1 0/3] Facebook Onion assets optimization GNU/Weeb Facebook Team

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox