| Ticket UUID: | c46b0f7bb7241a02a7165f108206f866e0f3f7b3 | ||
| Title: | Support HTTP Basic Auth for sync operations | ||
| Status: | Open | Type: | Feature_Request |
| Severity: | Severe | Priority: | |
| Subsystem: | Resolution: | ||
| Last Modified: | 2011-04-13 19:29:34 | ||
| Version Found In: | 2011-04-13 12:05:18 | ||
| Description & Comments: | |||
|
HTTP Basic Auth needs to be supported for sync operations in order to be compatible with any kind of user validation done by the web server hosting fossil.
A patch was provided (6 lines of code) by mightyhe on Sun, 27 Mar 2011 07:45:06 -0700 and may be accessed at: http://www.mail-archive.com/fossil-users@lists.fossil-scm.org/msg04219.html and for convenience is included here (NOTE: a fix for an incorrect line terminator on the Proxy-Authorization header is also mixed in with this patch):
Index: src/http.c
===================================================================
--- src/http.c
+++ src/http.c
@@ -105,11 +105,19 @@
}else{
zSep = "/";
}
blob_appendf(pHdr, "POST %s%sxfer/xfer HTTP/1.0\r\n", g.urlPath, zSep);
if( g.urlProxyAuth ){
- blob_appendf(pHdr, "Proxy-Authorization: %s\n", g.urlProxyAuth);
+ blob_appendf(pHdr, "Proxy-Authorization: %s\r\n", g.urlProxyAuth);
+ }
+ // Basic HTTP Authorization
+ if( g.urlUser && g.urlUser[0] && g.urlPasswd ){
+ char *zpw = mprintf("%s:%s", g.urlUser, g.urlPasswd);
+ char *zpw64 = encode64(zpw, strlen(zpw));
+ free(zpw);
+ blob_appendf(pHdr, "Authorization: Basic %s\r\n", zpw64);
+ free(zpw64);
}
blob_appendf(pHdr, "Host: %s\r\n", g.urlHostname);
blob_appendf(pHdr, "User-Agent: Fossil/" MANIFEST_VERSION "\r\n");
if( g.fHttpTrace ){
blob_appendf(pHdr, "Content-Type: application/x-fossil-debug\r\n");
| |||