Shop OBEX P1 Docs P2 Docs Learn Events
Opera, POST, and the W5100 Indirect Driver — Parallax Forums

Opera, POST, and the W5100 Indirect Driver

Mike GMike G Posts: 2,702
edited 2011-04-10 20:00 in Accessories
I found , at least with my code, that the W5100 Indirect Driver does not return POST data to the Propeller when the request comes form Opera. I suppose the @data pointer returned from the driver could be zero terminated before the message body? Can anyone confirm this?

Opera also causes unexpected results as compared to the other browsers, IE, Firefox and Chrome. Sometimes a resource request is served up no problem. Other times I see 0 data, try again and the data is there, and often I see a timeout before the data is severed up. I was hoping that I didn't have to mess with the driver and I could focus on the web server and my project but I guess it's time to dive in.

Comments

  • kuismakuisma Posts: 134
    edited 2011-01-09 09:33
    Does it work with the SPI driver?
  • Mike GMike G Posts: 2,702
    edited 2011-01-09 11:14
    Not sure. Did not try the SPI driver as I'm not using the SPI version.
  • kuismakuisma Posts: 134
    edited 2011-01-09 11:36
    Ok. You say "Other times I see 0 data, try again and the data is there". Is this for consecutive rxtcp(), or are you talking about different sessions?

    I've not looked at your code, and my apologizes if this is a too basic question, but you are aware that rxtcp() may return random amount of data at all times, e.g. the first call may return "GE" and the next return "T /index.html", so you have to collect the stream yourself..? This is inherent tcp, but is very much affected by the peer client implementation, and may differ from browser to browser.
  • Mike GMike G Posts: 2,702
    edited 2011-01-09 16:55
    Right, that's why I asked if any one else had issues with Opera , POST, and the indirect driver. So, I take it that you're not having any problems with Opera and retrieving the message body data?
  • kuismakuisma Posts: 134
    edited 2011-01-09 22:31
    You can never make any assumptions about how much of the stream rxtcp() returns, Opera or not Opera. Often you'll get a "logical" chunk of data, i.e. a line, a http request etc, but there is nothing guaranteeing this, and even using the same browser/client (e.g. Netscape) this will vary from time to time depending on other factors (network buffers available, system load, network mtu, packet loss, retransmissions etc). When using tcp, you always have to iterate rxtcp() (followed by a short sleep) until you got all the data you need, and this goes for tcp in general, not only Propeller, the Propeller driver or the W5100 chip.
  • Mike GMike G Posts: 2,702
    edited 2011-01-10 07:38
    I understand how TCP and packets work.

    If the request is a POST, I check the length of the body by finding the two lines (\n\n or \r\n\r\n). Then I calculate the length of the body. Next, I comparing the body length to the "Content-Length:". Finally, I try to handle any missing POST data. Something happens between the initial POST request and the next GET request. The GET is grabbing an image on the page.

    Kuisma, are you able to retrieve body content on a POST using Opera? Am I the only person having this problem or the first to report the problem?

    IE, Firefox, and Chrome all work as expected.
  • kuismakuisma Posts: 134
    edited 2011-01-10 08:14
    Mike G wrote: »
    I
    Kuisma, are you able to retrieve body content on a POST using Opera? Am I the only person having this problem or the first to report the problem?

    Supply me with an example (code, data), and I'll test it.
  • Chip CoxChip Cox Posts: 73
    edited 2011-04-10 19:42
    kuisma wrote: »
    When using tcp, you always have to iterate rxtcp() (followed by a short sleep) until you got all the data you need.

    Ok, this is a very elementary question and it's not as much about the spinneret as the web server loogic, and I am making the assumption that you are reading in the data before you try to parse it, and I'm sure I am not as familiar with tcp and HTTP protocols as I should be any more. End of disclaimers...

    But, How do you know when you don't have any more data to read?? Right now, I'm using a version of Tim's driver and when I call HTTPReady, I get back a buffer with data in it. Sometimes especially in a POST transaction, it comes back with just the header data and the form data is not there. It just ends at the blank line. But, by the time I realize that ( while I'm parsing out the record ), it's been quite a while... When I don't get the form data, everything looks ok except there isn't any form data Will I always have form data with a post transaction?? The header/body of the message ends with the same CRLFCRLF as the record does after the form data...
  • Mike GMike G Posts: 2,702
    edited 2011-04-10 20:00
    HTTP POST sends the forum collection in the message body [header] [new line] [new line] [body].
    http://www.w3.org/Protocols/
Sign In or Register to comment.