Author Topic: curl Segmentation fault  (Read 12138 times)

RONB

  • Newbie
  • *
  • Posts: 22
curl Segmentation fault
« on: June 20, 2014, 04:43:04 AM »
I have run into a problem with the curl module. All the download functions work, but none of the upload functions work. When trying to upload an image I get an error, Segmentation fault. Searching for curl and Segmentation fault shows a lot of trouble. The fix I think is to modify the c source for the curl build.
Using Debian 64, had to make a virtual install of win2kpro to upload my files., Ron 

support

  • Administrator
  • *****
  • Posts: 859
    • Script BASIC Open Source Project
Re: curl Segmentation fault
« Reply #1 on: June 20, 2014, 08:23:02 AM »
Hi Ron,

Have you tried using the cURL console utility to upload a file?

Can you post an example of the SB cURL code you're using to upload a file?

FYI: Check out the curl::option CurlHandle,"INFILE","file_name" as SB gets the file size for you using this option.

I will give the Ubuntu 64 Script BASIC cURL ext. module version a try and see if I can reproduce the issue.

Thanks for the feedback!

John
« Last Edit: June 20, 2014, 09:51:13 AM by support »
Script BASIC Project Manager

support

  • Administrator
  • *****
  • Posts: 859
    • Script BASIC Open Source Project
Re: curl Segmentation fault
« Reply #2 on: June 23, 2014, 08:02:05 AM »
Ron,

Can you post a snippet of Script BASIC code that shows the seg. fault occurring? I compiled the libcurl extension module on the latest Debian OS using the same cURL ext. module code that is used in 2.1. (nothing in that module changed - used latest libcurl code) The ext. modules (depending who wrote them) may not handle wrong or missing arguments which may be causing the seg. fault. Being able to reproduce the error will help resolve it. Have you tried uploading a file with the cURL command line utility?

Thanks!

John
« Last Edit: June 23, 2014, 08:27:30 AM by support »
Script BASIC Project Manager

support

  • Administrator
  • *****
  • Posts: 859
    • Script BASIC Open Source Project
Re: curl Segmentation fault
« Reply #3 on: June 23, 2014, 01:12:58 PM »
No offense but that has to be the strangest cURL file upload call I have ever seen. No encoding of the POST data???

After a second look ...

Code: [Select]
curl::option CurlHandle,"HTTPPOST","name=Desade+Marquis"

Your a1, a2, a3 should be in the above format. (Base64 Encoded)

Code: [Select]
name=@filename

This can be used to specify a file to upload. This is like what the browser sends to the web server when an <input type=file name="name"> is used.

Interesting. I have never uploaded a file this way before.

HTTPPOST string



« Last Edit: June 23, 2014, 01:57:17 PM by support »
Script BASIC Project Manager

support

  • Administrator
  • *****
  • Posts: 859
    • Script BASIC Open Source Project
Re: curl Segmentation fault
« Reply #4 on: June 23, 2014, 03:43:02 PM »
Okay. That gives me something to try.

Any chance this could be a file permission thing?
« Last Edit: June 23, 2014, 03:52:12 PM by support »
Script BASIC Project Manager

support

  • Administrator
  • *****
  • Posts: 859
    • Script BASIC Open Source Project
Re: curl Segmentation fault
« Reply #5 on: June 24, 2014, 12:17:15 PM »
There is more to this story going on IMHO. I'm having issues starting sbhttpd as a service on Linux 64 bit with the new builds. (haven't tried 32 bit sbhttpd) Lucky I have something that works from a previous build but reproducing it has become a challenge. I'm thinking we are seeing the results of a gcc deprecation support drop off in progress.  :-[

Still working on it.

Script BASIC Project Manager

support

  • Administrator
  • *****
  • Posts: 859
    • Script BASIC Open Source Project
Re: curl Segmentation fault
« Reply #6 on: June 24, 2014, 02:26:42 PM »
The -safe option creates two sbhttpd processes in case one fails the other takes over. A fault tolerant mode of sorts. The mode should only be run when debugging an issue with sbhttpd. Can you try the sbhttpd -start option and see if it starts as a service? Does deleting the pid.txt to do a graceful shutdown cause a seg. fault?

Script BASIC Project Manager

support

  • Administrator
  • *****
  • Posts: 859
    • Script BASIC Open Source Project
Re: curl Segmentation fault
« Reply #7 on: June 24, 2014, 03:09:24 PM »
That's good news and thanks for testing. Looks like an Ubuntu issue.

I can get the current Ubuntu version to run as a background job and works as if I started it with a sbhttpd -start. It dives me nuts when things that have been working forever all of a sudden don't.

« Last Edit: June 24, 2014, 07:57:59 PM by support »
Script BASIC Project Manager