Curl issue in function post() in Collection.body.php

7 views
Skip to first unread message

Bjoern

unread,
Mar 1, 2009, 7:40:58 AM3/1/09
to mwlib
Dear all,

I've got a problem, that's seems to be to do with curl not being able
to retrieve a pdf file.

From the user perspective, this happens: For instance, on this page
http://www.ict4e.net/wiki/Tutorials/Dynamic_Range_Compression
I can generate pdf for the page to get:
http://www.ict4e.net/wiki_source/index.php?title=Special:Book/download/&collection_id=30f6d6e8d8e68492&writer=rl&return_to=Tutorials%2FDynamic+Range+Compression

However, when I click the link to get the pdf:
http://www.ict4e.net/wiki_source/index.php?title=Special:Book/download/&collection_id=30f6d6e8d8e68492&writer=rl&return_to=Tutorials%2FDynamic+Range+Compression

the pdf often doesn't download. More precisely: Sometimes, the pdf
doesn't download at all, but sometimes it does. If it downloaded,
clicking the back button, and trying to download again, may not work.
Typically at the latest by the third download, it no longer works.

When the pdf doesn't download, and you click the 'cancel' button on
the browser, a php session is left running on the server. It seems
that killing all those sessions helps with being able to download
again. However, even with no sessions left hanging, the pdf download
fails as described above. I've tried this with several browsers
(Safari, Firefox, Opera) and on several pages on my wiki, and I get
the same behaviour. It happened on v.1.13.2, but have now upgraded to
1.14.0 (and latest version of Collection) and the issue occurs just
the same. This is with PHP 5.2.4.

I then had a look at the code, at the curl request in function post()
in Collection.body.php. Normally when the function is called, it's set
to not timeout. So I added a timeout with 10 secs.

$timeout = true;
$PostFields = array (
'collection_id' => '30f6d6e8d8e68492',
'writer' => 'rl',
'command' => 'download',
);
$wgHTTPTimeout=10;

Then, in situations where the download previously stalled, you now get
the following error message:
Operation timed out after 10000 milliseconds with 40333 out of 261808
bytes received

which seems to be typical for this failure: The operation times out
with around 40kB read. (Sometimes 0, but most of the time around 40kB
it seems.) Of course, where the download works, 10s is more than
enough to retrieve the full pdf file.

When a failure occurs, curl_getinfo gives:

array (
'url' => 'http://tools.pediapress.com/mw-serve/',
'content_type' => 'application/pdf',
'http_code' => 200,
'header_size' => 211,
'request_size' => 405,
'filetime' => -1,
'ssl_verify_result' => 0,
'redirect_count' => 0,
'total_time' => 10.222578,
'namelookup_time' => 0.002626,
'connect_time' => 0.046523,
'pretransfer_time' => 0.046526,
'size_upload' => 365,
'size_download' => 40333,
'speed_download' => 3945,
'speed_upload' => 35,
'download_content_length' => 261808,
'upload_content_length' => 365,
'starttransfer_time' => 0.046615,
'redirect_time' => 0,
)

It seems to me that this must be a server-side issue with the mw-
serve. Has anybody else experienced this problem? Any suggestions for
further output I could generate to clarify the issue?

Any suggestions and help would be greatly appreciated. Many thanks!
Bjoern

Bjoern

unread,
Mar 10, 2009, 9:29:05 AM3/10/09
to mwlib
Hi all,

this problem no longer occurs - maybe it was a temporary problem with
the server.

All the best,
Bjoern

On Mar 1, 12:40 pm, Bjoern <sl.cont...@googlemail.com> wrote:
> Dear all,
>
> I've got a problem, that's seems to be to do with curl not being able
> to retrieve a pdf file.
>
> From the user perspective, this happens: For instance, on this pagehttp://www.ict4e.net/wiki/Tutorials/Dynamic_Range_Compression
> I can generate pdf for the page to get:http://www.ict4e.net/wiki_source/index.php?title=Special:Book/downloa...
>
> However, when I click the link to get the pdf:http://www.ict4e.net/wiki_source/index.php?title=Special:Book/downloa...
Reply all
Reply to author
Forward
0 new messages