Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6621485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:16:15+00:00 2026-05-25T21:16:15+00:00

I am trying to send big zip files to a tomcat application using curl

  • 0

I am trying to send big zip files to a tomcat application using curl in a php script. Since it is a big zip file it is going to take some time on the tomcat server to unpack the zip file (about 2-5 minutes), but the curl request never waits more than 30 seconds before it just continue as if it had received an empty response.

Code I can reproduce problem with:

set_time_limit(0);

$uploadURL = 'http://192.168.0.2:8080/some/url/'
$userid = 'a-user';
$password = 'a-password';
$zipfile = '/tmp/myfile.zip';

$ch = curl_init($uploadURL);
curl_setopt($ch, CURLOPT_HEADER, array(
    'Connection: Keep-Alive',
    'Keep-Alive: 3600'
    ));
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
curl_setopt($ch, CURLOPT_USERPWD, $userid.":".$password);
curl_setopt($ch, CURLOPT_POST, true);
$post = array(
  "uploadMode" => "uploadOnly",
  "id" => $id,
  "numberOfFiles" => "1",
  "file"=>"@".$zipfile.";type=application/zip"
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 45);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_TIMEOUT, 200);
$response = curl_exec($ch);

The only suspect I have left is that curl makes the request and then times out due to a certain number of seconds elapsing without any bytes being sent back or forth (aka between_bytes_timeout). But I cannot find a curl option to help with that, so I am hoping it is something else.

The tomcat server is in the clear, since I can make a request to it with my browser that can lasts hours without problems.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:16:16+00:00Added an answer on May 25, 2026 at 9:16 pm

    Chances are, that cURL just auto-cancels the request, because of the transfer rate being too low while your Tomcat is unpacking the zip.

    This happens if the average transfer rate drops below CURLOPT_LOW_SPEED_LIMIT bytes/second for CURLOPT_LOW_SPEED_TIME seconds.

    Try adding the appropriate options with a high time and/or low limit, e.g.:

    curl_setopt($ch, CURLOPT_LOW_SPEED_LIMIT, 1);   // cancel if below 1 byte/second
    curl_setopt($ch, CURLOPT_LOW_SPEED_TIME, 30);   // for a period of 30 seconds
    

    To quicktest I’d recommend to use a TIME slightly higher than your Tomcat really needs to unpack a given test zip.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having big problems trying to get my php script to send email. Using this
I'm trying to send a message by using Javamail API, with tomcat as a
I'm having some trouble trying to get my script to send a file attachment
I have been trying to send a big attachment (9 MB) using C# ASP.NET
i'm trying to send fake keyboard input to an application that's running in a
I am trying to upload big files with drag and drop. I have this
Im trying to send images over HTTP using HttpListener but some images come from
Big picture: This is what I am trying to accomplish. Send a text message
I am trying to limit my application send rate to 900kbps but the problem
Trying to upload files using Google Gears and ASP.NET... I assume you can as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.