bool StaticTestVerificationStage::execute(bool& continue_execution) { UNUSED_ARGUMENT(continue_execution); if(!enabled) return true; if(!hasParserContext()) return false; ParserContext& parser_context = getParserContext(); if(parser_context.tangle) { visitor::StaticTestVerificationStageVisitor verifier; verifier.visit(*parser_context.tangle); if(verifier.isAllMatch()) return true; else return false; } else { return false; } }
int headers_complete_cb(http_parser* parser) { ParserContext* c = getParserContext(parser); HTTPParser* p = getHTTPParser(parser); if( c->name != NULL){ saveNameValuePair(parser, c->name, c->value); } c->message->status_code = parser->status_code; c->message->http_major = parser->http_major; c->message->http_minor = parser->http_minor; if( c->url_buf == NULL ){ c->message->url = ""; }else{ c->message->url = std::string(c->url_buf->buffer, c->url_buf->used); } if( c->status_buf == NULL ){ c->message->status = ""; }else{ c->message->status = std::string(c->status_buf->buffer, c->status_buf->used); } c->message->method = static_cast<http_method>(parser->method); p->headersCompleteFlag = true; p->last_message = c->message; if( p-> onHeadersLambdaCB != NULL ) p->onHeadersLambdaCB(p, p->last_message); return 0; }
int header_field_data_cb(http_parser* parser, const char* at, size_t length) { ParserContext* c = getParserContext(parser); int state = c->header_state; if( (state == 0)||(state == kHEADER_STATE_NOTHING) || (state == kHEADER_STATE_VALUE)){ if( c->name != NULL){ saveNameValuePair(parser, c->name, c->value); sb_free(c->name); c->name = NULL; sb_free(c->value);c->value = NULL; } simple_buffer_t* sb = sb_create(); sb_append(sb, (char*)at, length); c->name = sb; c->value = NULL; } else if( state == kHEADER_STATE_FIELD){ simple_buffer_t* sb = c->name; sb_append(sb, (char*)at, length); } c->header_state = kHEADER_STATE_FIELD; return 0; }
int body_data_cb(http_parser* parser, const char* at, size_t length) { ParserContext* c = getParserContext(parser); // c->body->appendBytes(at, length); (c->message->body)->append(at, length); return 0; }
int status_data_cb(http_parser* parser, const char* at, size_t length) { ParserContext* context = getParserContext(parser); if( context->status_buf == NULL) context->status_buf = sb_create(); sb_append( context->status_buf, (char*)at, length); return 0; }
int message_complete_cb(http_parser* parser) { ParserContext* c = getParserContext(parser); HTTPParser* p = getHTTPParser(parser); p->last_message = c->message; p->messageCompleteFlag = true; if( p-> onMessageLambdaCB != NULL ) p->onMessageLambdaCB(p, p->last_message); /* * Now get ready for the next message */ p->setUpNextMessage(); return 0; }
int header_value_data_cb(http_parser* parser, const char* at, size_t length) { ParserContext* c = getParserContext(parser); int state = c->header_state; if( state == kHEADER_STATE_FIELD ){ simple_buffer_t* sb = sb_create(); sb_append(sb, (char*)at, length); c->value = sb; } else if( state == kHEADER_STATE_VALUE){ simple_buffer_t* sb = c->value; sb_append(sb, (char*)at, length); } c->header_state = kHEADER_STATE_VALUE; return 0; }
bool SemanticVerificationStage0::execute(bool& continue_execution) { UNUSED_ARGUMENT(continue_execution); if(!hasParserContext()) return false; ParserContext& parser_context = getParserContext(); if(parser_context.tangle) { visitor::SemanticVerificationStageVisitor0 verifier; verifier.visit(*parser_context.tangle); verifier.applyCleanup(); return true; } else { return false; } }