4 Replies Latest reply on Jul 18, 2011 10:58 AM by nichele

    HTTP Status code 308 is converted in HTTP 500

    nichele

      Hi All,

      i'm starting to use mod_cluster 1.1.2 with tomcat as replacement of mod_jk.

      All was working fine but now i have found an bad behavior that is stopping me in adopting mod_cluster ( :-( )

       

      My application implements something like a resumable http upload using 308 as status code for resume (see for instance http://code.google.com/apis/gdata/docs/resumable_upload.html).

      Important thing is that we return 308 to the client and it seems mod_cluster doens't handle it correclty (and indeed 308 is not a standard HTTP status code). In the apache access log i have:

       

      xx.xx.xx.xx- - [16/Jul/2011:02:57:29 -0700] "POST /upload HTTP/1.1" 308 - "-" "Jakarta Commons-HttpClient/3.1"

       

      but the client receives error status code 500.

       

      I did a quick test using 307 instead of 308 and it works fine.

       

      I'm supposing mod_cluster converts in 500 any  not standard status code. Is it right ?

       

      If yes,  is it possible to add an option to made mod_cluster "less formal" ?

      But now this is a stopper for me since i can not change how my application works, could you help me in patching mod_cluster code in order to have it accepting status 308 ?

      Otherwise, if you think this could be consider a bug, let me know and i'll file it and, if you point me on the right direction, i'll be happy to fix it.

       

      In attachment error.log for the request.

       

      Thanks in advance

      stefano

        • 1. Re: HTTP Status code 308 is converted in HTTP 500
          nichele

          Hi all,

          small update...

          I did a test just using mod_proxy (without mod_cluster) and I have the same issue :-(.

           

          If someone wants to try, i'm using just a jsp with this content to replicate the issue:

           

          <%

              response.setStatus(308);

          %>

           

          Any help is welcome in any case...

          ste

          • 2. Re: HTTP Status code 308 is converted in HTTP 500
            jfclere

            In the validate_status_line() in modules/http/http_filters.c needs to be more tolerant:

            look to the httpd-trunk code:

            +++

            static void validate_status_line(request_rec *r)

            {

                char *end;

             

                if (r->status_line) {

                    int len = strlen(r->status_line);

                    if (len < 3

                        || apr_strtoi64(r->status_line, &end, 10) != r->status

                        || (end - 3) != r->status_line

                        || (len >= 4 && ! apr_isspace(r->status_line[3]))) {

                        r->status_line = NULL;

                    }

                    /* Since we passed the above check, we know that length three

                     * is equivalent to only a 3 digit numeric http status.

                     * RFC2616 mandates a trailing space, let's add it.

                     */

                    else if (len == 3) {

                        r->status_line = apr_pstrcat(r->pool, r->status_line, " ", NULL);

                    }

                }

            }

            +++

            • 3. Re: HTTP Status code 308 is converted in HTTP 500
              jfclere
              • 4. Re: HTTP Status code 308 is converted in HTTP 500
                nichele

                That's a really really useful info !! (both, the suggested code and the link to httpd bug).

                 

                many thanks, i'll evaluate a possible fix in apache or in tomcat.