Changeset 93d4d8f


Ignore:
Timestamp:
2023-02-28T00:09:28Z (21 months ago)
Author:
GitHub <noreply@…>
Branches:
master
Children:
709f41f
Parents:
1bdc669
git-author:
Lalufu <Lalufu@…> (28-02-23 00:09:28)
git-committer:
GitHub <noreply@…> (28-02-23 00:09:28)
Message:

Handle HTTP 308 the same as 307 (#173)

This makes the HTTP client code handle status code 308 (Permanent
Redirect) in a similar manner to the already existing support for 307
(Temporary redirect). Like 307, no change of method is applied to the
redirect.

The use case for this has arisen from the bitlbee-mastodon plugin, the
Mastodon API returns 308 for some requests.

Co-authored-by: Ralf Ertzinger <ralf.ertzinger@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/http_client.c

    r1bdc669 r93d4d8f  
    494494
    495495        if (((req->status_code >= 301 && req->status_code <= 303) ||
    496              req->status_code == 307) && req->redir_ttl-- > 0) {
     496             req->status_code == 307 || req->status_code == 308) && req->redir_ttl-- > 0) {
    497497                char *loc, *new_request, *new_host;
    498498                int error = 0, new_port, new_proto;
     
    565565                           Well except someone at identi.ca's didn't bother reading any
    566566                           RFCs and just return HTTP/1.1-specific status codes to HTTP/1.0
    567                            requests. Fuckers. So here we are, handle 301..303,307. */
     567                           requests. Fuckers. So here we are, handle 301..303,307,308. */
    568568                        if (strncmp(req->request, "GET", 3) == 0) {
    569569                                /* GETs never become POSTs. */
     
    573573                                new_method = "GET";
    574574                        } else {
    575                                 /* 301 de-facto should stay POST, 307 specifally RFC 2616#10.3.8 */
     575                                /* 301 de-facto should stay POST, 307/308 specifally RFC 2616#10.3.8 */
    576576                                new_method = "POST";
    577577                        }
Note: See TracChangeset for help on using the changeset viewer.