Bug #2303

duktape fails to send headers in POST request while spidermonkey does it properly

Added by Leonid Protasov over 6 years ago. Updated over 6 years ago.

Status:FixedStart date:10/30/2014
Priority:NormalDue date:
Assignee:Andreas Smas% Done:

100%

Category:API
Target version:4.8
Found in version:Latest BE Platform:Linux

Description

You can reproduce it while using searcher over docu.im plugin.
I do this like:

             var response = showtime.JSONDecode(showtime.httpReq(BASE_URL + '/search/result', {
                 headers: {
                     'X-Requested-With': 'XMLHttpRequest'
                 },
                 postdata: {
                     'viewAs': 'list',
                     'p': fromPage,
                     'f': '{"title":"' + query + '","genres":[],"directors":[],"actors":[],"countries":[],"studios":[]}'
                 }
             }));

duktape
HTTP [DEBUG]: > POST /search/result HTTP/1.1
HTTP [DEBUG]: > Content-Type: application/x-www-form-urlencoded
HTTP [DEBUG]: > Content-Length: 175
HTTP [DEBUG]: > User-Agent: Showtime Linux/x86_64 4.7.410.g50693
HTTP [DEBUG]: > Connection: keep-alive
HTTP [DEBUG]: > Accept: */*
HTTP [DEBUG]: > Accept-Encoding: identity
HTTP [DEBUG]: > Host: docu.im
HTTP-POSTDATA [DEBUG]: 0x000000: 76 69 65 77 41 73 3d 6c  69 73 74 26 70 3d 31 26    viewAs=list&p=1&
HTTP-POSTDATA [DEBUG]: 0x000010: 66 3d 25 37 42 25 32 32  74 69 74 6c 65 25 32 32    f=%7B%22title%22
HTTP-POSTDATA [DEBUG]: 0x000020: 25 33 41 25 32 32 74 65  73 74 25 32 32 25 32 43    %3A%22test%22%2C
HTTP-POSTDATA [DEBUG]: 0x000030: 25 32 32 67 65 6e 72 65  73 25 32 32 25 33 41 25    %22genres%22%3A%
HTTP-POSTDATA [DEBUG]: 0x000040: 35 42 25 35 44 25 32 43  25 32 32 64 69 72 65 63    5B%5D%2C%22direc
HTTP-POSTDATA [DEBUG]: 0x000050: 74 6f 72 73 25 32 32 25  33 41 25 35 42 25 35 44    tors%22%3A%5B%5D
HTTP-POSTDATA [DEBUG]: 0x000060: 25 32 43 25 32 32 61 63  74 6f 72 73 25 32 32 25    %2C%22actors%22%
HTTP-POSTDATA [DEBUG]: 0x000070: 33 41 25 35 42 25 35 44  25 32 43 25 32 32 63 6f    3A%5B%5D%2C%22co
HTTP-POSTDATA [DEBUG]: 0x000080: 75 6e 74 72 69 65 73 25  32 32 25 33 41 25 35 42    untries%22%3A%5B
HTTP-POSTDATA [DEBUG]: 0x000090: 25 35 44 25 32 43 25 32  32 73 74 75 64 69 6f 73    %5D%2C%22studios
HTTP-POSTDATA [DEBUG]: 0x0000a0: 25 32 32 25 33 41 25 35  42 25 35 44 25 37 44       %22%3A%5B%5D%7D
HTTP [DEBUG]: http://docu.im/search/result: Response:
HTTP [DEBUG]: < HTTP/1.1 403 CHttpException
HTTP [DEBUG]: < Server: nginx
HTTP [DEBUG]: < Date: Thu, 30 Oct 2014 21:46:57 GMT
HTTP [DEBUG]: < Content-Type: text/html
HTTP [DEBUG]: < Transfer-Encoding: chunked
HTTP [DEBUG]: < Connection: keep-alive
HTTP [DEBUG]: < Keep-Alive: timeout=20
HTTP [DEBUG]: < Vary: Accept-Encoding
HTTP [DEBUG]: < X-Powered-By: PHP/5.3.3
HTTP [DEBUG]: < Set-Cookie: PHPSESSID=b5nh2g7ksbfts7e50c5d62hdi4; path=/
HTTP [DEBUG]: Updating cookie name=PHPSESSID path=/ domain=docu.im value=b5nh2g7ksbfts7e50c5d62hdi4 expires in -1 seconds
HTTP [DEBUG]: < Expires: Thu, 19 Nov 1981 08:52:00 GMT
HTTP [DEBUG]: < Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
HTTP [DEBUG]: < Pragma: no-cache
HTTP [DEBUG]: < 

spidermonkey:

HTTP [DEBUG]: > POST /search/result HTTP/1.1
HTTP [DEBUG]: > X-Requested-With: XMLHttpRequest
HTTP [DEBUG]: > Content-Type: application/x-www-form-urlencoded
HTTP [DEBUG]: > Content-Length: 175
HTTP [DEBUG]: > User-Agent: Showtime Linux/x86_64 4.7.410.g50693
HTTP [DEBUG]: > Connection: keep-alive
HTTP [DEBUG]: > Accept: */*
HTTP [DEBUG]: > Accept-Encoding: identity
HTTP [DEBUG]: > Host: docu.im
HTTP-POSTDATA [DEBUG]: 0x000000: 76 69 65 77 41 73 3d 6c  69 73 74 26 70 3d 31 26    viewAs=list&p=1&
HTTP-POSTDATA [DEBUG]: 0x000010: 66 3d 25 37 42 25 32 32  74 69 74 6c 65 25 32 32    f=%7B%22title%22
HTTP-POSTDATA [DEBUG]: 0x000020: 25 33 41 25 32 32 74 65  73 74 25 32 32 25 32 43    %3A%22test%22%2C
HTTP-POSTDATA [DEBUG]: 0x000030: 25 32 32 67 65 6e 72 65  73 25 32 32 25 33 41 25    %22genres%22%3A%
HTTP-POSTDATA [DEBUG]: 0x000040: 35 42 25 35 44 25 32 43  25 32 32 64 69 72 65 63    5B%5D%2C%22direc
HTTP-POSTDATA [DEBUG]: 0x000050: 74 6f 72 73 25 32 32 25  33 41 25 35 42 25 35 44    tors%22%3A%5B%5D
HTTP-POSTDATA [DEBUG]: 0x000060: 25 32 43 25 32 32 61 63  74 6f 72 73 25 32 32 25    %2C%22actors%22%
HTTP-POSTDATA [DEBUG]: 0x000070: 33 41 25 35 42 25 35 44  25 32 43 25 32 32 63 6f    3A%5B%5D%2C%22co
HTTP-POSTDATA [DEBUG]: 0x000080: 75 6e 74 72 69 65 73 25  32 32 25 33 41 25 35 42    untries%22%3A%5B
HTTP-POSTDATA [DEBUG]: 0x000090: 25 35 44 25 32 43 25 32  32 73 74 75 64 69 6f 73    %5D%2C%22studios
HTTP-POSTDATA [DEBUG]: 0x0000a0: 25 32 32 25 33 41 25 35  42 25 35 44 25 37 44       %22%3A%5B%5D%7D
HTTP [DEBUG]: http://docu.im/search/result: Response:
HTTP [DEBUG]: < HTTP/1.1 200 OK
HTTP [DEBUG]: < Server: nginx
HTTP [DEBUG]: < Date: Thu, 30 Oct 2014 21:48:34 GMT
HTTP [DEBUG]: < Content-Type: text/html
HTTP [DEBUG]: < Transfer-Encoding: chunked
HTTP [DEBUG]: < Connection: keep-alive
HTTP [DEBUG]: < Keep-Alive: timeout=20
HTTP [DEBUG]: < Vary: Accept-Encoding
HTTP [DEBUG]: < X-Powered-By: PHP/5.3.3
HTTP [DEBUG]: < Set-Cookie: PHPSESSID=736inc8u9g2qs2g5roh3v41gl6; path=/
HTTP [DEBUG]: Updating cookie name=PHPSESSID path=/ domain=docu.im value=736inc8u9g2qs2g5roh3v41gl6 expires in -1 seconds
HTTP [DEBUG]: < Expires: Thu, 19 Nov 1981 08:52:00 GMT
HTTP [DEBUG]: < Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
HTTP [DEBUG]: < Pragma: no-cache
HTTP [DEBUG]: < 

Associated revisions

Revision 9e90b299
Added by Andreas Smas over 6 years ago

ecmascript/http: Add missing support for HTTP headers

Fixes #2303

Change included in version 4.7.415

History

#1 Updated by Andreas Smas over 6 years ago

  • Status changed from New to Fixed
  • % Done changed from 0 to 100

Also available in: Atom PDF