zlin / wgetpaste

MIT License
34 stars 16 forks source link

wgetpaste fails with bpaste #43

Closed 2011 closed 1 year ago

2011 commented 1 year ago

Failed with (default) bpaste. Portion of debug log follows:

+ WGETARGS=--post-file=/tmp/wgetpaste.mgxBZK
+ header=HEADER_bpaste
+ [[ -n '' ]]
+ WGETEXTRAHEADER=
+ additional_headers=ADDITIONAL_HEADERS_bpaste
+ WGETADDITIONALHEADERS=()
+ [[ -n '' ]]
+ WGETARGS='--tries=5 --timeout=60 --post-file=/tmp/wgetpaste.mgxBZK'
+ geturl needstdout
+ local regex location
+ regex=REGEX_URL_pinnwand
+ location=REGEX_LOC_pinnwand
+ [[ -n s|^.*"link": "\([^"]\+bpa.st[^"]\+\)".*$|\1|p ]]
+ [[ needstdout = needstdout ]]
+ return 0
+ tail -n1
++ LC_ALL=C
++ wget -O - --tries=5 --timeout=60 --post-file=/tmp/wgetpaste.mgxBZK https://bpa.st/api/v1/paste
+ OUTPUT='--2023-05-20 06:26:32--  https://bpa.st/api/v1/paste
Resolving bpa.st... 65.109.61.99, 2a01:4f9:5a:5159::2
Connecting to bpa.st|65.109.61.99|:443... connected.
HTTP request sent, awaiting response... 400 Bad Request
2023-05-20 06:26:33 ERROR 400: Bad Request.'
+ [[ -f /tmp/wgetpaste.mgxBZK ]]
+ [[ -n 0 ]]
+ echo 'Left temporary file: "/tmp/wgetpaste.mgxBZK" alone for debugging purposes.'
Left temporary file: "/tmp/wgetpaste.mgxBZK" alone for debugging purposes.
++ geturl '--2023-05-20 06:26:32--  https://bpa.st/api/v1/paste
Resolving bpa.st... 65.109.61.99, 2a01:4f9:5a:5159::2
Connecting to bpa.st|65.109.61.99|:443... connected.
HTTP request sent, awaiting response... 400 Bad Request
2023-05-20 06:26:33 ERROR 400: Bad Request.'
++ local regex location
++ regex=REGEX_URL_pinnwand
++ location=REGEX_LOC_pinnwand
++ [[ -n s|^.*"link": "\([^"]\+bpa.st[^"]\+\)".*$|\1|p ]]
++ [[ needstdout = --2023-05-20 06:26:32--  https://bpa.st/api/v1/paste
Resolving bpa.st... 65.109.61.99, 2a01:4f9:5a:5159::2
Connecting to bpa.st|65.109.61.99|:443... connected.
HTTP request sent, awaiting response... 400 Bad Request
2023-05-20 06:26:33 ERROR 400: Bad Request. ]]
++ sed -n -e 's|^.*"link": "\([^"]\+bpa.st[^"]\+\)".*$|\1|p'
++ tail -n1
+ URL=
+ verifyurl
+ local t
+ [[ -z '' ]]
+ [[ -n 0 ]]
+ die 'Apparently nothing was received. Perhaps the connection failed.
--2023-05-20 06:26:32--  https://bpa.st/api/v1/paste
Resolving bpa.st... 65.109.61.99, 2a01:4f9:5a:5159::2
Connecting to bpa.st|65.109.61.99|:443... connected.
HTTP request sent, awaiting response... 400 Bad Request
2023-05-20 06:26:33 ERROR 400: Bad Request.'
+ echo 'Apparently nothing was received. Perhaps the connection failed.
--2023-05-20 06:26:32--  https://bpa.st/api/v1/paste
Resolving bpa.st... 65.109.61.99, 2a01:4f9:5a:5159::2
Connecting to bpa.st|65.109.61.99|:443... connected.
HTTP request sent, awaiting response... 400 Bad Request
2023-05-20 06:26:33 ERROR 400: Bad Request.'
Apparently nothing was received. Perhaps the connection failed.
--2023-05-20 06:26:32--  https://bpa.st/api/v1/paste
Resolving bpa.st... 65.109.61.99, 2a01:4f9:5a:5159::2
Connecting to bpa.st|65.109.61.99|:443... connected.
HTTP request sent, awaiting response... 400 Bad Request
2023-05-20 06:26:33 ERROR 400: Bad Request.
+ exit 1
heirecka commented 1 year ago

Hmm, I can't reproduce locally and it tests fire here, too: https://github.com/zlin/wgetpaste/actions/runs/5084349382/jobs/9136519493

2011 commented 1 year ago

I have tracked down the problem. Apparently, bpaste has a relatively low maximum buffer size (not documented on the web site, and no explanation other than "Bad Request" given via the API. I had a log file (strace) of about 170 KB that I wanted to share. After discovering the source of the problem, I can report that a file of 125000 bytes failed, and a file of 120000 bytes succeeded (no interest in performing further testing - which might get interpreted as spam / hostile).

You might note known size limits (and pre-reject attempts exceeding those limits) in wgetpaste as you learn of them (but the APIs should simply return "too large," or something similar).