Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | On the /jtext page, terminate the JSON array early if there are insufficient lines of text in the file to complete the request. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
6f5dfd9d800e692f8d23afffd6cb1ecf |
| User & Date: | drh 2021-09-07 19:15:13.008 |
Context
|
2021-09-07
| ||
| 21:12 | json API: removed reference to recently-removed DIFF_CONTEXT_MASK. ... (check-in: 0c496d8ad3 user: stephan tags: trunk) | |
| 19:15 | On the /jtext page, terminate the JSON array early if there are insufficient lines of text in the file to complete the request. ... (check-in: 6f5dfd9d80 user: drh tags: trunk) | |
| 19:09 | Add the /jtext webpage, intended for use by XHR. ... (check-in: 5f7fcbabf0 user: drh tags: trunk) | |
Changes
Changes to src/info.c.
| ︙ | ︙ | |||
1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 |
*/
void jtext_page(void){
int rid = 0;
const char *zName = PD("name", "");
int iFrom = atoi(PD("from","0"));
int iTo = atoi(PD("to","0"));
int ln;
const char *zSep;
Blob content;
Blob line;
Blob *pOut;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
| > | 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 |
*/
void jtext_page(void){
int rid = 0;
const char *zName = PD("name", "");
int iFrom = atoi(PD("from","0"));
int iTo = atoi(PD("to","0"));
int ln;
int go = 1;
const char *zSep;
Blob content;
Blob line;
Blob *pOut;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
|
| ︙ | ︙ | |||
1920 1921 1922 1923 1924 1925 1926 |
@ Invalid line range
return;
}
content_get(rid, &content);
g.isConst = 1;
cgi_set_content_type("text/json");
ln = 0;
| < | | > > | | | | 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 |
@ Invalid line range
return;
}
content_get(rid, &content);
g.isConst = 1;
cgi_set_content_type("text/json");
ln = 0;
while( go && ln<iFrom ){
go = blob_line(&content, &line);
ln++;
}
pOut = cgi_output_blob();
blob_append(pOut, "[\n", 2);
zSep = 0;
while( go && ln<=iTo ){
if( zSep ) blob_append(pOut, zSep, 2);
blob_trim(&line);
blob_append_json_literal(pOut, blob_buffer(&line), blob_size(&line));
zSep = ",\n";
go = blob_line(&content, &line);
ln++;
}
blob_appendf(pOut,"]\n");
blob_reset(&content);
}
/*
|
| ︙ | ︙ |