[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
LYNX-DEV <input type=file>: I need your opinion.
From: |
Henri Torgemane |
Subject: |
LYNX-DEV <input type=file>: I need your opinion. |
Date: |
Mon, 27 Jan 1997 21:31:53 -0500 |
Hi,
I'm now working on what Young Hyun Bae started.
Because I don't have a lot of time to have the functions I need
working, I took some arbitrary decisions that may not fit with the
general lynx design.
However, I'd like to adapt what I'm doing to make it usable for
everybody.
Here is a list of points and questions: I'd like to have your
opinion on it.
- To send binary files as post data, I couldn't use the .post_data
member, because it's a string, and the presence of '\0' inside it
gives some interesting results, but not the good ones..
What I did was to add 4 members to each structure containing post_data:
char * file_content[MAX_FILE];
int current_file_content;
int file_content_length[MAX_FILE];
int data_offset[MAX_FILE];
where file_content is an array where each used slot contains the file
itself,
current_file_content is an index to the next available slot,
file_content_length is an array where each slot contains the size of the
file,
and data_offset contains a value indicating where the file must be inserted
in
the post_data member when the request is sent.
This means that
- there cannot be more than MAX_FILE file upload in the same page.
- the whole file is stored in memory as long as the document using it
is somewhere in memory.
The first limitation could be easily removed with a linked list, but I
don't
know how to use the Lynx version of this ( if it exists ).
- Because these 4 members are always accessed the same ways, but belong to
differents objects ( 4 differents object ), I had to use big #define like:
#define COPY_FILE(x,y) {\
int j;\
if (TRACE) { \
fprintf(stderr,"COPY_FILE: %s (%d)\n",__FILE__,__LINE__); \
} \
(x).current_file_content = (y).current_file_content; \
for ( j = 0; j < (y).current_file_content; j++) \
{ \
(x).file_content[j] = (char *) malloc((y).file_content_length[j]); \
memcpy( (x).file_content[j], \
(y).file_content[j], \
(y).file_content_length[j] ); \
file_content_length[j] = (y).file_content_length[j]; \
(x).data_offset[j] = (y).data_offset[j]; \
if (TRACE) { \
fprintf(stderr,"content of file %d:\n%s\n",j,(x).file_content[j]); \
} \
} \
}
All the defines are stored in a .h file in the WWW/...tation directory.
I added a #include "henri.h" at the end of HTUtils.h. It may not be the
best place, but it was a quick way to be sure any source will be able to
use the defines.
I have not seen this anywhere else in the Lynx source code. So I'm
wondering if there's a better to get the same results?
- The actual mix between post_data and file_content is done in HTTP.c
Do we have the "right" to change the lib_www code like this?
- For my needs, I will make the file transfer through z-modem.
However, for a general use, if a page contains several file upload tags,
should I ask once for all which upload method to use, or should I ask for
each file?
- For now, I kept the original routine from Young Hyun Bae to upload
through
Zmodem. However, I think there's a way to get something more flexible, like
the download page, which is fully configurable through userdefs.h. Could
someone tell me which routines I should call (or modify)? ( This should be
working in anonymous mode, without DIRED )
Thank you for your answers,
Henri
--
address@hidden http://hpweb.utc.fr/~htorgema/
;
; To UNSUBSCRIBE: Send a mail message to address@hidden
; with "unsubscribe lynx-dev" (without the
; quotation marks) on a line by itself.
;
- LYNX-DEV <input type=file>: I need your opinion.,
Henri Torgemane <=