Fossil SCM
Enhance the test_env webpage so that it shows the original HTTP header text in showall=1 mode.
Commit
03f07b5a664bcba4e76a1d06411d76e129413242
Parent
29b558a1c10f6c6…
3 files changed
+3
+1
+7
-1
+3
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -1185,10 +1185,12 @@ | ||
| 1185 | 1185 | char zLine[2000]; /* A single line of input. */ |
| 1186 | 1186 | g.fullHttpReply = 1; |
| 1187 | 1187 | if( fgets(zLine, sizeof(zLine),g.httpIn)==0 ){ |
| 1188 | 1188 | malformed_request(); |
| 1189 | 1189 | } |
| 1190 | + blob_zero(&g.httpHeader); | |
| 1191 | + blob_append(&g.httpHeader, zLine, -1); | |
| 1190 | 1192 | cgi_trace(zLine); |
| 1191 | 1193 | zToken = extract_token(zLine, &z); |
| 1192 | 1194 | if( zToken==0 ){ |
| 1193 | 1195 | malformed_request(); |
| 1194 | 1196 | } |
| @@ -1223,10 +1225,11 @@ | ||
| 1223 | 1225 | while( fgets(zLine,sizeof(zLine),g.httpIn) ){ |
| 1224 | 1226 | char *zFieldName; |
| 1225 | 1227 | char *zVal; |
| 1226 | 1228 | |
| 1227 | 1229 | cgi_trace(zLine); |
| 1230 | + blob_append(&g.httpHeader, zLine, -1); | |
| 1228 | 1231 | zFieldName = extract_token(zLine,&zVal); |
| 1229 | 1232 | if( zFieldName==0 || *zFieldName==0 ) break; |
| 1230 | 1233 | while( fossil_isspace(*zVal) ){ zVal++; } |
| 1231 | 1234 | i = strlen(zVal); |
| 1232 | 1235 | while( i>0 && fossil_isspace(zVal[i-1]) ){ i--; } |
| 1233 | 1236 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -1185,10 +1185,12 @@ | |
| 1185 | char zLine[2000]; /* A single line of input. */ |
| 1186 | g.fullHttpReply = 1; |
| 1187 | if( fgets(zLine, sizeof(zLine),g.httpIn)==0 ){ |
| 1188 | malformed_request(); |
| 1189 | } |
| 1190 | cgi_trace(zLine); |
| 1191 | zToken = extract_token(zLine, &z); |
| 1192 | if( zToken==0 ){ |
| 1193 | malformed_request(); |
| 1194 | } |
| @@ -1223,10 +1225,11 @@ | |
| 1223 | while( fgets(zLine,sizeof(zLine),g.httpIn) ){ |
| 1224 | char *zFieldName; |
| 1225 | char *zVal; |
| 1226 | |
| 1227 | cgi_trace(zLine); |
| 1228 | zFieldName = extract_token(zLine,&zVal); |
| 1229 | if( zFieldName==0 || *zFieldName==0 ) break; |
| 1230 | while( fossil_isspace(*zVal) ){ zVal++; } |
| 1231 | i = strlen(zVal); |
| 1232 | while( i>0 && fossil_isspace(zVal[i-1]) ){ i--; } |
| 1233 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -1185,10 +1185,12 @@ | |
| 1185 | char zLine[2000]; /* A single line of input. */ |
| 1186 | g.fullHttpReply = 1; |
| 1187 | if( fgets(zLine, sizeof(zLine),g.httpIn)==0 ){ |
| 1188 | malformed_request(); |
| 1189 | } |
| 1190 | blob_zero(&g.httpHeader); |
| 1191 | blob_append(&g.httpHeader, zLine, -1); |
| 1192 | cgi_trace(zLine); |
| 1193 | zToken = extract_token(zLine, &z); |
| 1194 | if( zToken==0 ){ |
| 1195 | malformed_request(); |
| 1196 | } |
| @@ -1223,10 +1225,11 @@ | |
| 1225 | while( fgets(zLine,sizeof(zLine),g.httpIn) ){ |
| 1226 | char *zFieldName; |
| 1227 | char *zVal; |
| 1228 | |
| 1229 | cgi_trace(zLine); |
| 1230 | blob_append(&g.httpHeader, zLine, -1); |
| 1231 | zFieldName = extract_token(zLine,&zVal); |
| 1232 | if( zFieldName==0 || *zFieldName==0 ) break; |
| 1233 | while( fossil_isspace(*zVal) ){ zVal++; } |
| 1234 | i = strlen(zVal); |
| 1235 | while( i>0 && fossil_isspace(zVal[i-1]) ){ i--; } |
| 1236 |
+1
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -159,10 +159,11 @@ | ||
| 159 | 159 | int markPrivate; /* All new artifacts are private if true */ |
| 160 | 160 | int clockSkewSeen; /* True if clocks on client and server out of sync */ |
| 161 | 161 | int wikiFlags; /* Wiki conversion flags applied to %w and %W */ |
| 162 | 162 | char isHTTP; /* True if server/CGI modes, else assume CLI. */ |
| 163 | 163 | char javascriptHyperlink; /* If true, set href= using script, not HTML */ |
| 164 | + Blob httpHeader; /* Complete text of the HTTP request header */ | |
| 164 | 165 | |
| 165 | 166 | int urlIsFile; /* True if a "file:" url */ |
| 166 | 167 | int urlIsHttps; /* True if a "https:" url */ |
| 167 | 168 | int urlIsSsh; /* True if an "ssh:" url */ |
| 168 | 169 | char *urlName; /* Hostname for http: or filename for file: */ |
| 169 | 170 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -159,10 +159,11 @@ | |
| 159 | int markPrivate; /* All new artifacts are private if true */ |
| 160 | int clockSkewSeen; /* True if clocks on client and server out of sync */ |
| 161 | int wikiFlags; /* Wiki conversion flags applied to %w and %W */ |
| 162 | char isHTTP; /* True if server/CGI modes, else assume CLI. */ |
| 163 | char javascriptHyperlink; /* If true, set href= using script, not HTML */ |
| 164 | |
| 165 | int urlIsFile; /* True if a "file:" url */ |
| 166 | int urlIsHttps; /* True if a "https:" url */ |
| 167 | int urlIsSsh; /* True if an "ssh:" url */ |
| 168 | char *urlName; /* Hostname for http: or filename for file: */ |
| 169 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -159,10 +159,11 @@ | |
| 159 | int markPrivate; /* All new artifacts are private if true */ |
| 160 | int clockSkewSeen; /* True if clocks on client and server out of sync */ |
| 161 | int wikiFlags; /* Wiki conversion flags applied to %w and %W */ |
| 162 | char isHTTP; /* True if server/CGI modes, else assume CLI. */ |
| 163 | char javascriptHyperlink; /* If true, set href= using script, not HTML */ |
| 164 | Blob httpHeader; /* Complete text of the HTTP request header */ |
| 165 | |
| 166 | int urlIsFile; /* True if a "file:" url */ |
| 167 | int urlIsHttps; /* True if a "https:" url */ |
| 168 | int urlIsSsh; /* True if an "ssh:" url */ |
| 169 | char *urlName; /* Hostname for http: or filename for file: */ |
| 170 |
+7
-1
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -1179,11 +1179,17 @@ | ||
| 1179 | 1179 | @ g.userUid = %d(g.userUid)<br /> |
| 1180 | 1180 | @ g.zLogin = %h(g.zLogin)<br /> |
| 1181 | 1181 | @ capabilities = %s(zCap)<br /> |
| 1182 | 1182 | @ <hr> |
| 1183 | 1183 | P("HTTP_USER_AGENT"); |
| 1184 | - cgi_print_all(atoi(PD("showall","0"))); | |
| 1184 | + cgi_print_all(showAll); | |
| 1185 | + if( showAll ){ | |
| 1186 | + @ <hr> | |
| 1187 | + @ <pre> | |
| 1188 | + @ %h(blob_str(&g.httpHeader)) | |
| 1189 | + @ </pre> | |
| 1190 | + } | |
| 1185 | 1191 | if( g.perm.Setup ){ |
| 1186 | 1192 | const char *zRedir = P("redirect"); |
| 1187 | 1193 | if( zRedir ) cgi_redirect(zRedir); |
| 1188 | 1194 | } |
| 1189 | 1195 | style_footer(); |
| 1190 | 1196 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -1179,11 +1179,17 @@ | |
| 1179 | @ g.userUid = %d(g.userUid)<br /> |
| 1180 | @ g.zLogin = %h(g.zLogin)<br /> |
| 1181 | @ capabilities = %s(zCap)<br /> |
| 1182 | @ <hr> |
| 1183 | P("HTTP_USER_AGENT"); |
| 1184 | cgi_print_all(atoi(PD("showall","0"))); |
| 1185 | if( g.perm.Setup ){ |
| 1186 | const char *zRedir = P("redirect"); |
| 1187 | if( zRedir ) cgi_redirect(zRedir); |
| 1188 | } |
| 1189 | style_footer(); |
| 1190 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -1179,11 +1179,17 @@ | |
| 1179 | @ g.userUid = %d(g.userUid)<br /> |
| 1180 | @ g.zLogin = %h(g.zLogin)<br /> |
| 1181 | @ capabilities = %s(zCap)<br /> |
| 1182 | @ <hr> |
| 1183 | P("HTTP_USER_AGENT"); |
| 1184 | cgi_print_all(showAll); |
| 1185 | if( showAll ){ |
| 1186 | @ <hr> |
| 1187 | @ <pre> |
| 1188 | @ %h(blob_str(&g.httpHeader)) |
| 1189 | @ </pre> |
| 1190 | } |
| 1191 | if( g.perm.Setup ){ |
| 1192 | const char *zRedir = P("redirect"); |
| 1193 | if( zRedir ) cgi_redirect(zRedir); |
| 1194 | } |
| 1195 | style_footer(); |
| 1196 |