Subversion Repositories Kolibri OS

Rev

Rev 4554 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4554 Rev 4558
Line 48... Line 48...
48
proc_info Form;
48
proc_info Form;
49
#define WIN_W 640
49
#define WIN_W 640
50
#define WIN_H 480
50
#define WIN_H 480
Line 51... Line 51...
51
 
51
 
-
 
52
char search_path[]="http://nigma.ru/index.php?s=";
-
 
53
char str_location[]="location\0";
Line 52... Line 54...
52
char search_path[]="http://nigma.ru/index.php?s=";
54
int redirected = 0;
53
 
55
 
54
char stak[4096];
56
char stak[4096];
Line 181... Line 183...
181
					bufsize = ESI.http_msg.content_received;
183
					bufsize = ESI.http_msg.content_received;
182
					WB1.Parse(bufpointer, bufsize);
184
					WB1.Parse(bufpointer, bufsize);
Line 183... Line 185...
183
					
185
					
184
					$pop EAX	
186
					$pop EAX	
-
 
187
					if (EAX == 0) {	
-
 
188
						ESI = http_transfer;
-
 
189
						// Handle redirects
-
 
190
						if (ESI.http_msg.status >= 300) && (ESI.http_msg.status < 400)  {
-
 
191
							redirected++;
-
 
192
							if (redirected<=5) {
-
 
193
								http_find_header_field stdcall (http_transfer, #str_location);
-
 
194
								if (EAX!=0) {
-
 
195
									ESI = EAX;
-
 
196
									EDI = #URL;
-
 
197
									do {
-
 
198
										$lodsb;
-
 
199
										$stosb;
-
 
200
									} while (AL != 0) && (AL != 13) && (AL != 10));
-
 
201
									DSBYTE[EDI-1]='\0';
-
 
202
								}
-
 
203
							} else {
-
 
204
							//TODO: display error (too many redirects)
-
 
205
							}
-
 
206
						} else {
-
 
207
							redirected = 0;
185
					if (EAX == 0) {	
208
						}
186
						// Loading the page is complete, free resources
209
						// Loading the page is complete, free resources
187
						http_free stdcall (http_transfer);
210
						http_free stdcall (http_transfer);
-
 
211
						http_transfer=0;	
-
 
212
						if (redirected>0) {
188
						http_transfer=0;	
213
							WB1.GetNewUrl();
-
 
214
							strcpy(#editURL, #URL);
189
						Draw_Window();		// stop button => refresh button
215
							OpenPage();
190
					} else {
-
 
191
						// We are still loading the page, this means that because of crappy memory manager,
216
						} else {
192
						// the address of the HTTP data may change. 
-
 
193
						// Because this would result in pagefault when redrawing window while loading, we disable this possibility.
217
							Draw_Window();		// stop button => refresh button
194
						bufsize = 0;
218
						}
195
					}
219
					}
196
				}
220
				}
197
			default:
221
			default:
198
				if (downloader_id<>0)
222
				if (downloader_id<>0)