c - detecting end of http header with \r\n\r\n -
using recv want http header can parse content length. i'm having problem detecting line break. or have observe line break or first time read buffer finish header (assuming have long plenty buffer).
this written in c.
edit: looking @ of related questions 1 of things worried "...the "\r\n" of header break might pulled buffer 2 different calls recv() prevent code recognizing header break."
you should phone call recv() repeatedly , each time gives x
bytes increment buffer-pointer give x
bytes (and decrease cb allowed write x
bytes). until buffer either contains \r\n\r\n
or full, in case close socket , ignore malicious client on. buffer-size should 3000 bytes.
but: ignores general problem server seems polling-server. if have experience should seek create epoll-server instead.
c http
No comments:
Post a Comment