Replies: 3 comments 2 replies
-
I currently work around this by providing a callback to git_trace_set at the GIT_TRACE_TRACE level once the credentials callback is called. The callback logs the trace output (which includes the http response) in a thread local global variable. If the parent function call errors with GIT_ERROR_HTTP I then parse the trace output if there is any and forward the body onto the user. There was a stackoverflow post about this https://stackoverflow.com/q/69239067/676575, I think the suggestion was to perhaps add a new callback. |
Beta Was this translation helpful? Give feedback.
-
I thought about using a separate callback (or reusing |
Beta Was this translation helpful? Give feedback.
-
Hmm yeah I think that the reason that we avoid parsing the body is that it's not helpful for us. There's no structured data in there. But if you want to intuit meaning from it because you know that you're hitting GitHub (for example) then that makes sense. It's a pity that they don't put this output in a header or something that doesn't require screen-scraping the html response. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When an http server responds with an authentication error, the response body sometimes contains a useful message. For example, the one I'm dealing with is GitHub saying "Support for password authentication was removed".
I want to be able to display this message to the user, which would require changes to the credentials callback. The server message would have to be added, and the way the response is handled would also have to be changed. Currently,
http_stream_read()
doesn't even parse the body until after the credentials callback is called.Any thoughts on how to approach this, beyond simply parsing the body sooner and adding it to the callback?
Beta Was this translation helpful? Give feedback.
All reactions