Fossil SCM

Make sure an HTTP request always has at least a single "/" in the pathname.

drh 2019-07-23 19:17 trunk
Commit 35d609a0ba81799be0992ea4b63ca425d2aff9e3127962feb21e9d4217c0b48f
1 file changed +3 -2
+3 -2
--- src/http.c
+++ src/http.c
@@ -116,12 +116,13 @@
116116
const char *zAltMimetype /* Alternative mimetype */
117117
){
118118
int nPayload = pPayload ? blob_size(pPayload) : 0;
119119
120120
blob_zero(pHdr);
121
- blob_appendf(pHdr, "%s %s HTTP/1.0\r\n",
122
- nPayload>0 ? "POST" : "GET", g.url.path);
121
+ blob_appendf(pHdr, "%s %s%s HTTP/1.0\r\n",
122
+ nPayload>0 ? "POST" : "GET", g.url.path,
123
+ g.url.path[0]==0 ? "/" : "");
123124
if( g.url.proxyAuth ){
124125
blob_appendf(pHdr, "Proxy-Authorization: %s\r\n", g.url.proxyAuth);
125126
}
126127
if( g.zHttpAuth && g.zHttpAuth[0] ){
127128
const char *zCredentials = g.zHttpAuth;
128129
--- src/http.c
+++ src/http.c
@@ -116,12 +116,13 @@
116 const char *zAltMimetype /* Alternative mimetype */
117 ){
118 int nPayload = pPayload ? blob_size(pPayload) : 0;
119
120 blob_zero(pHdr);
121 blob_appendf(pHdr, "%s %s HTTP/1.0\r\n",
122 nPayload>0 ? "POST" : "GET", g.url.path);
 
123 if( g.url.proxyAuth ){
124 blob_appendf(pHdr, "Proxy-Authorization: %s\r\n", g.url.proxyAuth);
125 }
126 if( g.zHttpAuth && g.zHttpAuth[0] ){
127 const char *zCredentials = g.zHttpAuth;
128
--- src/http.c
+++ src/http.c
@@ -116,12 +116,13 @@
116 const char *zAltMimetype /* Alternative mimetype */
117 ){
118 int nPayload = pPayload ? blob_size(pPayload) : 0;
119
120 blob_zero(pHdr);
121 blob_appendf(pHdr, "%s %s%s HTTP/1.0\r\n",
122 nPayload>0 ? "POST" : "GET", g.url.path,
123 g.url.path[0]==0 ? "/" : "");
124 if( g.url.proxyAuth ){
125 blob_appendf(pHdr, "Proxy-Authorization: %s\r\n", g.url.proxyAuth);
126 }
127 if( g.zHttpAuth && g.zHttpAuth[0] ){
128 const char *zCredentials = g.zHttpAuth;
129

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button