git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* protocol: add Accept-Language header if possible
@ 2022-06-02  3:18 lilinchao
  2022-06-03 18:33 ` lilinchao
  0 siblings, 1 reply; 4+ messages in thread
From: lilinchao @ 2022-06-02  3:18 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

Git server end's ability to accept Accept-Language header was introduced in f18604bbf2(http: add Accept-Language header if possible)
but it seems that only refs discovering stage has this ability:
"
╰─$ GIT_CURL_VERBOSE=1 git ls-remote
...
10:42:36.939108 http.c:623              => Send header: GET /opensource/test.git/info/refs?service=git-upload-pack HTTP/1.1
10:42:36.939112 http.c:623              => Send header: Host: gitee.com
10:42:36.939114 http.c:623              => Send header: User-Agent: git/2.35.1.102.g2b9c120970
10:42:36.939116 http.c:623              => Send header: Accept: */*
10:42:36.939117 http.c:623              => Send header: Accept-Encoding: deflate, gzip
10:42:36.939118 http.c:623              => Send header: Accept-Language: en-US, *;q=0.9
10:42:36.939120 http.c:623              => Send header: Pragma: no-cache
10:42:36.939121 http.c:623              => Send header: Git-Protocol: version=2
10:42:36.939123 http.c:623              => Send header:
...
10:42:36.999012 http.c:611              => Send header, 0000000302 bytes (0x0000012e)
10:42:36.999034 http.c:623              => Send header: GET /opensource/test.git/info/refs?service=git-upload-pack HTTP/1.1
10:42:36.999039 http.c:623              => Send header: Host: gitee.com
10:42:36.999041 http.c:623              => Send header: Authorization: Basic <redacted>
10:42:36.999042 http.c:623              => Send header: User-Agent: git/2.35.1.102.g2b9c120970
10:42:36.999044 http.c:623              => Send header: Accept: */*
10:42:36.999063 http.c:623              => Send header: Accept-Encoding: deflate, gzip
10:42:36.999081 http.c:623              => Send header: Accept-Language: en-US, *;q=0.9
10:42:36.999101 http.c:623              => Send header: Pragma: no-cache
10:42:36.999105 http.c:623              => Send header: Git-Protocol: version=2
10:42:36.999106 http.c:623              => Send header:
...
10:42:37.098325 http.c:611              => Send header, 0000000341 bytes (0x00000155)
10:42:37.098368 http.c:623              => Send header: POST /opensource/test.git/git-upload-pack HTTP/1.1
10:42:37.098377 http.c:623              => Send header: Host: gitee.com
10:42:37.098381 http.c:623              => Send header: Authorization: Basic <redacted>
10:42:37.098384 http.c:623              => Send header: User-Agent: git/2.35.1.102.g2b9c120970
10:42:37.098387 http.c:623              => Send header: Accept-Encoding: deflate, gzip
10:42:37.098417 http.c:623              => Send header: Content-Type: application/x-git-upload-pack-request
10:42:37.098421 http.c:623              => Send header: Accept: application/x-git-upload-pack-result
10:42:37.098425 http.c:623              => Send header: Git-Protocol: version=2
10:42:37.098428 http.c:623              => Send header: Content-Length: 118
10:42:37.098431 http.c:623              => Send header:
...
"
Why git-upload-pack/git-receive-pack stage doesn't enable this ability?


--------------
lilinchao@oschina.cn

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: protocol: add Accept-Language header if possible
  2022-06-02  3:18 protocol: add Accept-Language header if possible lilinchao
@ 2022-06-03 18:33 ` lilinchao
  2022-06-03 19:09   ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: lilinchao @ 2022-06-03 18:33 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

