HalosGhost / pbpst

A command-line libcurl C client for pb deployments
GNU General Public License v2.0
44 stars 9 forks source link

Could not create paste: HTTP response code said error #86

Open Hritik14 opened 6 years ago

Hritik14 commented 6 years ago

I'm getting pbpst: Could not create paste: HTTP response code said error pbpst: Removed empty swap flie (contingency) when trying to create any paste.

HalosGhost commented 6 years ago

Hi, what provider are you using? and can you give me some basic information about the file? What file type is it, what size is it, etc.?

Hritik14 commented 6 years ago

Every file. Tried stdin as well. Provider is the default one. pb. The curl command from pb works fine though.

HalosGhost commented 6 years ago

Could you post the full output using -VV?

Hritik14 commented 6 years ago
*   Trying 138.197.7.107...
* TCP_NODELAY set
*   Trying 2604:a880:800:a1::78b:2001...
* TCP_NODELAY set
* Connected to ptpb.pw (138.197.7.107) port 443 (#0)
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: none
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: CN=ptpb.pw
*  start date: Nov 17 05:20:15 2017 GMT
*  expire date: Feb 15 05:20:15 2018 GMT
*  subjectAltName: host "ptpb.pw" matched cert's "ptpb.pw"
*  issuer: C=US; O=Let's Encrypt; CN=Let's Encrypt Authority X3
*  SSL certificate verify ok.
> POST / HTTP/1.1
Host: ptpb.pw
Transfer-Encoding: chunked
Accept: application/json
Content-Type: multipart/form-data; boundary=------------------------6a307031b6691b71
Expect: 100-continue

< HTTP/1.1 100 Continue
* The requested URL returned error: 400 BAD REQUEST
* stopped the pause stream!
* Closing connection 0
pbpst: Could not create paste: HTTP response code said error
pbpst: Removed empty swap flie (contingency)
HalosGhost commented 6 years ago

Well, that is quite odd. Can you show me ls -l thefile and show me the full command you used to try to paste it?

Hritik14 commented 6 years ago

It's getting weirder.

/tmp   
❯ pbpst -S -f file 
https://ptpb.pw/pYBC

/tmp   
❯ cat file | pbpst -S
pbpst: Could not create paste: HTTP response code said error
pbpst: Removed empty swap flie (contingency)

/tmp   
❯ ls -l file
-rw-r--r-- 1 hritik hritik 6 Nov 28 00:54 file
agatsoh commented 5 years ago

I am getting the same error. I am trying the command

journalctl -keb -1| pbpst -S
pbpst: Could not create paste: HTTP response code said error
pbpst: Removed empty swap file (contingency)

Any workarounds for this as of now ?

ghost commented 5 years ago

Same error here, using the latest git commit.

HalosGhost commented 5 years ago

Indeed. The fix for this involves reading/buffering in all of stdin so that the length can be determined; and then the request can be handled roughly as normal (link with more detail can be found in #89). I'm afraid I haven't gotten around to fixing it yet (work has become a bit hectic lately). If anyone wants to take a stab at it, I'd happily accept PRs (including partial work if it brings us closer to a real fix).

I am starting to have a bit more free-time (though that may change here shortly), so hopefully I can finally come back and address this properly in not too long ):