tinygo-org / drivers

TinyGo drivers for sensors, displays, wireless adaptors, and other devices that use I2C, SPI, GPIO, ADC, and UART interfaces.
https://tinygo.org
BSD 3-Clause "New" or "Revised" License
604 stars 188 forks source link

net/http: improve header parsing #438

Closed sago35 closed 2 years ago

sago35 commented 2 years ago

This PR improves header parsing.

# before : Can't find "\r\n\r\n"
buf[ofs:ofs+n] = []byte{..., '\r', '\a', '\r'}
buf[ofs:ofs+n] = []byte{'\a', ...}
# after : Can find "\r\n\r\n"
buf[ofs:ofs+n] = []byte{..., '\r', '\a', '\r'}
buf[ofs-3:ofs+n] = []byte{'\r', '\a', '\r', '\a', ...} // 

I was aware of this problem when I tried to access the following

deadprogram commented 2 years ago

Thanks @sago35 now merging.