Project

General

Profile

Actions

Bug #1351

closed

lighttpd returns "400 Bad Request" for Nokia web browser request

Added by Anonymous over 16 years ago. Updated almost 14 years ago.

Status:
Duplicate
Priority:
Normal
Category:
core
Target version:
-
ASK QUESTIONS IN Forums:

Description

We are running http://m.nokaut.pl/ mobile price comparison website on lighttpd 1.5-svn.

Everything works OK with popular browsers, Opera Mobile and some built-in mobile browsers (eg. Motorola, Samsung), but there is a MAJOR problem with all the requests from Nokia built-in web browser. All such requests receive "HTTP/1.1 400 Bad Request" error. I guess that it is caused by some not-standard HTTP headers.

Here is the full connection log (sniffed by ettercap):

-- michal.jaskolski


Related issues 1 (0 open1 closed)

Is duplicate of Bug #1717: Google's urlfetch from appEngine and lighttpd HTTP 400 responseObsoleteActions
Actions #1

Updated by Anonymous over 16 years ago

From what I can see, the problem is that your browser sends a Content-Length header during a GET request. (GET requests cannot contain a message-body; according to RFC2068 the Content-Length header signals that a message-body follows)

Lines 542-545 of request.c:


    case HTTP_METHOD_GET:
    case HTTP_METHOD_HEAD:
        /* content-length is forbidden for those */
        if (con->request.content_length != -1) {

I guess you could change it to something like this, to be more lenient.


        if (con->request.content_length <= 0) {
Actions #2

Updated by Anonymous over 16 years ago

(That should be a > instead of a <=, sorry)

Actions #3

Updated by Anonymous over 16 years ago

After changing that line, everything works well. We will contact Nokia and ask them to change their software to be RFC-compatible, but I think that the patch above should be included in main lighttpd source.

-- michal.jaskolski

Actions #4

Updated by Anonymous over 16 years ago

The same RFC incompatibility exists with the popular PHP SOAP library, nuSOAP. Here is a fix if anyone finds this page while trying to figure out the 400 errors with nuSOAP, like me :)

http://sourceforge.net/mailarchive/forum.php?thread_name=4d3038af0711281419l17a80a91xffce31ff20af873a%40mail.gmail.com&forum_name=nusoap-general

-- raj

Actions #5

Updated by Anonymous almost 16 years ago

Also occurs on some Motorola phones

Actions #6

Updated by Anonymous over 15 years ago

Well the above solution is inappropriate better would be something like this solution below. Some HTTP client libraries send a content-length = 0 which is somehow in line with the RFC. Its just a question of the interpretation. Apache deals with it in the same way.


if (con->request.content_length != 1 && con->request.content_length != 0) {

-- thomas.nicolai

Actions #7

Updated by Anonymous over 15 years ago

Sorry thats the right one

if (con->request.content_length != 1 && con>request.content_length != 0) {

Replying to thomas.nicolai@…:

Well the above solution is inappropriate better would be something like this solution below. Some HTTP client libraries send a content-length = 0 which is somehow in line with the RFC. Its just a question of the interpretation. Apache deals with it in the same way.

{{{
if (con->request.content_length != 1 && con->request.content_length != 0) {
}}}

Actions #8

Updated by stbuehler almost 14 years ago

  • Status changed from New to Duplicate
  • Assignee deleted (jan)
  • Priority changed from High to Normal
  • Target version deleted (1.5.0)
  • Missing in 1.5.x set to No
Actions

Also available in: Atom