On Monday 02 March 2009 10:14:34 pm Harald Küthe wrote:
> Hello,
>
> >> The attached patch adds --post-data option to the wget applet.
>
> > Please resend as attachment. (rediff against current svn first).
>
> Attachment: wget-post-data.diff diffed against Revision 25485
+ if (opt & WGET_OPT_POST_DATA) {
+ int i;
+ int post_data_size = 0;
+ fprintf(sfp, "Content-Type:
application/x-www-form-urlencoded\r\n");
+ for (i=0; i<strlen(post_data); i++) {
+ if (URL_escape_char(post_data[i]))
+ post_data_size +=3;
+ else
+ post_data_size ++;
+ }
+ fprintf(sfp, "Content-Length: %d\r\n",
post_data_size );
+ fprintf(sfp, "Connection: Keep-Alive\r\n\r\n");
+
+ for (i=0; i<strlen(post_data); i++)
+ {
+ if (URL_escape_char(post_data[i]))
+ fprintf(sfp, "%%%02X",
post_data[i]);
+ else
+ fprintf(sfp, "%c",
post_data[i]);
+ }
+ fprintf(sfp, "\r\n");
+ }
#endif
fprintf(sfp, "Connection: close\r\n\r\n");
(1) Is it intended that after POSTDATA you emit "Connection: close"
or is there should be an "else" like this?
+ } else <===
#endif
fprintf(sfp, "Connection: close\r\n\r\n");
(2) Why do you emit "Connection: Keep-Alive", is it important?
will "Connection: close" work too (to save string space in the binary)?
Will it work without any "Connection: xxx"?
I applied the patch to svn, and experimentally removed "Connection:" headers.
It seems to work without them. Please test.
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox