on the same host, it work normally with filefield_source 6.x-1.4
after upgraded to 6.x-1.6, it throw this error when using remote url:
An HTTP error 0 occurred. <br />/filefield/ahah/story/field_image/2

Comments

jrstmartin’s picture

Me too. I also upgraded from 6.x-1.4 to 6.x-1.6 for the security update and the error occurs consistently on files large and small, of different types, and in all browsers. When I begin transferring a file, it seems to be working and the progress is moving across, but then the error is thrown just before the transfer completes.

Pressflow 6.26
FileField 6.x-3.10
uploadprogess 1.0.1
curl 7.19.7
jQuery 1.3.2
jQuery UI 1.7.3
memory_limit = 256M
post_max_size = 100M
upload_max_filesize = 100M

Ubuntu 10.04.4 LTS
Linux 2.6.32-43-generic
Apache 2.2.14 (prefork)
MySQL 5.1.63
PHP 5.2.10-2ubuntu6.9
Varnish 2.1 SVN
Memcached 1.4.2 (3.0.1)
APC 3.0.19

quicksketch’s picture

Title: An HTTP error 0 occurred. » An HTTP error 0 occurred when transferring remote files
Priority: Critical » Normal

I'm guessing this has to do with #1221382: Handle remote files without extensions based on Content-Type header, but I'm not sure. I'm not having the problem locally, so this may be something environment related. Thanks @jrstmartin for the full stack version numbers, that might help pin this down. HTTP Error 0 usually happens when an AJAX request is interupted before it's finished, but I'm not sure how that applies here.

quicksketch’s picture

Doh, actually on D6 this happens right away. This doesn't affect the D7 version. I'll look into this a bit more.

quicksketch’s picture

Looks like the actual cause was something in #1221486: Remote images appearing as access denied / 403, as commits before that one still work fine in D6. Still not sure what the problem is though.

ispboy’s picture

Version: 6.x-1.6 » 6.x-1.5

I also got this error in 6.x-1.5. And when i downgraded to 6.x-1.4, it resumes working normally.

It seems that something wrong about 6.x-1.5.

andrew.green’s picture

I also can re-iterate that I am also having the "An HTTP error 0 occurred" issues after testing the upgrade to 6.x-1.6 from 6.x-1.4.

pjnes’s picture

StatusFileSize
new735 bytes

For those that just want to fix the security vulnerability in 1.4 I've attached a patch that does just that. Should apply to the 1.4 version.

ispboy’s picture

good job!It's very helpful!.

Demonick99’s picture

I had a similar problem. Fixed changing the file remote.inc

    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, TRUE);
    curl_setopt($ch, CURLOPT_NOBODY, TRUE);
    curl_setopt($ch, CURLOPT_HEADERFUNCTION, '_filefield_source_remote_parse_header');
    // Causes a warning if PHP safe mode is on.
    @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
    curl_exec($ch);
    $info = curl_getinfo($ch);
    if ($info['http_code'] != 200) {
      curl_setopt($ch, CURLOPT_HTTPGET, TRUE);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
      $file_contents = curl_exec($ch);
      $info = curl_getinfo($ch);
    }
    curl_close($ch);

to

    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, TRUE);
    curl_setopt($ch, CURLOPT_NOBODY, TRUE);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADERFUNCTION, '_filefield_source_remote_parse_header');
    // Causes a warning if PHP safe mode is on.
    @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
    curl_exec($ch);
    $info = curl_getinfo($ch);
    if ($info['http_code'] != 200) {
      curl_setopt($ch, CURLOPT_HTTPGET, TRUE);
      $file_contents = curl_exec($ch);
      $info = curl_getinfo($ch);
    }
    curl_close($ch);
Mogul10’s picture

Thanks! It seems works for me.

havran’s picture

#9 work me too. I use 6.x-1.6. Thanks.

elplatt’s picture

Here's a patch implementing #9 on the 6.x-1.x branch.

jrstmartin’s picture

#9/#12 work for 6.x-1.6. Thank you so much!

quicksketch’s picture

Status: Active » Fixed

Thanks guys, committed to both branches.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

fabrizioprocopio’s picture

Me too have this error.
Is the patch implemented yet in the dev?
(I'm not a coder, I'm not able to apply patch)

pedrosp’s picture

Status: Closed (fixed) » Active

The last 6.x-1.8 does not include #12 patch.
However, removing / adding the "curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);" line did the trick, and still fix the problem.

Salonbus’s picture

The last 6.x-1.8 does not include #12 patch.

beto_beto’s picture

hello

my website drupal 6.25

and this error appear to me

" An HTTP error 0 occurred. /filefield/ahaha/xxx/field_xxxx/0 "

i can not find the solution !!

ispboy’s picture

The last 6.x-1.9 does not include #12 patch yet.

mrP’s picture

Version: 6.x-1.5 » 7.x-1.9
Issue summary: View changes
Status: Active » Reviewed & tested by the community

+1 RTBC @ #12

mrP’s picture

Version: 7.x-1.9 » 6.x-1.9

6.x

corfiot’s picture

If this has indeed been committed it's probably time to actually push out a release at least for 6.x.

quicksketch’s picture

Status: Reviewed & tested by the community » Fixed

Hi, thanks guys. Really sorry I haven't gotten this fixed. The patch is in the 7.x-1.x branch, but contrary to my above post, I didn't commit it to the 6.x-1.x branch. I've not committed it to that branch as well. I'll get a new release out soon.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.