>Git server end's ability to accept Accept-Language header was introduced in f18604bbf2(http: add Accept-Language header if possible)
>but it seems that only refs discovering stage has this ability:
>"
>╰─$ GIT_CURL_VERBOSE=1 git ls-remote
>...
>10:42:36.939108 http.c:623              => Send header: GET /opensource/test.git/info/refs?service=git-upload-pack HTTP/1.1
>10:42:36.939112 http.c:623              => Send header: Host: gitee.com
>10:42:36.939114 http.c:623              => Send header: User-Agent: git/2.35.1.102.g2b9c120970
>10:42:36.939116 http.c:623              => Send header: Accept: */*
>10:42:36.939117 http.c:623              => Send header: Accept-Encoding: deflate, gzip
>10:42:36.939118 http.c:623              => Send header: Accept-Language: en-US, *;q=0.9
>10:42:36.939120 http.c:623              => Send header: Pragma: no-cache
>10:42:36.939121 http.c:623              => Send header: Git-Protocol: version=2
>10:42:36.939123 http.c:623              => Send header:
>...
>10:42:36.999012 http.c:611              => Send header, 0000000302 bytes (0x0000012e)
>10:42:36.999034 http.c:623              => Send header: GET /opensource/test.git/info/refs?service=git-upload-pack HTTP/1.1
>10:42:36.999039 http.c:623              => Send header: Host: gitee.com
>10:42:36.999041 http.c:623              => Send header: Authorization: Basic <redacted>
>10:42:36.999042 http.c:623              => Send header: User-Agent: git/2.35.1.102.g2b9c120970
>10:42:36.999044 http.c:623              => Send header: Accept: */*
>10:42:36.999063 http.c:623              => Send header: Accept-Encoding: deflate, gzip
>10:42:36.999081 http.c:623              => Send header: Accept-Language: en-US, *;q=0.9
>10:42:36.999101 http.c:623              => Send header: Pragma: no-cache
>10:42:36.999105 http.c:623              => Send header: Git-Protocol: version=2
>10:42:36.999106 http.c:623              => Send header:
>...
>10:42:37.098325 http.c:611              => Send header, 0000000341 bytes (0x00000155)
>10:42:37.098368 http.c:623              => Send header: POST /opensource/test.git/git-upload-pack HTTP/1.1
>10:42:37.098377 http.c:623              => Send header: Host: gitee.com
>10:42:37.098381 http.c:623              => Send header: Authorization: Basic <redacted>
>10:42:37.098384 http.c:623              => Send header: User-Agent: git/2.35.1.102.g2b9c120970
>10:42:37.098387 http.c:623              => Send header: Accept-Encoding: deflate, gzip
>10:42:37.098417 http.c:623              => Send header: Content-Type: application/x-git-upload-pack-request
>10:42:37.098421 http.c:623              => Send header: Accept: application/x-git-upload-pack-result
>10:42:37.098425 http.c:623              => Send header: Git-Protocol: version=2
>10:42:37.098428 http.c:623              => Send header: Content-Length: 118
>10:42:37.098431 http.c:623              => Send header:
>...
>"
>Why git-upload-pack/git-receive-pack stage doesn't enable this ability?
>
Can anyone tell me if this design is intentional.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: protocol: add Accept-Language header if possible
  2022-06-03 18:33 ` lilinchao
@ 2022-06-03 19:09   ` Junio C Hamano
  2022-06-04  5:46     ` lilinchao
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2022-06-03 19:09 UTC (permalink / raw)
  To: lilinchao; +Cc: git

"lilinchao@oschina.cn" <lilinchao@oschina.cn> writes:

I am not your personal help-desk.  Please don't Cc: questions to me
unless it is a piece of code I wrote and am familiar with.

But since you added an explicit CC, let me try.  Do not expect any
high quality answers, though.

>>Git server end's ability to accept Accept-Language header was
>>introduced in f18604bbf2(http: add Accept-Language header if
>>possible) but it seems that only refs discovering stage has this
>>ability:

I do not think we do anything special on the server end.  The said
commit taught client side to learn end-user's locale and throw
accept-language header at the other side.

I am not sure how much it helps in the smart HTTP, especially in
later phases of the transfer, in the first place.  Back in dumb HTTP
walker days, a failure to fetch single object would have resulted in
an error message generated by the webserver directly shown at the
client end, but is that still true even if we use the smart HTTP to
encapsulate the git native protocol exchange?

I highly suspect that any calls to get_accept_language() helper, or
failure to call it, in the smart HTTP codepath is not something
designed but just happened by accident.  If it helps to issue the
header to various requests, I think it would be good for
consistency.  Anything that uses http.c::http_request() should get
the header for free, so depending on the reason why some requests do
not use it, adding it might involve some refactoring, though.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Re: protocol: add Accept-Language header if possible
  2022-06-03 19:09   ` Junio C Hamano
@ 2022-06-04  5:46     ` lilinchao
  0 siblings, 0 replies; 4+ messages in thread
From: lilinchao @ 2022-06-04  5:46 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git


>"lilinchao@oschina.cn" <lilinchao@oschina.cn> writes:
>
>I am not your personal help-desk.  Please don't Cc: questions to me
>unless it is a piece of code I wrote and am familiar with.
First of all, sorry to disturb you, I thought you're the person most familiar
with those codes :)
This is not just a question, as I am planing to do some work on git to let
server side know the client end locale info for every HTTP request, this is
very helpful for many non-English speakers to understand what happened
when git throw some error messages.
But first I want to know if it is worth doing, and I'm curious to know
the original design purpose, especially when I see inconsistent behavior,
so I came here for help.
>But since you added an explicit CC, let me try.  Do not expect any
>high quality answers, though.
>
Thanks a lot
PS: I've tried to Cc Yi EungJun <eungjun.yi@navercorp.com> but my email
was returned, because "The receiving address does not exist, or the receiving
address is disabled.". So I don't know who I should Cc to now.

>>>Git server end's ability to accept Accept-Language header was
>>>introduced in f18604bbf2(http: add Accept-Language header if
>>>possible) but it seems that only refs discovering stage has this
>>>ability:
>
>I do not think we do anything special on the server end.  The said
>commit taught client side to learn end-user's locale and throw
>accept-language header at the other side.
>
>I am not sure how much it helps in the smart HTTP, especially in
>later phases of the transfer, in the first place.  Back in dumb HTTP
>walker days, a failure to fetch single object would have resulted in
>an error message generated by the webserver directly shown at the
>client end, but is that still true even if we use the smart HTTP to
>encapsulate the git native protocol exchange?
>
>I highly suspect that any calls to get_accept_language() helper, or
>failure to call it, in the smart HTTP codepath is not something
>designed but just happened by accident.  If it helps to issue the
>header to various requests, I think it would be good for
>consistency.  Anything that uses http.c::http_request() should get
>the header for free, so depending on the reason why some requests do
>not use it, adding it might involve some refactoring, though.

I think every HTTP request from git client should send this header to server
end, to tell the server which language it prefers, this would be very friendly
for user end.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-04  5:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-02  3:18 protocol: add Accept-Language header if possible lilinchao
2022-06-03 18:33 ` lilinchao
2022-06-03 19:09   ` Junio C Hamano
2022-06-04  5:46     ` lilinchao

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).