Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

Site request headers have a content-type of text/plain #10

Closed
emmatebibyte opened this issue Sep 3, 2022 · 3 comments
Closed

Site request headers have a content-type of text/plain #10

emmatebibyte opened this issue Sep 3, 2022 · 3 comments

Comments

@emmatebibyte
Copy link

I just wanted to let you know about this since I noticed it when navigating to it and my script, xdg-sanity, had it open in my text editor, lol.

@TruncatedDinoSour
Copy link
Owner

Actually, I'm fairly sure it's just the redirect,
basically https://ari-web.xyz/ is NOT the html initially,
then it redirects you to https://www.ari-web.xyz/ and I think
it just says 'Redirecting to https://www.ari-web.xyz/' (a string of 39 characters)
and then redirects

How did I verify this:

ari@ari-gentoo ~ % curl -v https://ari-web.xyz/ 2>&1 | grep content
(standard input):59:< content-security-policy: upgrade-insecure-requests
(standard input):60:< content-type: text/plain
(standard input):66:< x-content-type-options: nosniff
(standard input):70:< content-length: 39
(standard input):134:< content-security-policy: upgrade-insecure-requests
(standard input):135:< content-type: text/html; charset=UTF-8
(standard input):141:< x-content-type-options: nosniff

Lines 60, 66 and 70 is the redirect, Line 135 is the
main page, www. subdomain :)

So why does your script open it in a text editor?

Simple, in line 54 of your script:
https://git.tebibyte.media/emma/xdg-sanity/src/branch/main/xdg-sanity.sh#L54

Your curl in not handling redirects, that's the default behaviour of curl
CLI, here's a fix:

MIME=$(curl -fL -I -s "$INPUT" | sed -ne 's/^[cC]ontent-[tT]ype: //p' | sed -e 's/;.\+//g' | tr -d '\r')

You can seperate that -fL to -f -L to keep it consistent :)

Anyway,
Thanks for the concern 👍

@emmatebibyte
Copy link
Author

Thanks for the response and the bug fix!!

@TruncatedDinoSour
Copy link
Owner

BTW, for people in the future, this should no longer be an issue: https://blog.ari-web.xyz/b/the--www--subdomain-is-no-longer-the-default-for-ari-web-xyz/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants