Skip to content
This repository was archived by the owner on Jan 2, 2023. It is now read-only.
This repository was archived by the owner on Jan 2, 2023. It is now read-only.

Bad User-Agent trigger HTTP400 Bad Request #3476

@pierroot

Description

@pierroot

Hi,

Debian 8.6
wkhtmltox-0.12.2.1_linux-jessie-amd64.deb 
PHP Wrapper :  https://github.com/mreiferson/php-wkhtmltox 

We issue bad user agent when requesting elements from html. E.g :
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.34 (KHTML, like Gecko) \x05?\x7f Safari/534.34

The part \x05?\x7f are supposed to be like wkhtmltopdf/version

In some case, it occurs serious problem and qe have blanck image on pdf because UserAgent trigger a HTTP400 Bad Request. E.g here the random part contain a /n or /r characters so that UA split on 2 header lines :

  • UserAgent is User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.34 (KHTML, like Gecko)
  • . Safari/534.34 (is the bad http header that trigger the HTTP 400)
GET /media/catalog/product/cache/2/image_facing/9df78eab33525d08d6e5fb8d27136e95/BCZ101/i/m/someimage.jpg HTTP/1.1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.34 (KHTML, like Gecko) 
. Safari/534.34
Accept: */*
Connection: Keep-Alive
Accept-Encoding: gzip
Accept-Language: en-US,*
Host: **********

Have you any idea to resolve this ?
Thank you,
Pierre

Infos about dependancies packages :


$ dpkg -l |grep qt
rc  libqt5core5a:amd64                    5.3.2+dfsg-4+deb8u1         amd64        Qt 5 core module
rc  libqt5dbus5:amd64                     5.3.2+dfsg-4+deb8u1         amd64        Qt 5 D-Bus module
rc  libqt5gui5:amd64                      5.3.2+dfsg-4+deb8u1         amd64        Qt 5 GUI module
rc  libqt5network5:amd64                  5.3.2+dfsg-4+deb8u1         amd64        Qt 5 network module
rc  libqt5opengl5:amd64                   5.3.2+dfsg-4+deb8u1         amd64        Qt 5 OpenGL module
rc  libqt5printsupport5:amd64             5.3.2+dfsg-4+deb8u1         amd64        Qt 5 print support module
rc  libqt5qml5:amd64                      5.3.2-4                     amd64        Qt 5 QML module
rc  libqt5quick5:amd64                    5.3.2-4                     amd64        Qt 5 Quick library
rc  libqt5sql5:amd64                      5.3.2+dfsg-4+deb8u1         amd64        Qt 5 SQL module
rc  libqt5svg5:amd64                      5.3.2-2                     amd64        Qt 5 SVG module
rc  libqt5webkit5:amd64                   5.3.2+dfsg-4                amd64        Web content engine library for Qt
rc  libqt5widgets5:amd64                  5.3.2+dfsg-4+deb8u1         amd64        Qt 5 widgets module
rc  libqt5xmlpatterns5:amd64              5.3.2-2                     amd64        Qt 5 XML patterns module

$ dpkg -l |grep x11
ii  libx11-6:amd64                        2:1.6.2-3                   amd64        X11 client-side library
ii  libx11-data                           2:1.6.2-3                   all          X11 client-side library
ii  libx11-dev:amd64                      2:1.6.2-3                   amd64        X11 client-side library (development headers)
ii  libx11-xcb1:amd64                     2:1.6.2-3                   amd64        Xlib/XCB interface library
rc  libxkbcommon-x11-0:amd64              0.4.3-2                     amd64        library to create keymaps with the XKB X11 protocol
ii  x11-common                            1:7.7+7                     all          X Window System (X.Org) infrastructure
ii  x11-xkb-utils                         7.7+1                       amd64        X11 XKB utilities
ii  x11proto-core-dev                     7.0.26-1                    all          X11 core wire protocol and auxiliary headers
ii  x11proto-input-dev                    2.3.1-1                     all          X11 Input extension wire protocol
ii  x11proto-kb-dev                       1.0.6-2                     all          X11 XKB extension wire protocol
ii  x11proto-render-dev                   2:0.11.1-2                  all          X11 Render extension wire protocol
ii  x11proto-xext-dev                     7.3.0-1                     all          X11 various extension wire protocol

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions