Skip to content
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

"InvalidResponse: invalid header" error on some websites #94

Closed
Shnatsel opened this issue Feb 16, 2021 · 1 comment · Fixed by #97
Closed

"InvalidResponse: invalid header" error on some websites #94

Shnatsel opened this issue Feb 16, 2021 · 1 comment · Fixed by #97

Comments

@Shnatsel
Copy link

On some websites, e.g. http://opentrainer.ru, attohttpc fails with the following error:

InvalidResponse: invalid header

Firefox and curl work fine.

32 websites out of the top million from Feb 3 Tranco list are affected.

Tested using this code. Test tool output from all affected websites: atto-invalid-header.tar.gz

@adamreichold
Copy link
Contributor

The linked site contains a multi-line continuation of a header value

Content-Security-Policy: script-src 'self' 'unsafe-inline' 'unsafe-eval' 
      https://staticxx.facebook.com 
      https://connect.facebook.net/ 
      https://tagmanager.google.com/ 
      https://www.googletagmanager.com/ 
      https://www.google-analytics.com/ 
      https://vk.com/ 
      https://mc.yandex.ru/ 
      https://top-fwz1.mail.ru/ 
      https://static.criteo.net/ 
      https://yastatic.net/s3/metrika/
      https://sslwidget.criteo.com/
      https://apis.google.com/
      https://cdn.ampproject.org/v0.js
      https://cdn.ampproject.org/v0/amp-sidebar-0.1.js
      https://cdn.ampproject.org/v0/amp-form-0.1.js
      https://cdn.ampproject.org/v0/amp-accordion-0.1.js;
    frame-src 'self' 'unsafe-eval' 'unsafe-inline'
      https://www.opentrainer.ru
      https://mc.webvisor.com 
      https://mc.webvisor.org 
      http://webvisor.com
      https://mc.yandex.ru 
      https://www.opentrainer.ru/trainer-api/school/singlegame/ 
      http://www.adobe.com/go/getflashplayer 
      https://www.facebook.com/tr/ 
      https://staticxx.facebook.com/connect/xd_arbiter/r/
      https://www.youtube.com/embed/ 
      https://i.ytimg.com/vi/
      https://vk.com/widget_community.php
      https://www.facebook.com/v2.6/plugins/
      https://www.youtube.com/subscribe_embed
      https://accounts.google.com/o/oauth2/postmessageRelay
      https://9215081.fls.doubleclick.net/;
    frame-ancestors 'self' http://webvisor.com;
    style-src 'self' 'unsafe-inline' 
      https://tagmanager.google.com/
      https://fonts.googleapis.com/;
    img-src 'self' 'unsafe-inline' 'unsafe-eval'
      https://s3.open-broker.ru/
      https://opentrainer.ru/images/tinymce/
      https://ssl.gstatic.com/
      https://vk.com/
      https://www.google-analytics.com/
      https://pixel.open-broker.ru/ 
      https://stats.g.doubleclick.net/
      https://www.google.com/ads/
      https://www.google.ru/ads/
      https://www.facebook.com/tr/
      https://mc.yandex.ru/clmap/
      https://www.googletagmanager.com/
      https://i.ytimg.com/vi/
      https://mc.yandex.ru/metrika/
Referrer-Policy: no-referrer-when-downgrade

While Firefox and cURL still parse line-folded headers like these, the HTTP specification seems to have deprecated them stating that new implementation should not produce them. Crates like httparse seem to have decided to not support them at all due to this, c.f. seanmonstar/httparse#68

#97 contains a quick fix, but again I am not convinced that we should bloat attohttpc to support obsolete functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants