From: john at keeping.me.uk (John Keeping)
Subject: [PATCH 1/1] ui-shared: Use CRLF in HTTP headers as per RFC 7230
Date: Wed, 11 May 2016 19:30:49 +0100 [thread overview]
Message-ID: <20160511183049.GA4296@serenity.lan> (raw)
In-Reply-To: <1462988931-10035-1-git-send-email-wub@partyvan.eu>
On Wed, May 11, 2016 at 05:48:51PM +0000, Juuso Lapinlampi wrote:
> CRLF is explicitly defined as the line break in the HTTP protocol
> specifications: RFC 2616 (obsolete) and RFC 7230.
Missing sign-off; see http://developercertificate.org/ for what this
means.
Otherwise,
Reviewed-by: John Keeping <john at keeping.me.uk>
> ---
> ui-shared.c | 24 ++++++++++++------------
> 1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/ui-shared.c b/ui-shared.c
> index 9a38aa9..b463375 100644
> --- a/ui-shared.c
> +++ b/ui-shared.c
> @@ -672,36 +672,36 @@ void cgit_print_http_headers(void)
> return;
>
> if (ctx.page.status)
> - htmlf("Status: %d %s\n", ctx.page.status, ctx.page.statusmsg);
> + htmlf("Status: %d %s\r\n", ctx.page.status, ctx.page.statusmsg);
> if (ctx.page.mimetype && ctx.page.charset)
> - htmlf("Content-Type: %s; charset=%s\n", ctx.page.mimetype,
> + htmlf("Content-Type: %s; charset=%s\r\n", ctx.page.mimetype,
> ctx.page.charset);
> else if (ctx.page.mimetype)
> - htmlf("Content-Type: %s\n", ctx.page.mimetype);
> + htmlf("Content-Type: %s\r\n", ctx.page.mimetype);
> if (ctx.page.size)
> - htmlf("Content-Length: %zd\n", ctx.page.size);
> + htmlf("Content-Length: %zd\r\n", ctx.page.size);
> if (ctx.page.filename) {
> html("Content-Disposition: inline; filename=\"");
> html_header_arg_in_quotes(ctx.page.filename);
> - html("\"\n");
> + html("\"\r\n");
> }
> if (!ctx.env.authenticated)
> - html("Cache-Control: no-cache, no-store\n");
> - htmlf("Last-Modified: %s\n", http_date(ctx.page.modified));
> - htmlf("Expires: %s\n", http_date(ctx.page.expires));
> + html("Cache-Control: no-cache, no-store\r\n");
> + htmlf("Last-Modified: %s\r\n", http_date(ctx.page.modified));
> + htmlf("Expires: %s\r\n", http_date(ctx.page.expires));
> if (ctx.page.etag)
> - htmlf("ETag: \"%s\"\n", ctx.page.etag);
> - html("\n");
> + htmlf("ETag: \"%s\"\r\n", ctx.page.etag);
> + html("\r\n");
> if (ctx.env.request_method && !strcmp(ctx.env.request_method, "HEAD"))
> exit(0);
> }
>
> void cgit_redirect(const char *url, bool permanent)
> {
> - htmlf("Status: %d %s\n", permanent ? 301 : 302, permanent ? "Moved" : "Found");
> + htmlf("Status: %d %s\r\n", permanent ? 301 : 302, permanent ? "Moved" : "Found");
> html("Location: ");
> html_url_path(url);
> - html("\n\n");
> + html("\r\n\r\n");
> }
>
> static void print_rel_vcs_link(const char *url)
> --
> 2.8.1
>
> _______________________________________________
> CGit mailing list
> CGit at lists.zx2c4.com
> http://lists.zx2c4.com/mailman/listinfo/cgit
next prev parent reply other threads:[~2016-05-11 18:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-11 17:48 wub
2016-05-11 18:30 ` john [this message]
2016-05-11 19:31 ` john
2016-05-11 19:38 ` wub
2016-05-11 19:57 ` john
2016-05-11 20:15 ` wub
2016-05-12 10:23 ` john
2016-05-12 15:45 ` Jason
2016-05-12 15:45 ` Jason
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160511183049.GA4296@serenity.lan \
--to=cgit@lists.zx2c4.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).