The incorrect content length problem with Apache, how to stop waiting for data, and send a reply in

Discussion in 'Perl Misc' started by samkipers445r@yahoo.com, Sep 22, 2005.

  1. Guest

    Hello

    Maybe someone who knows apache internals can help on this issue.

    We created an http client application, and a server CGI script on perl
    to exchange data between the application which is spread among many
    users and our server. Unfortunately the client application had a bug
    with https POST method when it sent less data than specified in content
    length header. It happens on a certain combination of input data
    entered by end user. As the result the Apache server waits for the
    missing data because of incorrect content length sent by the client,
    and we never have a chance to send a reply back to the client
    application. The client application simply closes the connection after
    one minute timeout period.

    Is there any way to force Apache to cancel the wait on receiving
    missing data in Post method and switch it to sending data to reply back
    to the client application from CGI script?

    We tried writing to stdout and/or closing stdin, but it doesn't help,
    it seems Apache keeps on hanging, and doesn't want to send anything
    while waiting for missing data because of incorrect content length.

    Thanks,
    Sam Kipers
    , Sep 22, 2005
    #1
    1. Advertising

  2. Juha Laiho Guest

    said:
    >We created an http client application, and a server CGI script on perl
    >to exchange data between the application which is spread among many
    >users and our server. Unfortunately the client application had a bug
    >with https POST method when it sent less data than specified in content
    >length header.


    Well, wouldn't it be better to fix the client application (as you said,
    you created it, so you should still be able to change it), than to leave
    the client buggy and create a separate workaround?

    >Is there any way to force Apache to cancel the wait on receiving
    >missing data in Post method and switch it to sending data to reply back
    >to the client application from CGI script?


    This might be possible with a nph-script (no-parse-headers), which
    pretty much will make apache into a raw data pipe - instead of its
    normal mode of operation, where it makes at least some sanity checks
    to the data - in order to partially protect the server application.
    So, with a nph-script, the server-side script has the full responsibility
    to handle anything that might come down the pipe (ok, it is required
    that the start of request is correct enough HTTP that Apache knows
    to fire the script, but after that, all is up to your script. Still,
    fixing the client end would be much better.
    --
    Wolf a.k.a. Juha Laiho Espoo, Finland
    (GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
    PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
    "...cancel my subscription to the resurrection!" (Jim Morrison)
    Juha Laiho, Sep 25, 2005
    #2
    1. Advertising

  3. Guest

    Hello Juha,

    thanks for the reply.

    The bug in the client has been fixed already. We cannot update the
    client among our clients quickly. Usually it takes 2-3 months. Thus the
    problem still persists. The server is overloaded with idle script
    processes.

    we have renamed the script to nph-xxx.pl and the problem still
    persists. yes, in case of nph scripts, we should send all headers back
    to client, for example "HTTP/1.0 302 Moved\r\n" and apache passes it to
    the client without modification, but it doesn't fix the problem. apache
    still waits for missing data, and it seems that it parses the content
    length header in the query anyway.

    Is there a way to fix the problem programmatically with CGI? Somehow we
    need to tell Apache to stop waiting for data and send a required reply
    to the client.

    I feel that customizing/patching Apache for this particular problem is
    not a good decision.

    Any suggestions?

    Thanks,
    Sam Kipers
    , Sep 26, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SGlyYWs=?=
    Replies:
    0
    Views:
    1,317
    =?Utf-8?B?SGlyYWs=?=
    May 26, 2006
  2. Christof Hoeke
    Replies:
    0
    Views:
    313
    Christof Hoeke
    Feb 26, 2008
  3. davidj411
    Replies:
    1
    Views:
    1,028
    Mike Driscoll
    May 27, 2008
  4. Replies:
    2
    Views:
    541
  5. Public Interest
    Replies:
    0
    Views:
    151
    Public Interest
    Oct 20, 2003
Loading...

Share This Page