Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 8318 → Rev 8319

/programs/cmm/TWB/TWB.c
210,7 → 210,7
}
break;
case '&': //  and so on
for (j=1, unicode_symbol=0; (ESBYTE[bufpos+j]<>';') && (j<8); j++)
for (j=1, unicode_symbol=0; (ESBYTE[bufpos+j]<>';') && (!__isWhite(ESBYTE[bufpos+j])) && (j<8); j++)
{
bukva = ESBYTE[bufpos+j];
chrcat(#unicode_symbol, bukva);
/programs/cmm/browser/WebView.c
31,7 → 31,7
 
char editbox_icons[] = FROM "res/editbox_icons.raw";
 
char version[]="WebView 2.7b";
char version[]="WebView 2.7c";
 
#include "texts.h"
#include "cache.h"
911,7 → 911,7
void CheckContentType()
{
char content_type[64];
if (http.header_field("content-type\0", #content_type, sizeof(content_type))) // application || image
if (http.header_field("content-type", #content_type, sizeof(content_type))) // application || image
if (content_type[0] == 'a') || (content_type[0] == 'i') {
EventOpenDownloader(history.current());
StopLoading();
923,7 → 923,7
void HandleRedirect()
{
char redirect_url[URL_SIZE];
http.header_field("location\0", #redirect_url, URL_SIZE);
http.header_field("location", #redirect_url, URL_SIZE);
get_absolute_url(#redirect_url, history.current());
history.back();
http.hfree();
/programs/cmm/downloader/const.h
34,7 → 34,7
#define WIN_W 580
#define WIN_H 100
 
char save_to[] = "/tmp0/1/Downloads";
char save_dir[] = "/tmp0/1/Downloads";
char dl_shared[] = "DL";
 
enum {
/programs/cmm/downloader/dl.c
7,7 → 7,6
 
#include "const.h"
 
dword bufpointer, bufsize;
bool exit_param = false;
 
_http http;
28,8 → 27,8
load_dll(boxlib, #box_lib_init,0);
load_dll(libHTTP, #http_lib_init,1);
 
if (!dir_exists(#save_to)) CreateDir(#save_to);
SetCurDir(#save_to);
if (!dir_exists(#save_dir)) CreateDir(#save_dir);
SetCurDir(#save_dir);
 
if (param) {
if (!strncmp(#param, "-exit ", 6)) {
45,7 → 44,6
}
}
if (main_url[0]) StartDownloading(); else strcpy(#main_url, "http://");
EditBox_UpdateText(#ed, #main_url);
@SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER + EVM_STACK);
@SetWindowLayerBehaviour(-1, ZPOS_ALWAYS_TOP);
112,7 → 110,7
if (!strncmp(#main_url,"https:",6)) {
miniprintf(#proxy_url, "http://gate.aspero.pro/?site=%s", #main_url);
strcpy(#main_url, #proxy_url);
EditBox_UpdateText(#ed, #main_url);
EditBox_UpdateText(#ed, ed.flags);
//notify("'HTTPS for download is not supported, trying to download the file via HTTP' -W");
//miniprintf(#http_url, "http://%s", #main_url+8);
//if (!downloader.Start(#http_url)) {
122,7 → 120,7
}
if (http.get(#main_url)) {
ed.blur_border_color = 0xCACACA;
ed.flags = 100000000000b;
EditBox_UpdateText(#ed, ed_disabled);
pb.value = 0;
DrawWindow();
} else {
150,14 → 148,12
void StopDownloading()
{
if (http.stop()) {
bufsize = 0;
bufpointer = free(bufpointer);
}
http.stop();
if (http.content_pointer) http.content_pointer = free(http.content_pointer);
http.content_received = http.content_length = 0;
 
ed.blur_border_color = 0xFFFfff;
ed.flags = 10b;
EditBox_UpdateText(#ed, ed_focus);
DrawWindow();
}
 
168,31 → 164,23
http.receive();
if (!http.content_length) http.content_length = http.content_received * 20; //MOVE?
 
if (http.receive_result == 0) {
if (http.status_code >= 300) && (http.status_code < 400)
{
http.header_field("location\0", #redirect_url, URL_SIZE);
if (http.receive_result) {
DrawDownloadingProgress();
} else {
if (http.status_code >= 300) && (http.status_code < 400) {
http.header_field("location", #redirect_url, URL_SIZE);
get_absolute_url(#redirect_url, #main_url);
strcpy(#main_url, #redirect_url);
EditBox_UpdateText(#ed, #main_url);
StopDownloading();
StartDownloading();
return;
}
bufpointer = http.content_pointer;
bufsize = http.content_received;
http.hfree();
}
 
DrawDownloadingProgress();
 
if (!http.receive_result)
{
SaveFile();
if (exit_param) ExitProcess();
StopDownloading();
DrawWindow();
return;
 
http.hfree();
}
}
 
199,26 → 187,30
void SaveFile()
{
int i;
char aux[2048];
char notify_message[4296];
char file_name[URL_SIZE+96];
 
//char file_name[URL_SIZE];
strcpy(#filepath, #save_dir);
chrcat(#filepath, '/');
 
//Content-Disposition: attachment; filename="RealFootball_2018_Nokia_5800_EN_IGP_EU_TS_101.zip"
//header_field("Content-Disposition\0", #redirect_url, URL_SIZE);
 
if (http.header_field("content-disposition", #file_name, sizeof(file_name))) {
if (EDX = strstr(#file_name,"filename=\"")) {
strcat(#filepath, EDX+10);
ESBYTE[strchr(#filepath,'\"')] = '\0';
}
} else {
// Clean all slashes at the end
strcpy(#aux, #main_url);
while (aux[strlen(#aux)-1] == '/') {
aux[strlen(#aux)-1] = 0;
strcpy(#file_name, #main_url);
while (file_name[strlen(#file_name)-1] == '/') {
file_name[strlen(#file_name)-1] = 0;
}
strcat(#filepath, #file_name+strrchr(#file_name, '/'));
}
 
strcpy(#filepath, #save_to);
chrcat(#filepath, '/');
strcat(#filepath, #aux+strrchr(#aux, '/'));
for (i=0; i<strlen(#filepath); i++) if(filepath[i]==':')||(filepath[i]=='?')filepath[i]='-';
 
if (CreateFile(http.content_received, bufpointer, #filepath)==0) {
if (CreateFile(http.content_received, http.content_pointer, #filepath)==0) {
miniprintf(#notify_message, FILE_SAVED_AS, #filepath);
} else {
miniprintf(#notify_message, FILE_NOT_SAVED, #filepath);
/programs/cmm/lib/obj/http.h
153,7 → 153,6
$dec edx
} while (AL != 0) && (AL != 13) && (AL != 10) && (EDX>0);
DSBYTE[EDI-1]='\0';
debugln(_dst);
return _dst;
}
return NULL;