Re: Return a 200 0K status and send the content of the request later

2025-05-13 Thread Ed Sabol
On May 13, 2025, at 8:23 PM, Vincent Veyron wrote: > Is there a way I could do : > > $r->print('Building tar file') ; > > every second or other until the tar file is built? I can't seem to think of > one. > > My handler calls an sql script that dumps the database with system() : > >

Re: Return a 200 0K status and send the content of the request later

2025-05-13 Thread Mithun Bhattacharya
You should do the flush after the ContentType - content_type is header the H3 is body of the response or at least it should be. As for your second question, you are looking at a javascript based solution - this isn't something a server side code can do. Look into a sleep followed by a window.locat

Re: Apache2::Request and other modules

2025-05-13 Thread Mithun Bhattacharya
Apache2::Request is the base and you would at least need that to consume a request. The rest are optional and expand on what $r provides. You include them only if you are using something they are providing. On Tue, May 13, 2025, 8:37 PM wrote: > Hello > > In my modperl handler, I only use Apach

Apache2::Request and other modules

2025-05-13 Thread ypeng
Hello In my modperl handler, I only use Apache2::Request module. What relations are there between Apache2::Request and the following modules? use Apache2::RequestRec (); use Apache2::RequestIO (); use Apache2::Connection (); use APR::Table (); Should I include them in startup.pl as well as A

Re: Return a 200 0K status and send the content of the request later

2025-05-13 Thread Vincent Veyron
On Tue, 13 May 2025 14:57:15 -0500 Mithun Bhattacharya wrote: Hi Mithun, > Hence if you are writing a mod_perl handler for such an endpoint you return > success immediately and then start processing the request. In most cases > this is simply a matter of doing $r->print on the headers followed b

Re: Apache server returns early before process is complete

2025-05-13 Thread Ian B
I'm wondering if you were to do an strace -s 2048 -f -p on the dev server where there's less happening if you may be able to spot something going on (-f is follow children -s size of line output before truncated).

Re: Return a 200 0K status and send the content of the request later

2025-05-13 Thread Mithun Bhattacharya
Http return codes are relevant only for request with fast response time. It helps the requestor get a quick status 200 is all good, 3xx something temporary, 4xx client has made some mistakes and 5xx server faulted. Unfortunately this design doesn't map well to requests which take significant execu

Return a 200 0K status and send the content of the request later

2025-05-13 Thread Vincent Veyron
On Wed, 23 Apr 2025 15:06:44 -0500 Mithun Bhattacharya wrote: Hi Mithun, In a recent thread, you wrote : > > mod_perl code is where you are sending the http return status to make sure > the client doesn't timeout waiting for the server to respond. > Could you explain how this is done, I thou

Re: Send a 200 0K return status without the content

2025-05-13 Thread Vincent Veyron
Sorry, I did not mean to hijack this thread, re-posting. On Tue, 13 May 2025 19:37:07 +0200 Vincent Veyron wrote: > On Wed, 23 Apr 2025 15:06:44 -0500 > Mithun Bhattacharya wrote: > > Hi Mithun, > > In a recent thread, you wrote : > > > > > mod_perl code is where you are sending the h

Re: Apache server returns early before process is complete

2025-05-13 Thread Joseph He
Andreas, I add sleep 300 to the server code to simulate the stall SFTP and I set the server Timeout to be 150. Then I run curl command with different timeout 25, 50, 100, 150, 200, 250, the curl command always timeout accordingly. The behavior of curl is exactly the same as that of changing LWP::U

Send a 200 0K return status without the content

2025-05-13 Thread Vincent Veyron
On Wed, 23 Apr 2025 15:06:44 -0500 Mithun Bhattacharya wrote: Hi Mithun, In a recent thread, you wrote : > > mod_perl code is where you are sending the http return status to make sure > the client doesn't timeout waiting for the server to respond. > Could you explain how this is done, I thou

Re: Apache server returns early before process is complete

2025-05-13 Thread Andreas Mock
Hallo Joe, try to reduce the problem. Make the call to your SFTP-Service via curl or some other http(s) client to see whether you get the same timeout. If yes, than the server side is closing the connection. If not then you have to investigate the LWP::UserAgent part. Another hint in combin

Re: Apache server returns early before process is complete

2025-05-13 Thread Joseph He
Andreas, thank you. On the client side, I set the timeout at LWP::UserAgent request to 600, and I can verify that it indeed works on my QA and DEV environment. If I change it to 120, then it can timeout at 120. So on my production server, the client side receives a timeout from the server after 5

Re: Apache server returns early before process is complete

2025-05-13 Thread Andreas Mock
Hi Joe, when you send a request via LWP::UserAgent to the Server which does the long lasting SFTP calls, then I'm pretty sure that you get a timout in the LWP::UserAgent code. I'm pretty sure the client (LWP::UserAgent) is not waiting long enough for the answer: https://metacpan.org/pod/LWP:

Re: Apache server returns early before process is complete

2025-05-13 Thread Joseph He
Many thanks to you all. I am still trying to figure out the issue. Let me re-explain the problem I experienced with some details. The environment is Ubuntu 22.04, Apache2, ModPerl. I run a Http::request with LWP::UserAgent, the server receives the request and starts to process it. But it takes mu