Bitcoin Forum
May 12, 2024, 07:05:49 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: bitcointalk.org image proxy doesn't specify user agent  (Read 75 times)
npuath (OP)
Copper Member
Jr. Member
*
Offline Offline

Activity: 42
Merit: 67


View Profile
January 30, 2023, 05:17:53 AM
 #1

When developing an API for historical BTC quotes yielding images, I had problems inserting the images in forum posts using the [img] BBCode - the forum image proxy replied Invalid image.

Since the image URIs worked elsewhere, I studied my server logs, and it turned out that my server blocked the requests, becuase no User agent was supplied from the image proxy. Removing the check on my server fixed the problem.

Before I found out, I searched the forum, and it seems as if more than I have had similar problems. In some of these cases it may have been because of the missing UA; maybe somebody wants to add it.


Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715540749
Hero Member
*
Offline Offline

Posts: 1715540749

View Profile Personal Message (Offline)

Ignore
1715540749
Reply with quote  #2

1715540749
Report to moderator
1715540749
Hero Member
*
Offline Offline

Posts: 1715540749

View Profile Personal Message (Offline)

Ignore
1715540749
Reply with quote  #2

1715540749
Report to moderator
1715540749
Hero Member
*
Offline Offline

Posts: 1715540749

View Profile Personal Message (Offline)

Ignore
1715540749
Reply with quote  #2

1715540749
Report to moderator
Foxpup
Legendary
*
Offline Offline

Activity: 4354
Merit: 3044


Vile Vixen and Miss Bitcointalk 2021-2023


View Profile
January 30, 2023, 05:37:14 AM
Merited by suchmoon (1), Welsh (1), ABCbits (1)
 #2

The User-Agent header is entirely optional in the HTTP protocol, and its absence is in no way indicative of a malformed or malicious request. Is there some reason you're blocking requests that omit it?

Will pretend to do unspeakable things (while actually eating a taco) for bitcoins: 1K6d1EviQKX3SVKjPYmJGyWBb1avbmCFM4
I am not on the scammers' paradise known as Telegram! Do not believe anyone claiming to be me off-forum without a signed message from the above address! Accept no excuses and make no exceptions!
npuath (OP)
Copper Member
Jr. Member
*
Offline Offline

Activity: 42
Merit: 67


View Profile
January 30, 2023, 06:24:46 AM
Merited by vapourminer (2), ABCbits (1)
 #3

The User-Agent header is entirely optional in the HTTP protocol, and its absence is in no way indicative of a malformed or malicious request. Is there some reason you're blocking requests that omit it?

The Internet Engineering Task Force (IETF) tries very hard to be careful in its wordings, and differs between terms such as "may", "should" and "must", for example. I had a (very) small part in the inclusion of User-Agent in the 1992 draft of HTTP/2 (my bold emphasis):
Quote from: IETF
This line if present gives the software program used by the original client. This is for statistical purposes and the tracing of protocol violations. It should be included. The first white space delimited word must be the software product name, with an optional slash and version designator. Other products which form part of the user agent may be put as separate words.
https://www.w3.org/Protocols/HTTP/HTRQ_Headers.html#user-agent

In 2013, the HTTP/1.1 specification was revised to include User-Agent (IETFs capital emphasis):
Quote from: IETF
A user agent SHOULD send a User-Agent field in each request unless specifically configured not to do so.
https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-p2-semantics-23#section-5.5.3

Granted, since then, the User-Agent string has been used and abused in every possible way, and has become overly long, lying about what it really is and used for branding and advertising.

My suggestion to let the forum proxy include User-Agent is purely pragmatic, in that it may help alleviating some users' issues, given that some image servers block requests without it.


shahzadafzal
Copper Member
Legendary
*
Offline Offline

Activity: 1540
Merit: 2912



View Profile
January 30, 2023, 07:29:54 AM
Merited by Welsh (1), ABCbits (1)
 #4

In 2013, the HTTP/1.1 specification was revised to include User-Agent (IETFs capital emphasis):
Quote from: IETF
A user agent SHOULD send a User-Agent field in each request unless specifically configured not to do so.
https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-p2-semantics-23#section-5.5.3

That's just a recommendation or you can best practice but not a rule.  Many bots/searchengine bots doesn't set user agent.


My suggestion to let the forum proxy include User-Agent is purely pragmatic, in that it may help alleviating some users' issues, given that some image servers block requests without it.

Image hosting sites like imgur imgbb all accepting requests and it's working fine. I don't think theymos is going to update the image proxy unless there's major show stopper issue.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!