Segmentation fault when posting from Ruby #15

Closed
opened 2019-05-31 22:16:04 +02:00 by retorquere · 4 comments
retorquere commented 2019-05-31 22:16:04 +02:00 (Migrated from github.com)

I'm trying to post file contents from my ruby script to 0x0.st, but I'm getting a segmentation fault response -- any idea what I'm doing wrong?

puts HTTParty.post(
          'https://0x0.st/',
          multipart: true,
          body: { file: msg }
        ).body.inspect
I'm trying to post file contents from my ruby script to 0x0.st, but I'm getting a segmentation fault response -- any idea what I'm doing wrong? ``` puts HTTParty.post( 'https://0x0.st/', multipart: true, body: { file: msg } ).body.inspect ```

On Friday, May 31, 2019 10:16:05 PM CEST Emiliano Heyns wrote:

I'm trying to post file contents from my ruby script to 0x0.st, but I'm
getting a segmentation fault response -- any idea what I'm doing wrong?

puts HTTParty.post(
          'https://0x0.st/',
          multipart: true,
          body: { file: msg }
        ).body.inspect

Maybe use a library that has actual documentation and gets basic HTTP right
instead of just throwing shit at the wall to see what sticks and then asking
me to figure out why your rubygem is garbage.

On Friday, May 31, 2019 10:16:05 PM CEST Emiliano Heyns wrote: > I'm trying to post file contents from my ruby script to 0x0.st, but I'm > getting a segmentation fault response -- any idea what I'm doing wrong? > > ``` > puts HTTParty.post( > 'https://0x0.st/', > multipart: true, > body: { file: msg } > ).body.inspect > ``` Maybe use a library that has actual documentation and gets basic HTTP right instead of just throwing shit at the wall to see what sticks and then asking me to figure out why your rubygem is garbage.

That was a suggestion.

That was a suggestion.

Yes. That should do the job. And maybe you’ll figure out that the entire Ruby ecosystem is full of extremely poor-quality code (literally worse than 0x0’s).

Yes. That should do the job. And maybe you’ll figure out that the entire Ruby ecosystem is full of extremely poor-quality code (literally worse than 0x0’s).
retorquere commented 2019-06-01 13:14:24 +02:00 (Migrated from github.com)

In case anyone stumbles in here with a similar question, these worked:

uri = URI.parse('https://0x0.st/')
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
  req = Net::HTTP::Post::Multipart.new(uri.path, "file" => UploadIO.new(StringIO.new('hello'), "text/markdown", "travis.md"))
  puts http.request(req).body.inspect
end
import requests
response = requests.post('https://transfer.sh/', files={'travis.md':'baz'})
print(response.text)
In case anyone stumbles in here with a similar question, these worked: ``` uri = URI.parse('https://0x0.st/') Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http| req = Net::HTTP::Post::Multipart.new(uri.path, "file" => UploadIO.new(StringIO.new('hello'), "text/markdown", "travis.md")) puts http.request(req).body.inspect end ``` ``` import requests response = requests.post('https://transfer.sh/', files={'travis.md':'baz'}) print(response.text) ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: mia/0x0#15
No description provided.