git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] gitweb: Support comparing blobs (files) with different names

From
Jakub Narebski <jnareb@gmail.com>
Date
Apr 4, 2007, 21:27 UTC
Message-ID
<200704042327.49632.jnareb@gmail.com>
In-Reply-To
<200704031657.25698.jnareb@gmail.com>
On Tue, Apr 03, 2007 at 16:57 +0200, Jakub Narebski wrote:
Show 18 quoted lines
> On Sun, Apr 1, 2007, Junio C Hamano wrote:
>> Jakub Narebski <jnareb@gmail.com> writes:
>> 
>>>> First is not escaped filename in HTTP header. There was some discussion
>>>> about this, and even patch by Luben Tuikov which added to_qtext 
>>>> subroutine to deal with escaping in HTTP [...]
>>>
>>> Junio, do you remember by chance why this patch was dropped?
>> 
>> No, but I suspect that was because the noisiness of the thread
>> around them suggested they were not ready to be applied.  I do
>> not remember if people submitted the patch and commented on
>> reached a consensus.
> 
> Probably not. Here is alternative proposal. It does not implement
>   RFC2184: MIME Parameter Value and Encoded Word Extensions
> but I'm not sure if 1) it is needed for _HTTP_ Content-Disposition
> header filename, 2) all browsers implement it.
[...]
Show 6 quoted lines
> P.P.S. Here is an example of RFC2184 encoded header:
> 
>    Content-Type: application/x-stuff
>     title*1*=us-ascii'en'This%20is%20even%20more%20
>     title*2*=%2A%2A%2Afun%2A%2A%2A%20
>     title*3="isn't it!"
Another example:
  Content-Type: text/plain; charset=utf-8\r
  Content-Disposition: inline; filename*=utf-8'en-US'This%20is%0A%20%2A%2A%2Afun%2A%2A%2A
Although "RFC 2183: The Content-Disposition Header Field" says:
  Parameter values longer than 78 characters, or which contain non-ASCII
  characters, MUST be encoded as specified in [RFC 2184].

the limit of 78 characters is because it is was created for mail, and some old MUA had limit on line length. It is not the case of HTTP protocol: lines can be, and are, quite long. Besides for example Apache 2.0.54 does not understand MUA-style continued HTTP headers if in 'parse headers' mode: it returns server error.

As to browsers: Mozilla 1.7.12 implements RFC2183 correctly, although for example shows %0A / \n as a strange symbol in "save as" dialog, created file has embedded newline in filename, as it should. But both Lynx 2.8.5, and ELinks 0.10.3 do not implement it fully and without errors.

So that is why we have:
	# It not worth potential problems to try to carry newlines
	# in the header; it is just _suggested_ filename
	$filename =~ s/[[:cntrl:]\n\r]/_/g;

P.S. If there were no objections (no discussion), I'd resend content_disposition subroutine as patch to gitweb in about a week.

-- 
Jakub Narebski
ShadeHawk on #git
Poland
Previous: Jakub NarebskiNext: Junio C Hamano
Message 27 of 28 in “gitweb: show no difference message”
  1. gitweb: show no difference messageMartin Koegler, Mar 25, 2007
  2. gitweb: Support comparing blobs with different namesMartin Koegler, Mar 25, 2007
  3. gitweb: link base commit (hpb) to blobdiff outputMartin Koegler, Mar 25, 2007
  4. gitweb: support filename prefix in git_patchset_bodyMartin Koegler, Mar 25, 2007
  5. gitweb: support filename prefix in git_difftree_bodyMartin Koegler, Mar 25, 2007
  6. gitweb: Add treediffMartin Koegler, Mar 25, 2007
  7. Jakub NarebskiMar 26, 2007
  8. Martin KoeglerMar 26, 2007
  9. Jakub NarebskiMar 27, 2007
  10. Jakub NarebskiMar 26, 2007
  11. Martin KoeglerMar 26, 2007
  12. Jakub NarebskiMar 27, 2007
  13. gitweb: Support comparing blobs (files) with different namesJakub Narebski, Mar 26, 2007
  14. Martin KoeglerMar 26, 2007
  15. Jakub NarebskiMar 27, 2007
  16. Martin KoeglerMar 27, 2007
  17. Jakub NarebskiMar 27, 2007
  18. Martin KoeglerMar 28, 2007
  19. Jakub NarebskiMar 30, 2007
  20. Jakub NarebskiMar 30, 2007
  21. Martin KoeglerMar 31, 2007
  22. Jakub NarebskiMar 31, 2007
  23. gitweb: Fix bug in "blobdiff" view for split (e.g. file to symlink) patchesJakub Narebski, Mar 31, 2007
  24. Jakub NarebskiMar 26, 2007
  25. Jakub NarebskiMar 26, 2007
  26. Jakub NarebskiApr 3, 2007
  27. Jakub NarebskiApr 4, 2007
  28. Junio C HamanoApr 5, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.