libcurl is missing http2 support

Bug #1567697 reported by DocWilco
190
This bug affects 37 people
Affects Status Importance Assigned to Milestone
curl (Ubuntu)
Fix Released
High
Unassigned

Bug Description

libcurl supports HTTP/2.0 through libnghttp2, but the package on Ubuntu is not compiled with it.

Alternatively, a libcurl4-(gnutls|openssl)-nghttp2 might be a good idea.

See also: https://curl.haxx.se/docs/http2.html

curl CLI tool should not need an update, as it already has the commandline switches, but when you use them it comes back with unsupported protocol.

drwilco@eris:~$ curl --http2 www.google.com
curl: (1) Unsupported protocol

drwilco@eris:~$ lsb_release -rd
Description: Ubuntu Xenial Xerus (development branch)
Release: 16.04
root@eris:~# apt-cache policy libcurl3
libcurl3:
  Installed: 7.47.0-1ubuntu2
  Candidate: 7.47.0-1ubuntu2
  Version table:
 *** 7.47.0-1ubuntu2 500
        500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        100 /var/lib/dpkg/status

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in curl (Ubuntu):
status: New → Confirmed
Revision history for this message
Alvaro Figueroa (alvaro-greencore) wrote :

In 16.04 beta you only need to have the package libnghttp2-dev as a build-dep, download the ubuntu package source, recompile and installed the newly created package.

$ sudo apt-get build-dep curl
$ sudo apt-get install libnghttp2-dev
$ sudo apt-get source curl
$ sudo debian/rules binary
$ sudo dpkg -i *deb
(actually, you can only install the nss, gnutls or openssl version of the lib package. Let's go with openssl here)

$ curl --http2 -I nghttp2.org
HTTP/1.1 101 Switching Protocols
Connection: Upgrade
Upgrade: h2c

HTTP/2.0 200
date:Fri, 08 Apr 2016 22:19:10 GMT
content-type:text/html
content-length:6646
last-modified:Sun, 03 Apr 2016 06:53:14 GMT
etag:"5700bdda-19f6"
link:</stylesheets/screen.css>; rel=preload; as=stylesheet
accept-ranges:bytes
x-backend-header-rtt:0.00102
server:nghttpx nghttp2/1.10.0-DEV
via:2 nghttpx
x-frame-options:SAMEORIGIN
x-xss-protection:1; mode=block
x-content-type-options:nosniff

Revision history for this message
DocWilco (k-ubuntuone-m) wrote :

Thanks for that, that's a decent workaround for now :)

Revision history for this message
Alvaro Figueroa (alvaro-greencore) wrote :

To clarity, the ones that have conflict are libcurl4-gnutls and libcurl4-nss with libcurl4-openssl.

Do upgrade libcurl3-nss libcurl3-gnutls to get it working.

Revision history for this message
Alvaro Figueroa (alvaro-greencore) wrote :

This patch adds libnghttp2-dev to build-dep of the debian/contro file to fix broken support for curl. Tested on 16.04 beta.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "curl http2 fix" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
tags: added: xenial
Changed in curl (Ubuntu):
importance: Undecided → High
Revision history for this message
冯宇 (abcfy2) wrote :

When will this issue to be fixed?

Revision history for this message
Andriy Tymchenko (silpol) wrote :

time passes, new releases come, nothing changes

silpol@lorry:~$ curl --http2 www.google.com
curl: (1) Unsupported protocol

silpol@lorry:~$ lsb_release -rd
Description: Ubuntu 16.10
Release: 16.10

silpol@lorry:~$ apt-cache policy libcurl3
libcurl3:
  Installed: 7.50.1-1ubuntu1.1
  Candidate: 7.50.1-1ubuntu1.1
  Version table:
 *** 7.50.1-1ubuntu1.1 500
        500 http://fi.archive.ubuntu.com/ubuntu yakkety-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu yakkety-security/main amd64 Packages
        100 /var/lib/dpkg/status
     7.50.1-1ubuntu1 500
        500 http://fi.archive.ubuntu.com/ubuntu yakkety/main amd64 Packages

Revision history for this message
Andriy Tymchenko (silpol) wrote :

from -V key it looks like current curl in Yakkety is built with GnuTLS

silpol@lorry:~$ curl -V
curl 7.50.1 (x86_64-pc-linux-gnu) libcurl/7.50.1 GnuTLS/3.5.3 zlib/1.2.8 libidn/1.33 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP UnixSockets

Revision history for this message
kay (kay-diam) wrote :

Also looking for http2 curl support in Xenial

Revision history for this message
kay (kay-diam) wrote :

I had to backport from Debian Sid:

mkdir curl
wget http://http.debian.net/debian/pool/main/c/curl/curl_7.52.1-3.dsc http://http.debian.net/debian/pool/main/c/curl/curl_7.52.1.orig.tar.gz http://http.debian.net/debian/pool/main/c/curl/curl_7.52.1-3.debian.tar.xz
sudo apt-get install autoconf automake libgnutls28-dev libidn2-0-dev libkrb5-dev libldap2-dev libnss3-dev libpsl-dev librtmp-dev libtool quilt stunnel4 libnghttp2-dev libssh2-1-dev
cd curl-7.52.1
dpkg-buildpackage -b -j4
# if you want to skip tests
# DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -b -j4
sudo dpkg -i ../curl_7.52.1-3_amd64.deb ../libcurl3_7.52.1-3_amd64.deb

Revision history for this message
Fredrik Jonson (fredrik-jonson) wrote :

AFAICT http2 support is currently intentionally dropped from curl because the dependency nghttp2-dev is not in the 'main' archive, but in the community supported 'universe' archive.

Quoting the curl package changelog:

 curl (7.52.1-4ubuntu1) zesty; urgency=low

  * Merge from Debian unstable. Remaining changes:
    - Drop dependencies not in main:
      + Build-Depends: Drop libssh2-1-dev, and libnghttp2-dev.
      + Drop libssh2-1-dev from binary package Depends.
      + debian/control: drop --with-nghttp2

 -- Gianfranco Costamagna <email address hidden> Sun, 09 Apr 2017 13:07:51 +0200

 https://launchpad.net/ubuntu/+source/curl/+changelog#detail_curl_7.52.1-4ubuntu1

So, to resolve this issue it would seem that Canonical first must be convinced to take on official support for the nghttp2 package. Not sure how we're supposed to do that?

Cheering from the sideline has obviously not worked very well for this issue so far. :)

