我正在编写一个依赖于OpenGL 2.0或更高版本的程序.看看GL 2.0的规格,我看到ARB_shader_objects中定义的扩展已被提升,我想这意味着GL版本2.0及更高版本不再需要ARB前缀,任何支持> GL2.0的实现都将此作为核心实施.
话虽如此,当我在Linux上编译我的程序gcc时会发出警告:隐式声明函数.获取这些函数的一种方法是在程序本身中声明它们,然后通过*GetProcAddress函数获取函数指针.
另一种方法是在包含glext.h之前定义GL_GLEXT_PROTOTYPES,这避免了获取每个函数的函数指针的问题,这些函数默认现在存在于GL2.0或更高版本中.有人可以建议,如果这是一个推荐和正确的方式?基线是我的程序需要OpenGL 2.0或更高版本,我不想支持任何比GL2.0更少的东西.
如果有人建议使用欢乐或者glew,我不想使用/有选项来使用欢乐或glew库来实现同样的目标.
我想在为我的 springboot 应用程序进行集成测试时禁用 csrf。我已经尝试过 security.enable-csrf=false 但这似乎没有任何效果。我还尝试通过 SecurityMockMvcRequestPostProcessors.csrf 方法在测试中传递 csrf 令牌,但无济于事。
在我的应用程序中,有一个自定义的 SecurityConfig,它扩展了 WebSecurityConfigurerAdapter 并具有如下代码:
http
.csrf() .csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
.and()
.authorizeRequests()
.antMatchers(LOGIN_URL).permitAll()
.antMatchers("/api/v1/forgotpwd").permitAll()
.antMatchers("/api/v1/changepwd").permitAll()
.antMatchers("/api/v1/isLoggedIn").permitAll()
.antMatchers("/api/**").authenticated()
.and()
.logout().logoutUrl("/api/v1/logout").deleteCookies("JSESSIONID").invalidateHttpSession(true)
.logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler())
.and()
.addFilter(jsonUsernamePasswordAuthenticationFilter())
.addFilterAfter(new MDCEmailSetterFilter(),JsonUsernamePasswordAuthenticationFilter.class);
Run Code Online (Sandbox Code Playgroud)
如果我设置 http.csrf().disable(),我的测试将正常工作,并且不会发生 csrf 令牌身份验证失败,否则它会抛出 403 并显示无法验证 csrf 令牌的消息。
有什么帮助吗?
spring spring-mvc spring-security spring-boot spring-boot-test
我正在使用 django-allauth 和 django rest-auth。
这是堆栈跟踪:
[2016-02-15 23:45:35,093] ERROR [base:handle_uncaught_exception:256 8977] Internal Server Error: /api/rest-auth/registration/
Traceback (most recent call last):
File "/home/.../webapps/project_test/lib/python2.7/Django-1.8.7-py2.7.egg/django/core/handlers/base.py", line 132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/.../webapps/project_test/lib/python2.7/Django-1.8.7-py2.7.egg/django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "/home/.../webapps/project_test/lib/python2.7/Django-1.8.7-py2.7.egg/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/home/.../webapps/project_test/.ve/lib/python2.7/site-packages/rest_framework/views.py", line 452, in dispatch
response = self.handle_exception(exc)
File "/home/.../webapps/project_test/.ve/lib/python2.7/site-packages/rest_framework/views.py", line 449, in dispatch
response = handler(request, *args, **kwargs)
File "/home/.../webapps/project_test/.ve/lib/python2.7/site-packages/rest_auth/registration/views.py", line 44, in post
self.form_valid(self.form)
File "/home/.../webapps/project_test/.ve/lib/python2.7/site-packages/rest_auth/registration/views.py", line …Run Code Online (Sandbox Code Playgroud) 我使用 django.contrib.staticfiles 和 django-storages 将静态文件部署到 Amazon S3。我使用的 django 版本是 1.10.4,django-storages 版本是 1.5.2。
现在,当我运行collectstatic时,即使本地文件没有更改,它也会将所有文件从本地系统重新复制到S3。查看collectstatic管理命令代码我可以看到:
在方法delete_file中:
# The full path of the target file
if self.local:
full_path = self.storage.path(prefixed_path)
else:
full_path = None
# Skip the file if the source file is younger
# Avoid sub-second precision (see #14665, #19540)
if (target_last_modified.replace(microsecond=0) >= source_last_modified.replace(microsecond=0) and
full_path and not (self.symlink ^ os.path.islink(full_path))):
if prefixed_path not in self.unmodified_files:
self.unmodified_files.append(prefixed_path)
self.log("Skipping '%s' (not modified)" % path)
return False
Run Code Online (Sandbox Code Playgroud)
在调试时,我看到即使 target_last_modified >= source_last_modified 但 full_path 为 …
调度程序中存在的重复过滤器与IgnoreVisitedItems中间件之间有什么区别?
Google小组主题提示调度程序中存在重复的过滤器:http://groups.google.com/group/scrapy-users/browse_thread/thread/8e218bcc5b293532
我有以下代码与urllib2打印HTTP错误403:禁止但如果我使用urllib而不是获取网址,我没有看到任何错误,我得到了我的朋友列表.在这两种情况下使用的访问令牌都是相同的.
url = 'https://graph.facebook.com/me/friends/'
params = {'access_token': 'a valid access-token...', 'fields': 'id,name,birthday'}
req = urllib2.Request(url, data=urllib.urlencode(params))
try:
con = urllib2.urlopen( req )
print con.read()
except Exception as excp:
print excp.read()
Run Code Online (Sandbox Code Playgroud)
请建议可能出错的地方.
django ×2
python ×2
amazon-s3 ×1
opengl ×1
scrapy ×1
spring ×1
spring-boot ×1
spring-mvc ×1
urllib2 ×1