New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad User-Agent trigger HTTP400 Bad Request #3476

Closed
pierroot opened this Issue May 17, 2017 · 4 comments

Comments

Projects
None yet
4 participants
@pierroot

pierroot commented May 17, 2017

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

@pierroot pierroot changed the title from Bad User-Agent to Bad User-Agent trigger HTTP400 Bad Request May 17, 2017

@pierroot

This comment has been minimized.

pierroot commented May 18, 2017

Fyi, have updated the lib to latest 0.12.4 and have same bug.

@Jbz797

This comment has been minimized.

Jbz797 commented Apr 13, 2018

Same here.

julego added a commit to julego/wkhtmltopdf that referenced this issue Apr 14, 2018

julego added a commit to julego/wkhtmltopdf that referenced this issue Apr 14, 2018

@julego

This comment has been minimized.

Contributor

julego commented Apr 14, 2018

Should be fixed by PR #3878

ashkulz added a commit that referenced this issue Apr 29, 2018

@ashkulz ashkulz added the Fixed label May 30, 2018

@ashkulz ashkulz added this to the 0.12.5 milestone May 30, 2018

@ashkulz

This comment has been minimized.

Member

ashkulz commented May 30, 2018

A release candidate is available which includes the fixes made in #3878 -- please test and report your findings before the final release.

@ashkulz ashkulz closed this May 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment