Bug 27277 - Print http response headers when in verbose mode.
Summary: Print http response headers when in verbose mode.
Status: RESOLVED FIXED
Alias: None
Product: elfutils
Classification: Unclassified
Component: debuginfod (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Noah Sanci
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-29 16:31 UTC by Frank Ch. Eigler
Modified: 2021-11-10 14:12 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Ch. Eigler 2021-01-29 16:31:27 UTC
There appear to exist use cases that intend to simply check for the existence of content in a debuginfod server, without actually downloading it.  In HTTP land, the HEAD operation is the natural expression of this.  We could support this in the webapi, and give options to debuginfod-find and the client API to use it.
Comment 1 Martin Liska 2021-02-01 08:47:15 UTC
I see the suggested functionality quite handy! Thanks.
Comment 2 Frank Ch. Eigler 2021-03-30 20:16:28 UTC
A related idea:
extend the webapi so that returned content includes response headers that identify the archive & file name where the content was extracted from.
For server privacy, maybe pass back just the basename.  The client API
would need to be extended to store those headers as extra strings a client could query.

All this can be used by smarter clients to identify in user-friendly ways the origin of the buildid.  For example:

 % debuginfod-find describe BUILDID
 [runs HEAD query, listens to extra Headers]
 length: 2879342938423 
 server: https://foo/bar
 x-archive: foo-bar-2.3.rpm
 x-file: bin/sudifusdf
Comment 3 Frank Ch. Eigler 2021-07-27 14:41:39 UTC
The initial #c0 impetus is now pretty moot with env DEBUGINFOD_MAXSIZE=0 support.  The server should give us a 404 or a 406 depending on whether the file exists, but not download content.

The #c2 "debuginfod-find describe ..." idea still may be interesting.
Comment 4 Noah Sanci 2021-09-27 18:52:36 UTC
Allow users, with enough verbosity, to print the HTTP response headers
upon retrieving a file. These files may include several custome http
response headers such as X-DEBUGINFOD-FILE, X-DEBUGINFOD-SIZE, and
X-DEBUGINFOD-ARCHIVE. These headers are added from the daemon, in
debuginfod.cxx.
    
E.g output:
    
HTTP/1.1 200 OK
Connection: Keep-Alive
Content-Length: 4095072
Cache-Control: public
Last-Modified: Thu, 09 Sep 2021 19:06:40 GMT
X-FILE: debuginfod
X-FILE-SIZE: 4095072
Content-Type: application/octet-stream
Date: Fri, 10 Sep 2021 16:38:06 GMT
Comment 5 Mark Wielaard 2021-11-10 14:12:34 UTC
commit ff5056c7d78b925fbd49997dc88183f6c859ac7f
Author: Noah Sanci <nsanci@redhat.com>
Date:   Tue Aug 10 11:21:35 2021 -0400

    debuginfod: PR27277 - Describe retrieved files when verbose
    
    Allow users, with enough verbosity, to print the HTTP response headers
    upon retrieving a file. These files may include several custome http
    response headers such as X-DEBUGINFOD-FILE, X-DEBUGINFOD-SIZE, and
    X-DEBUGINFOD-ARCHIVE. These headers are added from the daemon, in
    debuginfod.cxx.
    
    E.g output:
    
    HTTP/1.1 200 OK
    Connection: Keep-Alive
    Content-Length: 4095072
    Cache-Control: public
    Last-Modified: Thu, 09 Sep 2021 19:06:40 GMT
    X-FILE: debuginfod
    X-FILE-SIZE: 4095072
    Content-Type: application/octet-stream
    Date: Fri, 10 Sep 2021 16:38:06 GMT
    
    https://sourceware.org/bugzilla/show_bug.cgi?id=27277
    
    Signed-off-by: Noah Sanci <nsanci@redhat.com>