Revision history for this message
Mike Lund (mikelund) wrote :

> to resolve this issue it would seem that Canonical first must be convinced to take on official support for the nghttp2 package

Yes, how can we do this?

I find it crazy that Canonical doesn't want to officially support HTTP/2 in curl. Debian's curl is built with it for example. People shouldn't need to rebuild curl to have HTTP/2 support, it's not so experimental anymore.

Revision history for this message
Bootch (di-man) wrote :

Same is on Ubuntu 14.04.5 LTS.

tags: added: trusty
Revision history for this message
DocWilco (k-ubuntuone-m) wrote :

So I can kinda understand not wanting dependencies on packages not in the main repo. However, then why not create an additional package that does have support for it? There's already two packages to allow people to switch between GNUTLS and OpenSSL.

Revision history for this message
cc (codecrumb) wrote :

+1 for adding HTTP2 support. While we are asking for features, pls enable TCP Fast Open too in the compilation flags.

It's kind of sad that the curl that ships with macOS has more features enabled than in Ubuntu

Revision history for this message
Fredrik Jonson (fredrik-jonson) wrote :

It appears that this issue has been quietly resolved now:

  user@localhost:~$ dpkg -l libcurl4 curl|grep ii
  ii curl 7.61.0-1ubuntu2.3 amd64 command line tool for transferring data with URL syntax
  ii libcurl4:amd64 7.61.0-1ubuntu2.3 amd64 easy-to-use client-side URL transfer library (OpenSSL flavour)

  user@localhost:~$ curl -I --http2 https://http2.akamai.com/demo|tee
    % Total % Received % Xferd Average Speed Time Time Time Current
                                   Dload Upload Total Spent Left Speed
    0 2421 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
  HTTP/2 200
  server: Apache
  etag: "07ce30bc53aa7834dff55f92a6d05a56:1466062139"
  last-modified: Thu, 16 Jun 2016 07:28:59 GMT
  content-length: 2421
  content-type: text/html
  rtt: 14
  myproto: h2
  protocol_negotiation: h2
  expires: Fri, 12 Apr 2019 09:27:25 GMT
  date: Fri, 12 Apr 2019 09:27:25 GMT
  cache-control: max-age=0, no-cache, no-store
  pragma: no-cache
  ...

Thank you, to whoever made it happen! :)

Changed in curl (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.