简体   繁体   中英

Should I use byte streams or character streams to handle HTTP messages?

I am writing a proxy server (college assignment). I've searched for example source code and it seems there are two extremes: byte stream user and character stream user.

From what I know, HTTP messages use ASCII encoding for only the request line (request), the status line (response) and the field names and allow any octet in the field values and request body.

So, what is the right way?

Byte streams are the correct way. Imagine forwarding a zip file download and parsing the content with a character stream...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM