mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
dirmngr: Extended the http_get_header function.
* dirmngr/http.c (send_request): Add arg 'skip'. Adjust all callers. -- GnuPG-bug-id: 6719
This commit is contained in:
parent
52b7a60cf9
commit
53bdb7440c
6 changed files with 23 additions and 14 deletions
|
@ -2845,18 +2845,27 @@ store_header (http_t hd, char *line)
|
|||
|
||||
|
||||
/* Return the header NAME from the last response. The returned value
|
||||
is valid as along as HD has not been closed and no other request
|
||||
has been send. If the header was not found, NULL is returned. NAME
|
||||
must be canonicalized, that is the first letter of each dash
|
||||
delimited part must be uppercase and all other letters lowercase. */
|
||||
* is valid as along as HD has not been closed and no other request
|
||||
* has been send. If the header was not found, NULL is returned. NAME
|
||||
* must be canonicalized, that is the first letter of each dash
|
||||
* delimited part must be uppercase and all other letters lowercase.
|
||||
* SKIP gives the number of entries of the requested NAME to skip
|
||||
* before returning; this can be used to enumerate headers with the
|
||||
* same name (see store_header).
|
||||
*/
|
||||
const char *
|
||||
http_get_header (http_t hd, const char *name)
|
||||
http_get_header (http_t hd, const char *name, unsigned int skip)
|
||||
{
|
||||
header_t h;
|
||||
|
||||
for (h=hd->headers; h; h = h->next)
|
||||
if ( !strcmp (h->name, name) )
|
||||
return h->value;
|
||||
if (!strcmp (h->name, name))
|
||||
{
|
||||
if (skip)
|
||||
skip--;
|
||||
else
|
||||
return h->value;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -2979,7 +2988,7 @@ parse_response (http_t hd)
|
|||
cookie->content_length_valid = 0;
|
||||
if (!(hd->flags & HTTP_FLAG_IGNORE_CL))
|
||||
{
|
||||
s = http_get_header (hd, "Content-Length");
|
||||
s = http_get_header (hd, "Content-Length", 0);
|
||||
if (s)
|
||||
{
|
||||
cookie->content_length_valid = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue