[BusyBox] Query regarding HTTPD File Uploading

conn intel connintel at gmail.com
Mon Mar 31 14:56:06 UTC 2008


Thanks a Lot ..Its amazing.

When I used your script as an executable cgi, I can get the big tar file to
upload in just couple of seconds. Thus got some relief. I am using cgic and
started debugging their code but invain. I even forward my query to them.
According to them cgic is perfectly working, but I guess cgic may be the
bottleneck. Can you please share with us which c to cgi library you are
using.

Thanks for your cooperation,
Ankur.

On Mon, Mar 31, 2008 at 5:10 AM, Denys Vlasenko <vda.linux at googlemail.com>
wrote:

> On Saturday 29 March 2008 15:11, conn intel wrote:
> > Dear Denys Vlasenko,
> >
> > Please find the attached file "FileUpload.raw", packet log using
> wireshark.
> >
> > I have taken log from PC host, and tried to upload a file with name
> > "music.bmp" having size around 18 KB. Its still uploads 4KB with one
> stroke
> > and delays the upload process.
>
> I don't see it happening. Actually, log shows healthy and fast upload
> of entire file. Firefox pushing full-sized (1448 bytes packets)
> they get ack'ed, and entire upload ends successfully in ~0.03 seconds:
>
> 21:10:05.793692 IP 192.168.0.88.51763 > 192.168.0.238.80: S
> 2508189265:2508189265(0) win 5840 <mss 1460,sackOK,timestamp 7886166
> 0,nop,wscale 7>
> 21:10:05.794447 IP 192.168.0.238.80 > 192.168.0.88.51763: S
> 826553832:826553832(0) ack 2508189266 win 5792 <mss 1460,sackOK,timestamp
> 260732 7886166,nop,wscale 7>
> 21:10:05.794477 IP 192.168.0.88.51763 > 192.168.0.238.80: . ack 1 win 46
> <nop,nop,timestamp 7886167 260732>
> 21:10:05.795025 IP 192.168.0.88.51763 > 192.168.0.238.80: P 1:498(497) ack
> 1 win 46 <nop,nop,timestamp 7886167 260732>
> 21:10:05.795088 IP 192.168.0.88.51763 > 192.168.0.238.80: . 498:1946(1448)
> ack 1 win 46 <nop,nop,timestamp 7886167 260732>
> 21:10:05.796880 IP 192.168.0.238.80 > 192.168.0.88.51763: . ack 498 win 54
> <nop,nop,timestamp 260732 7886167>
> 21:10:05.796906 IP 192.168.0.88.51763 > 192.168.0.238.80: .
> 1946:3394(1448) ack 1 win 46 <nop,nop,timestamp 7886168 260732>
> 21:10:05.797043 IP 192.168.0.88.51763 > 192.168.0.238.80: .
> 3394:4842(1448) ack 1 win 46 <nop,nop,timestamp 7886168 260732>
> 21:10:05.798389 IP 192.168.0.238.80 > 192.168.0.88.51763: . ack 1946 win
> 77 <nop,nop,timestamp 260732 7886167>
> 21:10:05.798459 IP 192.168.0.88.51763 > 192.168.0.238.80: .
> 4842:6290(1448) ack 1 win 46 <nop,nop,timestamp 7886168 260732>
> 21:10:05.798599 IP 192.168.0.88.51763 > 192.168.0.238.80: P
> 6290:7738(1448) ack 1 win 46 <nop,nop,timestamp 7886168 260732>
> 21:10:05.799760 IP 192.168.0.238.80 > 192.168.0.88.51763: . ack 3394 win
> 99 <nop,nop,timestamp 260732 7886168>
> 21:10:05.799835 IP 192.168.0.88.51763 > 192.168.0.238.80: .
> 7738:9186(1448) ack 1 win 46 <nop,nop,timestamp 7886168 260732>
> 21:10:05.799977 IP 192.168.0.88.51763 > 192.168.0.238.80: .
> 9186:10634(1448) ack 1 win 46 <nop,nop,timestamp 7886168 260732>
> 21:10:05.804889 IP 192.168.0.238.80 > 192.168.0.88.51763: . ack 4842 win
> 122 <nop,nop,timestamp 260732 7886168>
> 21:10:05.804938 IP 192.168.0.88.51763 > 192.168.0.238.80: P
> 10634:12082(1448) ack 1 win 46 <nop,nop,timestamp 7886170 260732>
> 21:10:05.804957 IP 192.168.0.238.80 > 192.168.0.88.51763: . ack 6290 win
> 145 <nop,nop,timestamp 260732 7886168>
> 21:10:05.805028 IP 192.168.0.238.80 > 192.168.0.88.51763: . ack 7738 win
> 167 <nop,nop,timestamp 260733 7886168>
> 21:10:05.805100 IP 192.168.0.238.80 > 192.168.0.88.51763: . ack 9186 win
> 190 <nop,nop,timestamp 260733 7886168>
> 21:10:05.805124 IP 192.168.0.88.51763 > 192.168.0.238.80: .
> 12082:13530(1448) ack 1 win 46 <nop,nop,timestamp 7886170 260733>
> 21:10:05.805262 IP 192.168.0.88.51763 > 192.168.0.238.80: .
> 13530:14978(1448) ack 1 win 46 <nop,nop,timestamp 7886170 260733>
> 21:10:05.805400 IP 192.168.0.88.51763 > 192.168.0.238.80: P
> 14978:16178(1200) ack 1 win 46 <nop,nop,timestamp 7886170 260733>
> 21:10:05.805518 IP 192.168.0.88.51763 > 192.168.0.238.80: .
> 16178:17626(1448) ack 1 win 46 <nop,nop,timestamp 7886170 260733>
> 21:10:05.806437 IP 192.168.0.238.80 > 192.168.0.88.51763: . ack 10634 win
> 207 <nop,nop,timestamp 260733 7886168>
> 21:10:05.806456 IP 192.168.0.88.51763 > 192.168.0.238.80: .
> 17626:19074(1448) ack 1 win 46 <nop,nop,timestamp 7886170 260733>
> 21:10:05.807846 IP 192.168.0.238.80 > 192.168.0.88.51763: . ack 12082 win
> 197 <nop,nop,timestamp 260733 7886170>
> 21:10:05.810243 IP 192.168.0.238.80 > 192.168.0.88.51763: . ack 13530 win
> 187 <nop,nop,timestamp 260733 7886170>
> 21:10:05.810386 IP 192.168.0.238.80 > 192.168.0.88.51763: . ack 14978 win
> 177 <nop,nop,timestamp 260733 7886170>
> 21:10:05.811934 IP 192.168.0.238.80 > 192.168.0.88.51763: . ack 16178 win
> 169 <nop,nop,timestamp 260733 7886170>
> 21:10:05.811967 IP 192.168.0.88.51763 > 192.168.0.238.80: P
> 19074:19454(380) ack 1 win 46 <nop,nop,timestamp 7886171 260733>
> 21:10:05.819985 IP 192.168.0.238.80 > 192.168.0.88.51763: . ack 19454 win
> 175 <nop,nop,timestamp 260734 7886170>
>
> I will show last two packets in full below.
>
> 21:10:05.811967 IP 192.168.0.88.51763 > 192.168.0.238.80: P
> 19074:19454(380) ack 1 win 46 <nop,nop,timestamp 7886171 260733>
>        0x0000:  4500 01b0 bb17 4000 4006 fb99 c0a8 0058  E..... at .@......X
>        0x0010:  c0a8 00ee ca33 0050 9580 38d3 3144 35e9  .....3.P..8.1D5.
> ....
>        0x0190:  3134 3433 3439 3139 3936 3933 3133 3139  1443491996931319
>        0x01a0:  3638 3531 3537 3630 3831 3135 2d2d 0d0a  685157608115--..
> 21:10:05.819985 IP 192.168.0.238.80 > 192.168.0.88.51763: . ack 19454 win
> 175 <nop,nop,timestamp 260734 7886170>
>        0x0000:  4500 0034 cfa1 4000 4006 e88b c0a8 00ee  E..4.. at .@.......
>        0x0010:  c0a8 0058 0050 ca33 3144 35e9 9580 3a4f  ...X.P.31D5...:O
>        0x0020:  8010 00af a1a2 0000 0101 080a 0003 fa7e  ...............~
>        0x0030:  0078 555a                                .xUZ
>
> What follows is a bit strange: server says "200 OK":
>
> 21:10:09.519821 IP 192.168.0.238.80 > 192.168.0.88.51763: P 1:18(17) ack
> 19454 win 212 <nop,nop,timestamp 261105 7886170>
>        0x0000:  4500 0045 cfa2 4000 4006 e879 c0a8 00ee  E..E.. at .@..y....
>        0x0010:  c0a8 0058 0050 ca33 3144 35e9 9580 3a4f  ...X.P.31D5...:O
>        0x0020:  8018 00d4 e02c 0000 0101 080a 0003 fbf1  .....,..........
>        0x0030:  0078 555a 4854 5450 2f31 2e30 2032 3030  .xUZHTTP/1.0.200
>        0x0040:  204f 4b0d 0a                             .OK..
> 21:10:09.519852 IP 192.168.0.88.51763 > 192.168.0.238.80: . ack 18 win 46
> <nop,nop,timestamp 7887099 261105>
>
> and they it sends a page which complains about file NOT being sent!
>
> 21:10:09.521032 IP 192.168.0.238.80 > 192.168.0.88.51763: P 18:747(729)
> ack 19454 win 212 <nop,nop,timestamp 261105 7887099>
>        0x0000:  4500 030d cfa3 4000 4006 e5b0 c0a8 00ee  E..... at .@.......
>        0x0010:  c0a8 0058 0050 ca33 3144 35fa 9580 3a4f  ...X.P.31D5...:O
>        0x0020:  8018 00d4 4646 0000 0101 080a 0003 fbf1  ....FF..........
>        0x0030:  0078 58fb 436f 6e74 656e 742d 7479 7065  .xX.Content-type
>        0x0040:  3a20 7465 7874 2f68 746d 6c0d 0a0d 0a3c  :.text/html....<
>        0x0050:  4854 4d4c 3e3c 4845 4144 3e0a 3c54 4954  HTML><HEAD>.<TIT
>        0x0060:  4c45 3e63 6769 6320 7465 7374 3c2f 5449  LE>cgic.test</TI
>        0x0070:  544c 453e 3c2f 4845 4144 3e0a 3c42 4f44  TLE></HEAD>.<BOD
>        0x0080:  593e 3c48 313e 6367 6963 2074 6573 743c  Y><H1>cgic.test<
>        0x0090:  2f48 313e 0a3c 6872 3e0a 3c21 2d2d 2032  /H1>.<hr>.<!--.2
>        0x00a0:  2e30 3a20 6d75 6c74 6970 6172 742f 666f  .0:.multipart/fo
>        0x00b0:  726d 2d64 6174 6120 6973 2072 6571 7569  rm-data.is.requi
>        0x00c0:  7265 6420 666f 7220 6669 6c65 2075 706c  red.for.file.upl
>        0x00d0:  6f61 6473 2e20 2d2d 3e3c 666f 726d 206d  oads..--><form.m
>        0x00e0:  6574 686f 643d 2250 4f53 5422 2065 6e63  ethod="POST".enc
>        0x00f0:  7479 7065 3d22 6d75 6c74 6970 6172 742f  type="multipart/
>        0x0100:  666f 726d 2d64 6174 6122 2009 6163 7469  form-data"..acti
>        0x0110:  6f6e 3d22 2f63 6769 2d62 696e 2f63 6769  on="/cgi-bin/cgi
>        0x0120:  6374 6573 742e 6367 6922 3e0a 3c70 3e46  ctest.cgi">.<p>F
>        0x0130:  696c 6520 5570 6c6f 6164 3a0a 3c69 6e70  ile.Upload:.<inp
>        0x0140:  7574 2074 7970 653d 2266 696c 6522 206e  ut.type="file".n
>        0x0150:  616d 653d 2266 696c 6522 2076 616c 7565  ame="file".value
>        0x0160:  3d22 223e 2028 5365 6c65 6374 2041 204c  ="">.(Select.A.L
>        0x0170:  6f63 616c 2046 696c 6529 0a3c 703e 0a3c  ocal.File).<p>.<
>        0x0180:  696e 7075 7420 7479 7065 3d22 7375 626d  input.type="subm
>        0x0190:  6974 2220 6e61 6d65 3d22 7465 7374 6367  it".name="testcg
>        0x01a0:  6963 2220 7661 6c75 653d 2253 7562 6d69  ic".value="Submi
>        0x01b0:  7420 5265 7175 6573 7422 3e0a 3c69 6e70  t.Request">.<inp
>        0x01c0:  7574 2074 7970 653d 2272 6573 6574 2220  ut.type="reset".
>        0x01d0:  7661 6c75 653d 2252 6573 6574 2052 6571  value="Reset.Req
>        0x01e0:  7565 7374 223e 0a3c 703e 5361 7665 2074  uest">.<p>Save.t
>        0x01f0:  6865 2043 4749 2045 6e76 6972 6f6e 6d65  he.CGI.Environme
>        0x0200:  6e74 3c70 3e0a 5072 6573 7369 6e67 2074  nt<p>.Pressing.t
>        0x0210:  6869 7320 6275 7474 6f6e 2077 696c 6c20  his.button.will.
>        0x0220:  7375 626d 6974 2074 6865 2066 6f72 6d2c  submit.the.form,
>        0x0230:  2074 6865 6e20 7361 7665 2074 6865 2043  .then.save.the.C
>        0x0240:  4749 2065 6e76 6972 6f6e 6d65 6e74 2073  GI.environment.s
>        0x0250:  6f20 7468 6174 2069 7420 6361 6e20 6265  o.that.it.can.be
>        0x0260:  2072 6570 6c61 7965 6420 6c61 7465 7220  .replayed.later.
>        0x0270:  6279 2063 616c 6c69 6e67 2063 6769 5265  by.calling.cgiRe
>        0x0280:  6164 456e 7669 726f 6e6d 656e 7420 2869  adEnvironment.(i
>        0x0290:  6e20 6120 6465 6275 6767 6572 2c20 666f  n.a.debugger,.fo
>        0x02a0:  7220 696e 7374 616e 6365 292e 3c70 3e0a  r.instance).<p>.
>        0x02b0:  3c69 6e70 7574 2074 7970 653d 2273 7562  <input.type="sub
>        0x02c0:  6d69 7422 206e 616d 653d 2273 6176 6565  mit".name="savee
>        0x02d0:  6e76 6972 6f6e 6d65 6e74 2220 7661 6c75  nvironment".valu
>        0x02e0:  653d 2253 6176 6520 456e 7669 726f 6e6d  e="Save.Environm
>        0x02f0:  656e 7422 3e0a 3c2f 666f 726d 3e0a 3c2f  ent">.</form>.</
>        0x0300:  424f 4459 3e3c 2f48 544d 4c3e 0a         BODY></HTML>.
> 21:10:09.521041 IP 192.168.0.88.51763 > 192.168.0.238.80: . ack 747 win 58
> <nop,nop,timestamp 7887099 261105>
>
> Then connection is closed normally:
>
> 21:10:09.521731 IP 192.168.0.238.80 > 192.168.0.88.51763: F 747:747(0) ack
> 19454 win 212 <nop,nop,timestamp 261105 7887099>
> 21:10:09.521833 IP 192.168.0.88.51763 > 192.168.0.238.80: F 19454:19454(0)
> ack 748 win 58 <nop,nop,timestamp 7887099 261105>
> 21:10:09.522298 IP 192.168.0.238.80 > 192.168.0.88.51763: . ack 19455 win
> 212 <nop,nop,timestamp 261105 7887099>
>
> I can only conclude that server-side CGI script was unable
> to properly parse uploaded file's data.
>
> > Also can you please elaborate more on following. how can I use it and
> where
> > ?
> > "#!/bin/sh
> > printf '\r\n'
> > cat >/tmp/POSTDATA "
>
> Put this into /cgi-bin/fwupgrade.cgi file (relative to httpd's top
> directory):
>
> #!/bin/sh
> printf '\r\n'
> cat >/tmp/POSTDATA
>
> make it executable, and use it as simplest CGI for saving unprocessed
> POST uploads. For example, user can initiate uploads from this
> simple page:
>
> test_upload.htm
> ===============
> <html><body>
> <form action="/cgi-bin/fwupgrade.cgi" enctype="multipart/form-data"
> method="post">
> <p>Please specify a file:
> <p><input type="file" name="datafile" size="40">
> <p><input type="submit" value="Send">
> </form>
>
> --
> vda
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.busybox.net/pipermail/busybox/attachments/20080331/27f65d96/attachment-0002.htm 


More information about the busybox mailing list