Here are the examples of the python api httpwookiee.http.parser.request.Request.STATUS_OPTIONAL_SEPARATOR taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
0
View Complete Implementation : requests.py
Copyright GNU General Public License v3.0
Author : regilero
Copyright GNU General Public License v3.0
Author : regilero
def parse_start_of_stream(self, msg):
firstline = self.parse_line_from_buffer()
status = msg.parse_first_line(firstline)
if Request.STATUS_OPTIONAL_SEPARATOR == status:
# Ok, it was not really the first line, this is allowed 1 time
# but 1 time only
try:
firstline = self.parse_line_from_buffer()
status = msg.parse_first_line(firstline)
except EndOfBufferError:
# well, it was an extra CRLF at the end
raise OptionalCRLFSeparator()
while Request.STATUS_OPTIONAL_SEPARATOR == status:
# oups, we've got too much CRLF between requests
self.setError(self.ERROR_BAD_MESSAGES_SEPARATOR)
if self.rfc:
self._abort_parsing()
return False
try:
firstline = self.parse_line_from_buffer()
status = msg.parse_first_line(firstline)
except EndOfBufferError:
# we've reach EOS on a CRLF or LF serie
return False
if msg.version_major == 0 and msg.version_minor == 9 and self.rfc:
# In rfc mode we just stop the parsing here
# and go to the response mode+close directly
self._abort_parsing()
status = Message.STATUS_COMPLETED
# note that this parser will try to extract 'regular' http
# query even if http/0.9 is detected if not set in rfc mode
return status